C:tensorflowmodelsresearch>python object_detectionmodel_main.py --pipeline_config_path=object_detectiontrainingssd_mobilenet_v1_pets.config --model_dir=object_detectionimages --num_train_steps=50000 --sample_1_of_n_eval_examples=1 --alsologtostderr
Traceback (most recent call last):
File "object_detectionmodel_main.py", line 26, in
from object_detection import model_lib
File "C:UsersFuatAppDataLocalProgramsPythonPython35libsite-packagesobject_detectionmodel_lib.py", line 27, in
from object_detection import eval_util
File "C:UsersFuatAppDataLocalProgramsPythonPython35libsite-packagesobject_detectioneval_util.py", line 27, in
from object_detection.metrics import coco_evaluation
File "C:UsersFuatAppDataLocalProgramsPythonPython35libsite-packagesobject_detectionmetricscoco_evaluation.py", line 22, in
from object_detection.utils import object_detection_evaluation
File "C:UsersFuatAppDataLocalProgramsPythonPython35libsite-packagesobject_detectionutilsobject_detection_evaluation.py", line 39, in
from object_detection.utils import label_map_util
File "C:UsersFuatAppDataLocalProgramsPythonPython35libsite-packagesobject_detectionutilslabel_map_util.py", line 21, in
from object_detection.protos import 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)
2 sys.path.append("/Users/jivira/Tensorflow-License-Plate-Detection-master/object_detection")
3
----> 4 from utils import label_map_util
5 from utils import visualization_utils as vis_util
6
~/Tensorflow-License-Plate-Detection-master/object_detection/utils/label_map_util.py in
24 import tensorflow as tf
25 from google.protobuf import text_format
---> 26 from object_detection.protos import string_int_label_map_pb2
27
28
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_detectionprotos.
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
Most helpful comment
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