Tensorflow for Poets-运行重新训练脚本时出错(Windows 10)

时间:2019-01-10 18:03:24

标签: tensorflow

在完成所有安装说明后,我目前正在尝试为诗人使用代码实验室Tensorflow,但出现此错误:

ERROR:tensorflow:Image directory '' not found.
Traceback (most recent call last):
  File "C:\Users\USER\AppData\Local\Programs\Python\Python36\Lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
  File "C:\Users\USER\AppData\Local\Programs\Python\Python36\Lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
  File "C:\Users\USER\Desktop\Mike\Tutorials\Beginner\tensorflow-for-poets-2\scripts\retrain.py", line 1326, in <module>
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
  File "C:\Users\USER\venv\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
  File "C:\Users\USER\Desktop\Mike\Tutorials\Beginner\tensorflow-for-poets-2\scripts\retrain.py", line 989, in main
class_count = len(image_lists.keys())
AttributeError: 'NoneType' object has no attribute 'keys'

然后我得到所有的“未被识别为内部或外部命令”错误:

(venv) C:\Users\USER\Desktop\Mike\Tutorials\Beginner\tensorflow-for-poets-2>  --bottleneck_dir=tf_files/bottlenecks \
'--bottleneck_dir' is not recognized as an internal or external command, operable program or batch file.

(venv) C:\Users\USER\Desktop\Mike\Tutorials\Beginner\tensorflow-for-poets-2>  --how_many_training_steps=500 \
'--how_many_training_steps' is not recognized as an internal or external command, operable program or batch file.

(venv) C:\Users\USER\Desktop\Mike\Tutorials\Beginner\tensorflow-for-poets-2>  --model_dir=tf_files/models/ \
'--model_dir' is not recognized as an internal or external command, operable program or batch file.

(venv) C:\Users\USER\Desktop\Mike\Tutorials\Beginner\tensorflow-for-poets-2>  --summaries_dir=tf_files/training_summaries/"${ARCHITECTURE}" \
'--summaries_dir' is not recognized as an internal or external command, operable program or batch file.

(venv) C:\Users\USER\Desktop\Mike\Tutorials\Beginner\tensorflow-for-poets-2>  --output_graph=tf_files/retrained_graph.pb \
'--output_graph' is not recognized as an internal or external command, operable program or batch file.

(venv) C:\Users\USER\Desktop\Mike\Tutorials\Beginner\tensorflow- for-poets-2>  --output_labels=tf_files/retrained_labels.txt \
'--output_labels' is not recognized as an internal or external command, operable program or batch file.

(venv) C:\Users\USER\Desktop\Mike\Tutorials\Beginner\tensorflow-for-poets-2>  --architecture="${ARCHITECTURE}" \
'--architecture' is not recognized as an internal or external command, operable program or batch file.

(venv) C:\Users\USER\Desktop\Mike\Tutorials\Beginner\tensorflow-for-poets-2>  --image_dir=tf_files/flower_photos

运行此脚本时:

python -m scripts.retrain \
  --bottleneck_dir=tf_files/bottlenecks \
  --model_dir=tf_files/models/"${ARCHITECTURE}" \
  --summaries_dir=tf_files/training_summaries/"${ARCHITECTURE}" \
  --output_graph=tf_files/retrained_graph.pb \
  --output_labels=tf_files/retrained_labels.txt \
  --architecture="${ARCHITECTURE}" \
  --image_dir=tf_files/flower_photos

Here是代码实验室的参考。

这是我的图像文件夹的路径,如果需要的话。 Images route

1 个答案:

答案 0 :(得分:0)

很明显,我的shell不能识别“ \”作为添加新行的方式。

此外,在Windows中而不是使用

"${ARCHITECTURE}"

我用过

"%ARCHITECTURE%"

同时包含SET部分和脚本。最后,我的脚本看起来像这样:

python -m scripts.retrain --bottleneck_dir=tf_files/bottlenecks --how_many_training_steps=500 --model_dir=tf_files/models/ --summaries_dir=tf_files/training_summaries/"%ARCHITECTURE%" --output_graph=tf_files/retrained_graph.pb --output_labels=tf_files/retrained_labels.txt --architecture="%ARCHITECTURE%" --image_dir=tf_files/flower_photos