运行export_inference_graph.py会引发属性错误

问题描述 投票:0回答:1

因此,在云培训后,我尝试使用以下链接导出推理图:

https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/exporting_models.md

我使用的代码是:

python export_inference_graph.py \--input_type image_tensor \--pipeline_config_path samples/configs/ssd_mobilenet_v1_pets \--trained_checkpoint_prefix training\model.ckpt-29809 \--output_directory crop_graph1

它抛出一个错误:

C:\ Users \ kannan \ Desktop \ Deep Learning Projects \ GCP \ models \ research \ object_detection> python export_inference_graph.py --input_type image_tensor --pipeline_config_path samples / configs / ssd_mobilenet_v1_pets --trained_checkpoint_prefix training \ model.ckpt-29809 --output_directory crop_graph1 Traceback(最近一次调用最后一次): 文件“export_inference_graph.py”,第119行,在tf.app.run()文件“C:\ Users \ kannan \ AppData \ Local \ Programs \ Python \ Python35 \ lib \ site-packages \ tensorflow \ python \ platform \ app” .py“,第41行,在运行flags_passthrough = f._parse_flags(args = args)文件”C:\ Users \ kannan \ AppData \ Local \ Programs \ Python \ Python35 \ lib \ site-packages \ tensorflow \ python \ platform \ flags.py“,第45行,在_parse_flags中self._assert_all_required()文件”C:\ Users \ kannan \ AppData \ Local \ Programs \ Python \ Python35 \ lib \ site-packages \ tensorflow \ python \ platform \ flags.py“ ,第78行,在_assert_all_required中self._assert_required(flag_name)文件“C:\ Users \ kannan \ AppData \ Local \ Programs \ Python \ Python35 \ lib \ site-packages \ tensorflow \ python \ platform \ flags.py”,第74行,在_assert_required中引发AttributeError('Flag - 必须指定%s。'%flag_name)AttributeError:必须指定Flag --output_directory。

知道怎么解决这个问题吗?

python tensorflow google-cloud-platform google-cloud-ml
1个回答
1
投票

我认为这个问题来自下线

\--trained_checkpoint_prefix training\model.ckpt-29809 \--output_directory crop_graph1

这个training\model.ckpt-29809应该有双引号

"training\model.ckpt-29809"

我假设python在ckpt和29809之间处理额外的“ - ”或者可能删除反斜杠,因为它意味着连续命令。

该命令应该在一行中没有“\”

python export_inference_graph.py --input_type image_tensor --pipeline_config_path samples/configs/ssd_mobilenet_v1_pets --trained_checkpoint_prefix "training\model.ckpt-29809" --output_directory crop_graph1
© www.soinside.com 2019 - 2024. All rights reserved.