错误:tensorflow:无法理解架构名称''

7

我正在遵循谷歌代码实验室的指示。

当我运行以下命令时,出现了一些错误。

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

错误如下:
ERROR:tensorflow:Couldn't understand architecture name ''
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/nutron/Documents/android-codelab-projects/google-codelab-tensorflow-for-poets-2/scripts/retrain.py", line 1326, in <module>
    tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
  File "/Users/nutron/tensorflow/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "/Users/nutron/Documents/android-codelab-projects/google-codelab-tensorflow-for-poets-2/scripts/retrain.py", line 976, in main
    model_info = create_model_info(FLAGS.architecture)
  File "/Users/nutron/Documents/android-codelab-projects/google-codelab-tensorflow-for-poets-2/scripts/retrain.py", line 923, in create_model_info
    raise ValueError('Unknown architecture', architecture)
ValueError: ('Unknown architecture', '')

我做错了什么或者我应该做些什么呢?

谢谢

3个回答

14

显然,错误发生是因为ARCHITECTURE没有设置。你可能错过了文档中的“配置您的MobileNet”步骤。请运行以下命令:

IMAGE_SIZE=224
ARCHITECTURE="mobilenet_0.50_${IMAGE_SIZE}"

python -m scripts.retrain ...之前。


{btsdaf} - Watcharin.s
我有Windows系统,而不是Linux,我需要做什么? - user6600549
1
为什么我们需要使用这些标志? - Ved Sarkar
程序需要读取这些环境变量来确定使用哪个模型以及使用什么图像大小。 - Max

6

对于Windows系统:

SET IMAGE_SIZE=224<br/>
SET ARCHITECTURE="mobilenet_0.50_%IMAGE_SIZE%"

-

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

我正在使用Windows,并尝试了上述命令,但仍然收到以下错误消息:“ERROR:tensorflow:Couldn't understand architecture name '%architecture%”。你能告诉我你正在使用哪个版本的tensorflow和python吗? - Yash Jain

0
如果 Max的回答 在Linux上对你不起作用,请尝试将 "${ARCHITECTURE}" 替换为 "mobilenet_0.50_224"。
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/"mobilenet_0.50_224"
--output_graph=tf_files/retrained_graph.pb
--output_labels=tf_files/retrained_labels.txt
--architecture="mobilenet_0.50_224"
--image_dir=tf_files/flower_photos

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接