在张量流中将 SSD 转换为冻结图。必须使用哪些输出节点名称?

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

我使用 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 训练了 SSD。在该程序中,我必须提供输出节点名称。我无法弄清楚必须在此处使用的 SSD 模型中的节点名称。请帮忙。我尝试了 'num_detections:0'、'detection_boxes:0' 等。只得到错误:

断言错误:num_detections 不在图表中

您可以自行探索图表:A Tool Developer's Guide to TensorFlow Model Files 并查找节点名称。我可以从我的模型中提供样本:"prefix/digit1/Softmax:0"(在我的 keras 模型中是 "digit1") 另外我记得你应该向 transform_graph 实用程序(“--output”参数)提供这些名称的列表。

我们有一个特殊的工具可以在 Tensorflow 对象检测中转换为冻结图 API --- 只是 运行 export_inference_graph.py binary. Directions for using this tool are here

我正在使用这个小 python 脚本根据其操作来本地化节点。 "PLaceholder" 和 "Identity" 似乎很有趣,可以找到输入和输出节点:

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)])