Chanitda Nailoed
Chanitda Nailoed

Reputation: 31

ModuleNotFoundError: No module named 'object_detection.protos'

I followed instructions (https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html) to install the Tensorflow Object Detection API. I use Anaconda on ubuntu18.4 and all of the steps in the instructions seemed to complete OK.

When I train to train my model with the following command:

python model_main_tf2.py --model_dir=models/my_ssd_resnet50_v1_fpn --pipeline_config_path=models/my_ssd_resnet50_v1_fpn/pipeline.config

I get the following error:

Traceback (most recent call last):
  File "model_main_tf2.py", line 34, in <module>
    from object_detection import model_lib_v2
  File "/home/chanitda/Desktop/Tensorflow/workspace/training_demo/object_detection/__init__.py", line 28, in <module>
    from object_detection import eval_util
  File "/home/chanitda/Desktop/Tensorflow/workspace/training_demo/object_detection/eval_util.py", line 35, in <module>
    from object_detection.metrics import coco_evaluation
  File "/home/chanitda/Desktop/Tensorflow/workspace/training_demo/object_detection/metrics/coco_evaluation.py", line 28, in <module>
    from object_detection.utils import object_detection_evaluation
  File "/home/chanitda/Desktop/Tensorflow/workspace/training_demo/object_detection/utils/object_detection_evaluation.py", line 46, in <module>
    from object_detection.utils import label_map_util
  File "/home/chanitda/Desktop/Tensorflow/workspace/training_demo/object_detection/utils/label_map_util.py", line 30, in <module>
    from object_detection.protos import string_int_label_map_pb2
ModuleNotFoundError: No module named 'object_detection.protos'

I get the error mentioned in the headline. I would be very thankful if someone could help me with a code example to solve the problem.

Upvotes: 2

Views: 3678

Answers (1)

B200011011
B200011011

Reputation: 4248

Try this from here, https://github.com/tensorflow/models/blob/master/research/object_detection/colab_tutorials/eager_few_shot_od_training_tf2_colab.ipynb.

# Install the Object Detection API
%%bash
cd models/research/
protoc object_detection/protos/*.proto --python_out=.
cp object_detection/packages/tf2/setup.py .
python -m pip install .

Alternatively retry the install step from here,

https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/install.html#install-the-object-detection-api

Upvotes: 1

Related Questions