Import Error: Cannot Import name 'input_reader_pb2'

Import Error: Cannot Import name 'input_reader_pb2'

我正在使用 Tensorflow 对象检测 API 来训练我的对象检测模型。我积累了数据集,正在浏览

Training Custom Object Detector - Tensorflow Object Detection API Tutorial

一切顺利,直到我尝试训练我的数据集。当我 运行 在终端上显示以下行时:

python3 train.py --logtostderr --train_dir=training/ 
                 --pipeline_config_path=training/ssd_mobilenet_v1_pets.config

我收到以下错误:

Traceback (most recent call last):
  File "train.py", line 49, in <module>
    from object_detection.builders import dataset_builder
  File "C:\Program Files\Python36\lib\site-packages\slim-0.1-py3.6.egg\object_detection\builders\dataset_builder.py", line 27, in <module>
    from object_detection.data_decoders import tf_example_decoder
  File "C:\Program Files\Python36\lib\site-packages\slim-0.1-py3.6.egg\object_detection\data_decoders\tf_example_decoder.py", line 24, in <module>
    from object_detection.protos import input_reader_pb2
ImportError: cannot import name 'input_reader_pb2'

我尝试搜索网站和评论,但不幸的是仍然无法解决。

您安装的 tensorflow 对象检测 api 未完成。你错过了 protobuf 编译的步骤 see here. If you look into folder protos under object_detection specifically, there is no file named 'input_reader_pb2', but if you completed the protobuf compilation step, the file will be generated automatically! If your installtion is successful, it should pass the test program test.