【问题标题】:The name 'DecodeJpeg/contents:0' refers to a Tensor which does not exist名称“DecodeJpeg/contents:0”指的是不存在的张量
【发布时间】:2018-01-21 11:04:07
【问题描述】:

训练初始模型后。在推理时我收到了这个错误。(我正在使用https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/image_retraining)

TypeError:无法将 feed_dict 键解释为张量:名称 'DecodeJpeg/contents:0' 指的是不存在的张量。这 图中不存在“DecodeJpeg/contents”操作。

omer@omer-HP-EliteBook-8540w:~/Downloads/tensorflow-
master/tensorflow/examples/image_retraining$ python label_image.py --graph=/tmp/output_graph.pb --labels=/tmp/output_labels.txt --image=/home/omer/Downloads/tensorflow-master/tensorflow/examples/image_retraining/pwd/glass/glass52.jpg --output_layer=final_result


2017-08-13 17:10:05.642446: W 
tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow 
library wasn't compiled to use SSE4.1 instructions, but these are 
available on your machine and could speed up CPU computations.
2017-08-13 17:10:05.642507: W 
tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow 
library wasn't compiled to use SSE4.2 instructions, but these are 
available on your machine and could speed up CPU computations.

Traceback (most recent call last):
  File "retraining-example.py", line 86, in <module>
run_inference_on_image()
  File "retraining-example.py", line 69, in run_inference_on_image
{'DecodeJpeg/contents:0': image_data})
  File "/home/omer/installed/acaconda2/lib/python2.7/site-
packages/tensorflow/python/client/session.py", line 778, in run
run_metadata_ptr)
File "/home/omer/installed/acaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 933, in _run
+ e.args[0])

TypeError: Cannot interpret feed_dict key as Tensor: The name 
'DecodeJpeg/contents:0' refers to a Tensor which does not exist. The 
operation, 'DecodeJpeg/contents', does not exist in the graph.

请帮忙,我是这个主题的新手

【问题讨论】:

  • 你是使用原生 pip 还是 Anaconda 来安装 TensorFlow?
  • 我正在使用 anaconda
  • 你使用的是 Python 3.6 的 4.4 版吗?
  • 使用 python 2.7 和 conda 4.3.22

标签: python machine-learning tensorflow computer-vision


【解决方案1】:

Google 在image_retraining 中更新了他们的retrain.py。他们删除了op:DecodeJpeg,所以你无法得到它。

【讨论】:

    猜你喜欢
    • 2019-03-18
    • 1970-01-01
    • 2018-05-03
    • 1970-01-01
    • 1970-01-01
    • 2018-12-27
    • 1970-01-01
    • 1970-01-01
    • 2018-02-16
    相关资源
    最近更新 更多