ImportError: cannot import name 'string_int_label_map_pb2'
C:\tensorflow\models\research>python object_detection\model_main.py --pipeline_config_path=object_detection\training\ssd_mobilenet_v1_pets.config --model_dir=object_detection\images --num_train_steps=50000 --sample_1_of_n_eval_examples=1 --alsologtostderr Traceback (most recent call last): File "object_detection\model_main.py", line 26, in from object_detection import model_lib File "C:\Users\Fuat\AppData\Local\Programs\Python\Python35\lib\site-packages\object_detection\model_lib.py", line 27, in from object_detection import eval_util File "C:\Users\Fuat\AppData\Local\Programs\Python\Python35\lib\site-packages\object_detection\eval_util.py", line 27, in from object_detection.metrics import coco_evaluation File "C:\Users\Fuat\AppData\Local\Programs\Python\Python35\lib\site-packages\object_detection\metrics\coco_evaluation.py", line 22, in from object_detection.utils import object_detection_evaluation File "C:\Users\Fuat\AppData\Local\Programs\Python\Python35\lib\site-packages\object_detection\utils\object_detection_evaluation.py", line 39, in from object_detection.utils import label_map_util File "C:\Users\Fuat\AppData\Local\Programs\Python\Python35\lib\site-packages\object_detection\utils\label_map_util.py", line 21, in from object_detection.protos import string_int_label_map_pb2 ImportError: cannot import name 'string_int_label_map_pb2'
I got this error.How can i fix it.I installed protobuf, compiled it, added to path.There are no files such as 'string_int_label_map.prot'.
Top-level directory:c:/tensorflow/models OS:Windows 10 CPU:AMD A9 7th Gen. GPU:AMD Radeon R5 M420 2GB Python version:3.6 Protobuf version:3.4.0 Tensorflow installed from:pip Tensorflow Version:1.12.0 Bazel version:N/A CUDA/cuDNN version:N/A Exact command:#from tensorflow/models/research/object_detection python model_main.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_coco.config
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 do protobuf compilation as in: https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md#protobuf-compilation
@fisheess yes i tried it with all protobuf-3.x.x versions last time i did there was string_int_label_map_pb2.py file but still getting this error
Can someone help me with this problem please im stuck at this error can't move forward.
I just had this problem on a 2nd machine of mine that had a snapshot of the repository on February 14th, 2019. I looked at my 1st machine with a snapshot pulled some time around September 2nd, 2018 and the import works. So some change between these dates is causing the problem.
When I updated my 2nd machine with the protos and utils folders from my 1st machine, the error went away...
I guess i figured it out.I switched to Ubuntu OS from Windows 10 OS.Uninstalled python2.x.x then installed python 3.6 used pip3 for all libraries and executed with python3.Problem might be because of conflicts between python2 libs and python3 libs and the PYTHONPATH you setted.Be sure to install libs for the python version you used(pip for python2,pip3 for python3).Thank you for your answers.
I'am still having the same error, looking into "object_detection.protos" there is no 'string_int_label_map_pb2'. I have already compiled and run protobuf as it reefers in https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md#protobuf-compilation. It seems that the archive is missing.
I am having the same problem.
ImportError Traceback (most recent call last)
~/Tensorflow-License-Plate-Detection-master/object_detection/utils/label_map_util.py in
ImportError: cannot import name 'string_int_label_map_pb2'
Similar problem is faced by me where the above mentioned cmds are not helping
I got a very easy solution put this python file in object detection/protos folder:- https://github.com/datitran/object_detector_app/blob/master/object_detection/protos/string_int_label_map_pb2.py
It will solve your error
also you what you can do is run protoc command, it will create .py files for each .proto files. But make sure that this command run successfully and created .py files for each .proto files in the path object_detection\protos.
protoc object_detection/protos/*.proto --python_out=.'
this short command don't run on windows. so instead of *.proto in the command, mention all .proto files in it and run.
Even if it is not working depend on TF/Objection Detection API version try below: from utils import label_map_util replace above line with from object_detection.utils import label_map_util
or may be issue with this. so just replace it. from object_detection.protos import string_int_label_map_pb2 replace with from protos import string_int_label_map_pb2
Simply, go to protos dirctory in object detection folder in your pc and put this python file into the it: https://github.com/datitran/object_detector_app/blob/master/object_detection/protos/string_int_label_map_pb2.py
After putting this file now also same issue is coming . What is permanent solution??
I got a very easy solution put this python file in object detection/protos folder:- https://github.com/datitran/object_detector_app/blob/master/object_detection/protos/string_int_label_map_pb2.py
It will solve your error
this was very helpful