gpt4 book ai didi

tensorflow - 如何查找卡住模型的输入和输出节点

转载 作者:行者123 更新时间:2023-12-02 23:04:38 31 4
gpt4 key购买 nike

我想在模型动物园中的卡住模型上使用tensorflow的optimize_for_inference.py脚本:ssd_mobilenet_v1_coco

如何查找/确定模型的输入名称和输出名称?

Here is a link to the graph generated by tensorboard

Hires version of the graph generated by tensorboard

这个问题可能有帮助:Given a tensor flow model graph, how to find the input node and output node names (对我来说没有)

最佳答案

我认为你可以使用以下代码。我从 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 .

关于tensorflow - 如何查找卡住模型的输入和输出节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48209965/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com