Models: ImportError: cannot import name 'string_int_label_map_pb2'

Created on 27 Feb 2020  路  3Comments  路  Source: tensorflow/models

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow):
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 18.04 LTS
  • Mobile device (e.g., Pixel 4, Samsung Galaxy 10) if the issue happens on mobile device:
  • TensorFlow installed from (source or binary): pip3
  • TensorFlow version (use command below): 2.1.0
  • Python version:
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version:
  • GPU model and memory:

Describe the current behavior

Describe the expected behavior

Code to reproduce the issue
Provide a reproducible test case that is the bare minimum necessary to generate the problem. -->

Other info / logs
Traceback (most recent call last):
File "model_main.py", line 26, in
from object_detection import model_lib
File "/home/ayushman/Documents/Github/models/research/object_detection/model_lib.py", line 27, in
from object_detection import eval_util
File "/home/ayushman/Documents/Github/models/research/object_detection/eval_util.py", line 33, in
from object_detection.metrics import coco_evaluation
File "/home/ayushman/Documents/Github/models/research/object_detection/metrics/coco_evaluation.py", line 27, in
from object_detection.utils import object_detection_evaluation
File "/home/ayushman/Documents/Github/models/research/object_detection/utils/object_detection_evaluation.py", line 46, in
from object_detection.utils import label_map_util
File "/home/ayushman/Documents/Github/models/research/object_detection/utils/label_map_util.py", line 27, in
from object_detection.protos import string_int_label_map_pb2
ImportError: cannot import name 'string_int_label_map_pb2'

research bug

Most helpful comment

Hey so for anyone who runs into this issue, I believe my co-worker found a solution. After cloning the repo you can run the following commands and it seems to fix this error.

cd models/research
protoc object_detection/protos/*.proto --python_out=.

All 3 comments

Just hit this today as well

TensorFlow 2.x does not support object detection, yet. I would suggest using TensorFlow 1.14 instead.

Hey so for anyone who runs into this issue, I believe my co-worker found a solution. After cloning the repo you can run the following commands and it seems to fix this error.

cd models/research
protoc object_detection/protos/*.proto --python_out=.

Was this page helpful?
0 / 5 - 0 ratings