Converting SSD to frozen graph in tensorflow. Which output node names must be used?

戏子无情 提交于 2019-12-22 10:57:03

问题


I trained SSD using TensorFlow Object Detection API as described here. It produces a ckpt, meta and index file. In order to run it on my images I tried to check the demo code. It requires that the model be converted to frozen graph. I tried to convert my model to a frozen inference graph as described here. In that program I have to provide output node names. I could not figure out the name of the node in the SSD model which must be used here. Please help. I tried 'num_detections:0', 'detection_boxes:0' etc. Only to get error:

AssertionError: num_detections is not in graph


回答1:


We have a special tool to convert to frozen graphs in the Tensorflow Object Detection API --- just run the export_inference_graph.py binary. Directions for using this tool are here.




回答2:


You can explore graph by self: A Tool Developer's Guide to TensorFlow Model Files and find node names. I can give sample from my model: "prefix/digit1/Softmax:0" (it was "digit1" in my keras model) Also as I remember you should provide list of these names to transform_graph utility ("--output" parameter).




回答3:


i am using this small python script to localize nodes based on its operations. "PLaceholder" and "Identity" appear to be interesting to find Input and Output Nodes:

import tensorflow as tf

NODE_OPS = ['Placeholder','Identity']
MODEL_FILE = '/path/to/frozen_inference_graph.pb'

gf = tf.GraphDef()
gf.ParseFromString(open(MODEL_FILE,'rb').read())

print([n.name + '=>' +  n.op for n in gf.node if n.op in (NODE_OPS)])


来源:https://stackoverflow.com/questions/45017356/converting-ssd-to-frozen-graph-in-tensorflow-which-output-node-names-must-be-us

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!