如何识别张量板图中的输入和输出名称,例如本文所附图片中的输入和输出名称?

EE2*_*017 1 python deep-learning tensorflow tensorboard tensorflow-lite

我使用 MobileNet_v1_1.0_224 张量流模型进行对象检测。现在,我有自定义冻结图(.pb 文件),需要将其转换为 tflite 扩展名,以便我可以在移动设备上使用我的模型。

有人可以帮我识别这个张量板图中的输入和输出名称吗?我需要它们用作输入和输出参数,以将我的冻结图(.pb 文件)转换为tensorflow lite(.tflite)文件

来自张量板的图表

同一张图

Aji*_*kya 5

您可以使用此代码:

import tensorflow as tf
gf = tf.GraphDef()   
m_file = open('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 ("\noutput name = ")
print (data[len(data)-1])

print ("Input name = ")
file.seek ( 0 )
print (file.readline())
Run Code Online (Sandbox Code Playgroud)

就我而言,我有

output name: SemanticPredictions
input name: ImageTensor
Run Code Online (Sandbox Code Playgroud)