Reputation: 1512
I am working with MobileNetv2
, and using deeplab
as the preprocessor (if that's the right term?). I have done transfer learning to train the example network on my own dataset, creating .meta
, .index
and .pbtxt
files. When I try to convert these to a pb
file, I have hit a number of problems.
freeze_graph.py
needs to know the output_node_names
. If I were using InceptionV3 instead of deeplab, that would be "InceptionV3/Predictions/Reshape_1". Elsewhere I have seen people use "softmax".
I have tried listing the node names with
print([node.name for node in graph.as_graph_def().node])
but that list is way too long. Searching for variations of "prediction", "output", "reshape", "softmax" didn't reveal anything promising.
I had a look on the tensorboard, but I was overwhelmed by the complexity of the diagram. I couldn't find anything which looked like an output node.
Some people suggest bazel, but when I tried
bazel build tensorflow/tools/graph_transforms:summarize_graph
I get
ERROR: no such package 'tensorflow/tools/graph_transforms': BUILD file not found on package path`
Edit: in case it is relevant, I used the mobilenetv2_coco_voc_trainaug
checkpoint as the starting point for my transfer learning from https://github.com/tensorflow/models/blob/master/research/deeplab/g3doc/model_zoo.md
Upvotes: 0
Views: 1720
Reputation: 4183
Given that the code to generate the graph is on github, I'd just construct it from scratch and check the final name.
import tensorflow as tf
# you'll need `models/research/slim` on your PYTHONPATH FOR THE FOLLOWING
from nets.mobilenet import mobilenet_v2
image = tf.zeros((1, 224, 224, 3), dtype=tf.float32) # values don't matter
out, endpoints = mobilenet_v2.mobilenet(image)
print(out.name)
Upvotes: 1