导入错误:无法导入名称“ input_reader_pb2”

时间:2019-01-22 05:04:15

标签: python object-detection training-data

我正在使用 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'

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

1 个答案:

答案 0 :(得分:2)

您的Tensorflow对象检测API的安装未完成。您错过了protobuf编译see here的步骤。如果您专门在object_detection下查看protos文件夹,则没有名为“ input_reader_pb2”的文件,但是如果您完成了protobuf编译步骤,该文件将自动生成!如果安装成功,则应通过测试程序test