1

当我从文件夹或从这样的文件夹export_inference_graph.py中使用正确的路径运行时:object_detectionmodels/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,我认为这应该很容易,但它会停止我的整个工作。

提前谢谢你们

4

1 回答 1

0

好的,案件结案。

我忘了做 Protobuf 编译。

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

对不起各位,我的错

于 2018-01-11T09:11:17.263 回答