7

I compiled the files with the following command.

protoc object_detection/protos/*.proto --python_out=.

and as a result compiled into .py files.

However, I received the following error code.

~/Documents/imgmlreport/inception/classification_inception/models/research/object_detection/utils/label_map_util.py in ()

 20 import tensorflow as tf
 21 from google.protobuf import text_format
---> 22 from object_detection.protos import string_int_label_map_pb2
 23 
 24 

ImportError: cannot import name 'string_int_label_map_pb2'

so i checked utils and i already had a string_int_label_map_pb2.py

why can't import string_int_label_map_pb2.py ?

송준석
  • 991
  • 1
  • 16
  • 32

2 Answers2

2

Are you using a conda environment?

In that case the protoc folder that is pointing is in C:\Users\xx\anaconda3\envs\xx\Lib\site-packages\protos

You should copy the content of protoc from Models\reserach into this one

isaac0
  • 23
  • 4
0

The solution that works for me is as follows:

If you are creating a Virtual environment:

Run the command after you create the environment to change the Google file .protp to .py:

protoc object_detection/protos/*.proto --python_out=.

However, if you are still facing an error, you can simply run the code on a google colab notebook:

Protos Conversion to Python %%cd /content/drive/MyDrive/TFOD1.x/models/research

!protoc object_detection/protos/*.proto --python_out=.

get the file in protoc folder, then copy it into the >models>research>protoc And (import step): Copy the folder to your environment path:

For example:

C:\Users\x04xx18\Anaconda3\envs\tfod1.x\libs\protos

This should fix the error for you!