tensorflow——调试Image_retrain出现问题一

下载flower图片后,直接运行python tensorflow/examples/image_retraining/retrain.py出现错误:

Looking for images in ‘flower’
Traceback (most recent call last):
File “retrain.py”, line 1138, in
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py”, line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File “retrain.py”, line 832, in main
FLAGS.validation_percentage)
File “retrain.py”, line 152, in create_image_lists
file_list.extend(gfile.Glob(file_glob))
File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/lib/io/file_io.py”, line 334, in get_matching_files
compat.as_bytes(single_filename), status)
File “/usr/lib/python2.7/contextlib.py”, line 24, in exit
self.gen.next()
File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/errors_impl.py”, line 466, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.NotFoundError: flower

待解决

解决:后来发现,直接运行retrain.py会出现这这种问题,猜测是因为单单启动retrain.py会漏掉什么东西,后来运行
bazel-bin/tensorflow/examples/image_retraining/retrain –image_dir ~/flower_photos
训练成功。

果然是漏掉了什么东西。
运行python retrain.py –image_dir ~/flower_photos
运行成功

你可能感兴趣的:(tensorflow——调试Image_retrain出现问题一)