cannot import name 'string_int_label_map_pb2'
11,151
Solution 1
Install protoc-3.11.4 from https://github.com/google/protobuf/releases
and run protoc object_detection/protos/*.proto --python_out=.
as mentioned in the installation instructions. And put this file in in object detection/protos
Solution 2
You can try this suggestion in the same order
see models/issues/1962# Or
git clone https://github.com/tensorflow/models.git
cd models/research
protoc -I=./ --python_out=./ ./object_detection/protos/*.proto
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
import sys
sys.path.append('/content/models/research/object_detection') # ~/tensorflow/models/research/object_detection
#try import now..
from utils import label_map_util
Related videos on Youtube
Author by
Sai Krishnadas
Updated on June 04, 2022Comments
-
Sai Krishnadas almost 2 years
My goal is to run tensorflow object detection API and followed the steps in the installation.
I install the tensorflow object detection API and protobuf. I have also added the path to protobuf. But the following error shoots up:
ImportError: cannot import name 'string_int_label_map_pb2'
Installed protobuf :
%%bash cd models/research protoc object_detection/protos/*.proto --python_out=.
A block of code containing the error import statements:
from object_detection.utils import ops as utils_ops from object_detection.utils import label_map_util from object_detection.utils import visualization_utils as vis_util
-
Sai Krishnadas about 4 yearsI run those cmds. But still the same error pop up and i use 3.6.1 version
-
Mohit Chandel about 4 years@SaiKrishnadas if this is not working then put this file in in object detection/protos
-
Mohit Chandel about 4 years@SaiKrishnadas Replace and try
-
Mohit Chandel about 4 years@SaiKrishnadas last thing I can advise is to follow this tutorial and make sure protoc-3.11.4 is installed in your Coumputer
-
Catalina Chircu over 3 yearsWarning: The second link you provide in your post is no longer available, you should update it.