Search code examples
pythontensorflowprotocol-buffers

cannot import name 'string_int_label_map_pb2'


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

Solution

  • 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