keyerror名称“导入/占位符”是指图中未包含的操作

时间:2019-05-21 01:33:53

标签: python tensorflow

所以我试图为Inception V3模型运行Tensorflow重新训练,无论我做什么,运行label_image命令都行不通。

我尝试这样重置值:

input_height = 299
input_width = 299
input_mean = 0
input_std = 299
input_layer = "input"
output_layer = "final_result"

如此:

input_height = 299
input_width = 299
input_mean = 0
input_std = 299
input_layer = "Mul"
output_layer = "final_result"

命令

python label_image.py --graph=output_graph.pb --labels=output_labels.txt --output_layer=final_result --input_layer=Placeholder --image=fox.png 

产生标题错误。

将命令更改为:

python label_image.py --graph=output_graph.pb     --labels=output_labels.txt --output_layer=final_result --input_layer=input --image=fox.png 

给出相同的错误,但带有“导入/输入”

现在的命令:

python label_image.py --graph=output_graph.pb --labels=output_labels.txt --output_layer=final_result --image=fox.png

错误:

Traceback (most recent call last):
  File "label_image.py", line 128, in <module>
    input_operation = graph.get_operation_by_name(input_name)
  File "C:\Users\Phil\AppData\Local\Programs\Python\Python37\lib\site-packages\t
ensorflow\python\framework\ops.py", line 3606, in get_operation_by_name
    return self.as_graph_element(name, allow_tensor=False, allow_operation=True)

  File "C:\Users\Phil\AppData\Local\Programs\Python\Python37\lib\site-packages\t
ensorflow\python\framework\ops.py", line 3478, in as_graph_element
    return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
  File "C:\Users\Phil\AppData\Local\Programs\Python\Python37\lib\site-packages\t
ensorflow\python\framework\ops.py", line 3538, in _as_graph_element_locked
    "graph." % repr(name))
KeyError: "The name 'import/input' refers to an Operation not in the graph."

0 个答案:

没有答案