from object_detection.protos import input_reader_pb2 ImportError: cannot import name 'input_reader_pb2'
Hey. I'm trying to run train.py from models/research/object_detection/legacy but it's throwing this error
from object_detection.protos import input_reader_pb2
ImportError: cannot import name 'input_reader_pb2'
I did the following as well but no luck
From tensorflow/models/research/ protoc object_detection/protos/*.proto --python_out=.
From tensorflow/models/research/
export PYTHONPATH=$PYTHONPATH:pwd:pwd/slim
PS: I also run the model_main.py from models/research/object_detection but the same error.
Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks. What is the top-level directory of the model you are using Have I written custom code OS Platform and Distribution TensorFlow installed from TensorFlow version Bazel version CUDA/cuDNN version GPU model and memory Exact command to reproduce
Did you follow the setup instructions (specifically the part about compiling the protos)?
Also next time, please fill out the form!
@k-w-w yeah I did follow but still this problem.
I've tagged this as a possible bug, can you fill out this form? What is the top-level directory of the model you are using Have I written custom code OS Platform and Distribution TensorFlow installed from TensorFlow version Bazel version CUDA/cuDNN version GPU model and memory Exact command to reproduce
What is the top-level directory of the model you are using >>models/research Have I written custom code >> No OS Platform and Distribution >> Mac OS Sierra TensorFlow installed from >> pip3 installation TensorFlow version >> 1.10.1 Bazel version >> N/A CUDA/cuDNN version >> CUDA 9 GPU model and memory >> N/A Exact command to reproduce >> python3 model_main.py --logtostderr --train_dir=training/ --pipelie_config_path=training/ssd_mobilenet_v1_pets.config
Finally I solved the problem. In my case, it was not accessing the files from local models/research directory. I figured out that it is picking all files from site-packages/object_detection-0.1-py3.6.egg, which is a bit strange for me.
hammadullah125 how did you solve it? In my case as well, the files are being accessed from the site-packages/object_detection-0.1-py3.6.egg location.
inside the "object_detection-0.1-py3.6.egg" directory is the "object_detection" folder. Change your directory in cmd line to that directory. "models/research/object_detection" and the "object_detection-0.1-py3.6.egg/object_detection" is the same.
inside the "object_detection-0.1-py3.6.egg" directory is the "object_detection" folder. Change your directory in cmd line to that directory. "models/research/object_detection" and the "object_detection-0.1-py3.6.egg/object_detection" is the same.
Heyy I am still not able to get rid of that error. Could you please explain how did you do it. Thanks
I got the same problem but I solved it. I have the pb2.py file in the folder but I can't import that. I got this problem because I didn't create PYTHONPATH variable first. So if you create that, you can solve this problem. I guss if you didn't create this, you will get into the default env, which means you get into the folder py3.6.egg
if you are linux user just replace the backward splash '' to forward splash '/' during run protoc .
I got the same problem but I solved it. I have the pb2.py file in the folder but I can't import that. I got this problem because I didn't create PYTHONPATH variable first. So if you create that, you can solve this problem. I guss if you didn't create this, you will get into the default env, which means you get into the folder py3.6.egg
what is the variable value??
I have the same problem.
hi, check this one, run the below command from research path you can do manually
protoc --python_out=. .\object_detection\protos\calibration.proto protoc --python_out=. .\object_detection\protos\object_detection.protos and verify below video https://youtu.be/nZUxoHPFf4
I used this command to solve the issue where the files are sourced from "site-packages/object_detection-0.1-py3.6.egg" rather than the local tensorflow directory.
...
set PYTHONPATH=C:\tensorflow1\models;C:\tensorflow1\models\research;C:\tensorflow1\models\research
slim
...
however, it still fails with
... ImportError: cannot import name 'flexible_grid_anchor_generator_pb2' from 'object_detection.protos' ...
after a lengthy traceback.
I am stucked at this error, can anybody help me to solve this error.
ImportError: cannot import name 'flexible_grid_anchor_generator_pb2'
I am stucked at this error, can anybody help me to solve this error.
ImportError: cannot import name 'flexible_grid_anchor_generator_pb2'
i solved this problem by running set pythonpath command one more time.
does any one of you arrived to fix the issue?
does any one of you arrived to fix the issue?
It occurred due to error occurred in pythonpath. Try to reset your PythonPath one more time. Most Probably it occurred due to incorrect PythonPath command. correct command example:
(tensorflow1) C:\> set PYTHONPATH=C:\tensorflow1\models;C:\tensorflow1\models\research;C:\tensorflow1\models\research\slim
(Note: Every time the "tensorflow1" virtual environment is exited, the PYTHONPATH variable is reset and needs to be set up again.)
I am stucked at this error, can anybody help me to solve this error.
ImportError: cannot import name 'flexible_grid_anchor_generator_pb2'
I had the same issue. My problem was that I forgot to compile the proto file flexible_grid_anchor_generator.proto .
I compiled the file (from the folder models/research) with :
(tensorflow1) C:\tensorflow1\models\research>protoc --python_out=. .\object_detection\protos\flexible_grid_anchor_generator.proto
and after that I run the scripts:
(tensorflow1) C:\tensorflow1\models\research>python setup.py build
and
(tensorflow1) C:\tensorflow1\models\research>python setup.py install
After these steps the error ImportError: cannot import name 'flexible_grid_anchor_generator_pb2' was gone