【问题标题】:How to find the Input and Output Nodes of a Frozen Model如何找到冻结模型的输入和输出节点
【发布时间】:2018-06-20 22:53:49
【问题描述】:
【问题讨论】:
标签:
tensorflow
inference
object-detection-api
【解决方案1】:
我认为您可以使用以下代码。我从here 下载了ssd_mobilenet_v1_coco 冻结模型,并能够获得如下所示的输入和输出名称
!pip install tensorflow==1.15.5
import tensorflow as tf
tf.__version__ # TF1.15.5
gf = tf.GraphDef()
m_file = open('/content/frozen_inference_graph.pb','rb')
gf.ParseFromString(m_file.read())
with open('somefile.txt', 'a') as the_file:
for n in gf.node:
the_file.write(n.name+'\n')
file = open('somefile.txt','r')
data = file.readlines()
print("output name = ")
print(data[len(data)-1])
print("Input name = ")
file.seek ( 0 )
print(file.readline())
输出是
output name =
detection_classes
Input name =
image_tensor
请查看gist here。