本文介绍了导入错误:无法导入名称 input_reader_pb2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using Tensorflow Object Detection API to train my object detection model. I accumulated the dataset, and am going through the this tutorial.

一切都很顺利,直到我尝试训练我的数据集.当我在终端上运行以下行时,

Everything went fine until I tried to train my dataset. When I run the following line on terminal,

python train.py --logtostderr \
   --train_dir=training/ \
--pipeline_config_path=training/ssd_mobilenet_v1_coco.config

我收到以下错误

Traceback (most recent call last):
File "legacy/train.py", line 49, in <module>
from object_detection.builders import dataset_builder
File "/usr/local/lib/python2.7/dist-packages/object_detection-0.1-
py2.7.egg/object_detection/builders/dataset_builder.py", line 27, in
<module>
from object_detection.data_decoders import tf_example_decoder
File "/usr/local/lib/python2.7/dist-packages/object_detection-0.1-
py2.7.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

我尝试搜索网站和评论,但很遗憾无法绕过,有没有人可以帮忙!

I tried searching through sites and comments, but unfortunately couldn't get around, could anyone please help out!

谢谢!

推荐答案

我找到了答案.我使用的 protoc 版本 3.0.0(protobuf 编译器)处于 beta 测试模式并且有一些错误.所以首先使用

I figured out the answer. I was using protoc version 3.0.0(protobuf compiler) which is in beta testing mode and has some bugs. So the first check for protobuf version using

proto --version

如果是 libprotoc 3.0.0,清除它并安装 2.6.1一旦完成,

if it libprotoc 3.0.0, purge it and install 2.6.1once done that,

cd models/research
protoc object_detection/ --python.out=.

现在它应该可以工作了!

now it should work!

这篇关于导入错误:无法导入名称 input_reader_pb2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 16:33
查看更多