-
Notifications
You must be signed in to change notification settings - Fork 45.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
from object_detection.protos import input_reader_pb2 ImportError: cannot import name 'input_reader_pb2' #5264
Comments
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. |
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 >>models/research |
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. |
Heyy I am still not able to get rid of that error. Could you please explain how did you do it. |
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 . |
what is the variable value?? |
I have the same problem. |
hi, protoc --python_out=. .\object_detection\protos\calibration.proto |
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. ... however, it still fails with ... 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 solved this problem by running set pythonpath command one more time. |
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. (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 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 :
and after that I run the scripts:
and
After these steps the error ImportError: cannot import name 'flexible_grid_anchor_generator_pb2' was gone |
Hi, can explain more how to do it ?? |
^^This command only works on linux. On windows, you must compile each proto manually. Something like:
and so on for every .proto file in that directory. there may be a way to shorten that command, but windows won't play nice with wildcard search. Also, forget the "C:\ > set PYTHONPATH" command. Go to environment variables, create a new entry called PYTHONPATH, with the entry being the path to the relevant folders. i.e.: C:\tensorflow1\models;C:\tensorflow1\models\research;C:\tensorflow1\models\research\slim |
actually, i' have already compiled all proto files manually and tensorflow api is working right, Windows fatal exception: access violation Current thread 0x00000238 (most recent call first): after that message python stops . :/ |
That's not one I've seen before, but I would try 2 things:
|
This is absolutely correct. What I did is - and then used the following cmd for /f %i in ('dir /b object_detection\protos*.proto') do protoc object_detection\protos%i --python_out=. After that the error has gone for me. |
1- open the terminal in model/research and copy this:
|
I'm getting this error now while running the train.py. |
I have the same error. I'm pretty sure it's due to a failure during 'python setup.py install' command. I get the following error during the install.
The setup script still finishes without notifying you of the error at the end, which may leave you to believe it completely successfully. so I'm uncertain if this error is negligible or if it's the cause of fpn_pb2 not being generated. Any ideas anyone? |
Okay. I've realized that the output from that script tells us that the generated files were placed in the wrong location. Namely, in site-packages. @hasanudoy We need to figure out why the generated files are going to the wrong location. Verify your PYTHONPATH. My python path is set correctly and it didn't resolve my issue. However, setting your python path as mentioned above may solve the problem for you. |
c:\models\research\object_detection>python model_main_tf2.py --pipeline_config_path=training/ssd_efficientdet_d0_512x512_coco17_tpu-8.config --model_dir=training --alsologtostderr anaconda python 3.8.5 |
hi everyone, i have issues like this, when i train the model, does anyone have a solution for the problem I'm having? File "Tensorflow/models/research/object_detection/model_main_tf2.py", line 31, in |
when i run this command (python train.py --logtostderr --train_dir=CAPTCHA_training_result/ --pipeline_config_path=CAPTCHA_training/faster_rcnn_inception_v2_coco.config) This error appears to me: File "C:\Users\abadi\Desktop\trajectory_predictor_with_object_recognition-master\research\object_detection\train.py", line 52, in any solution please): |
i have the same error |
i too have the same error File "C:\Users\AhmedA\OpenCV\New folder\models\research\object_detection\train.py", line 51, in |
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
/slimPS: I also run the model_main.py from models/research/object_detection but the same error.
The text was updated successfully, but these errors were encountered: