无法导入名称“string_int_label_map_pb2”

Sai*_*das 3 python protocol-buffers tensorflow

我的目标是运行 tensorflow 对象检测 API 并遵循安装中的步骤。

我安装了 tensorflow 对象检测 API 和 protobuf。我还添加了 protobuf 的路径。但是出现以下错误:

ImportError: cannot import name 'string_int_label_map_pb2'
Run Code Online (Sandbox Code Playgroud)

安装的protobuf:

%%bash
cd models/research
protoc object_detection/protos/*.proto --python_out=.
Run Code Online (Sandbox Code Playgroud)

包含错误导入语句的代码块:

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
Run Code Online (Sandbox Code Playgroud)

Moh*_*del 8

https://github.com/google/protobuf/releases安装 protoc-3.11.4

protoc object_detection/protos/*.proto --python_out=.按照安装说明中的说明运行。并将文件放入对象检测/protos

  • @SaiKrishnadas如果这不起作用,则将[this](https://github.com/datitran/object_detector_app/blob/master/object_detection/protos/string_int_label_map_pb2.py)文件放入对象检测/protos中 (2认同)