利用inceptionv3网络模型训练自己的图片时这段代码一直报错
#载入图片 image_data = tf.gfile.FastGFile(os.path.join(root, file), 'rb').read() graph = tf.get_default_graph() data_tensor = graph.get_tensor_by_name('DecodeJpg/contents:0') predictions = sess.run(softmax_tensor, {data_tensor: image_data})#图片格式是jpg格式 predictions = np.squeeze(predictions)#把结果转为1维数据
这句报错意思是不存在DecodeJpg/contents这个参数,Stackoverflow网站上有个人说了解决办法
用
for op in graph.get_operations(): print(op.name)
这段输出自己的参数,把参数名字改对就可以了