我正在使用tensorflow进行图像分类项目。我在命令提示符下使用Python。将retrain.py和label_image.py保留在c:中。
我能够使用以下命令行完成图像训练:
python c:\retrain.py --image_dir=c:\training_images --output_lables=retrained_labels.txt --output_graph=retrained_graph.pb
现在,我试图通过向训练模型证明不同的图像来查看分类级别。
python c:\label_image.py --image=c:\test_image\32.jpg --graph=retrained_graph.pb --labels=retrained_labels.txt
我收到错误消息:
2018-12-20 10:54:08.842991: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
Traceback (most recent call last):
File "c:\label_image.py", line 121, in <module>
input_operation = graph.get_operation_by_name(input_name);
File "C:\Users\pgooneti\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 3618, in get_operation_by_name
return self.as_graph_element(name, allow_tensor=False, allow_operation=True)
File "C:\Users\pgooneti\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 3490, in as_graph_element
return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
File "C:\Users\pgooneti\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 3550, in _as_graph_element_locked
"graph." % repr(name))
KeyError: "The name 'import/input' refers to an Operation not in the graph."
我遵循了一些推荐的方法,包括将输入更改为“ Mul”,但尚未修复。
为什么会出现“ KeyError:“名称'import / input'指的是图中未包含的操作”。
任何解决方法?
谢谢, Pubudu