ImportError: cannot import name 'input_reader_

2019-06-03 11:56发布

问题:

working on win10 64-bit

when i trying to train my model by E:\projectx\model-master\models-master>python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.config

this error appear

File "train.py", line 49, in from object_detection.builders import dataset_builder File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\builders\dataset_builder.py", line 27, in from object_detection.data_decoders import tf_example_decoder File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\data_decoders\tf_example_decoder.py", line 27, in from object_detection.protos import input_reader_pb2 ImportError: cannot import name 'input_reader_pb2'

i do run protoc 3.4 protoc object_detection/protos/*.proto --python_out=. but the error still exist i check all thing and it is should be fine and work, it is going me mad!!

please help.... thanks

回答1:

Seems that you didnt compile protobuf. For solving it:

  1. Download the latest protoc exe here: https://github.com/google/protobuf/releases (in your case should be win32)
  2. Rename that folder to "protoc"
  3. Put that folder inside models/research
  4. in models/research via console, launch:

    protoc/bin/protoc object_detection/protos/*.proto --python_out=.
    

I dont know exactly if that command will work on windows, but you have to be sure that you are using the protoc compiler that you downloaded (v.3.6) instead of the protoc in your enviroment.