【问题标题】:ImportError: cannot import name 'string_int_label_map_pb2'ImportError:无法导入名称'string_int_label_map_pb2'
【发布时间】:2018-10-05 10:47:30
【问题描述】:

我使用以下命令编译了文件。

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

并因此编译成 .py 文件。

但是,我收到以下错误代码。

~/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'

所以我检查了 utils,我已经有了一个 string_int_label_map_pb2.py

为什么不能导入 string_int_label_map_pb2.py ?

【问题讨论】:

  • 我在尝试在 ML ENGINE 中运行训练作业时遇到了同样的错误。我按照github.com/tensorflow/models/blob/master/research/… 上给出的完整说明进行操作
  • 你解决了这个问题吗?
  • 是的,它确实有效。按照完整的说明进行操作。谢谢

标签: python tensorflow imagenet


【解决方案1】:

您使用的是 conda 环境吗?

在这种情况下,指向的 protoc 文件夹位于 C:\Users\xx\anaconda3\envs\xx\Lib\site-packages\protos

你应该从 Models\reserach 复制 protoc 的内容到这个

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-03-31
    • 2014-10-10
    • 2014-09-20
    • 2014-08-28
    • 2014-06-10
    • 2016-05-16
    • 2019-05-25
    • 2017-04-22
    相关资源
    最近更新 更多