我下载了一个retrained_graph.pb
and retrained_labels.txt
我在 Azure 认知服务中训练的模型的文件。现在我想使用该模型制作一个 Android 应用程序,为此我必须将其转换为 TFLite 格式。我使用了 toco,但出现以下错误:
ValueError: Invalid tensors 'input' were found.
我基本上按照本教程进行操作,但在步骤 4 和直接操作上遇到问题
复制粘贴终端代码:https://heartbeat.fritz.ai/neural-networks-on-mobile-devices-with-tensorflow-lite-a-tutorial-85b41f53230c https://heartbeat.fritz.ai/neural-networks-on-mobile-devices-with-tensorflow-lite-a-tutorial-85b41f53230c
我在这里胡乱猜测,也许你进来了input_arrays=input
。
这可能不是真的。使用此脚本查找冻结推理图的输入和输出数组的名称
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 "output name = "
print data[len(data)-1]
print "Input name = "
file.seek ( 0 )
print file.readline()
就我而言,它们是:
output name: SemanticPredictions
input name: ImageTensor
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)