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

时间:2017-12-28 07:27:52

标签: python tensorflow google-cloud-platform google-cloud-ml

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

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   项目\ GCP \型号\研发\ object_detection>蟒蛇   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行,in       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中       raise AttributeError(' Flag - 必须指定%s。'%flag_name)AttributeError:必须指定Flag --output_directory。

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

1 个答案:

答案 0 :(得分: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