微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

tensorflow训练模型遇到的问题The name 'DecodeJpeg/contents:0' refers to a Tensor which does not exis

问题描述:

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.

I am trying to run retrain_test.py on image but not getting output instead getting error.

Traceback (most recent call last):
File "retraining-example.py", line 88, in 
run_inference_on_image()
File "retraining-example.py", line 71, 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.

 

1:这个问题困扰了我几天,原因是新版本的tensorflow删除了DecodeJpeg/contents,所以不能使用(内心PS:官网那些更新就更新,删东西干嘛,我也是无语,浪费我两天时间)

2:然后就是各种找资料 发现很多人都遇到这个问题,但是都没有解决

最后突然在github(链接如下https://github.com/tensorflow/tensorflow/issues/12250)发现有人解决了这个问题,真是开心的一B。真心感谢这位大哥,截图如下:

上图的链接如下:https://github.com/tensorflow/tensorflow/blob/c565660e008cf666c582668cb0d0937ca86e71fb/tensorflow/examples/image_retraining/retrain.py

3:然后就问题都解决了  展示一波效果

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐