在Object Detection API中运行export_inference_graph.py时出错

时间:2018-01-11 08:50:26

标签: python tensorflow object-detection-api

当我使用export_inference_graph.py文件夹或object_detection文件夹中的正确路径运行models/research时,这样:

python export_inference_graph \    # object_detection/ (if from /research)
    --input_type image_tensor \
    --pipeline_config_path path/to/ssd_inception_v2.config \
    --trained_checkpoint_prefix path/to/model.ckpt \
    --output_directory path/to/exported_model_directory

然后我得到了以下错误:

  File "object_detection/export_inference_graph.py", line 71, in <module>
    from object_detection import exporter
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/models/research/object_detection/exporter.py", line 28, in <module>
    from object_detection.builders import model_builder
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/models/research/object_detection/builders/model_builder.py", line 17, in <module>
    from object_detection.builders import anchor_generator_builder
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/models/research/object_detection/builders/anchor_generator_builder.py", line 20, in <module>
    from object_detection.protos import anchor_generator_pb2
ImportError: cannot import name anchor_generator_pb2

anchor_generator_builder.py内,它会尝试导入anchor_generator_pb2,但不存在具有此名称的文件。

其他信息: - 是的我添加了库:

 # From tensorflow/models/research/
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim

- 是的,我提取了最新的tensorflow/models版本

请告诉我如何正确导出新的Frozen Graph,我认为这应该很简单,但它会阻止我的整个工作。

提前谢谢你们

1 个答案:

答案 0 :(得分:0)

好的,案件结案。

我忘了做Protobuf编译。

# From tensorflow/models/research/
protoc object_detection/protos/*.proto --python_out=.

对不起伙计们,我的不好