繁体   English   中英

ModuleNotFoundError:没有名为“object_detection.protos”的模块

[英]ModuleNotFoundError: No module named 'object_detection.protos'

我按照说明( https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html )安装了 Tensorflow 对象检测 API。 我在 ubuntu18.4 上使用 Anaconda,说明中的所有步骤似乎都可以正常完成。

当我使用以下命令训练我的模型时:

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

我收到以下错误:

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'

我收到标题中提到的错误。 如果有人可以帮助我提供代码示例来解决问题,我将非常感激。

从这里试试这个, 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 .

或者从这里重试安装步骤,

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM