【发布时间】:2017-07-25 21:20:40
【问题描述】:
我按照他们的 Github 上描述的步骤安装了Object Detection API,然后我运行了这个脚本:
python object_detection/builders/model_builder_test.py
并且测试成功了,所以我认为一切都设置正确。接下来我尝试使用 qtconsole 运行 Jupyter Notebook 来检测测试图像中的对象。但是它返回此错误:
AttributeError Traceback (most recent call last)
<ipython-input-3-be6fe1ba8733> in <module>()
----> 1 from utils import label_map_util
2
3 from utils import visualization_utils as vis_util
4
~\Desktop\Objectdetection\models-master\object_detection\utils\label_map_util.py in <module>()
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
~\Desktop\Objectdetection\models-master\object_detection\object_detection.py in <module>()
114
115
--> 116 label_map = label_map_util.load_labelmap(PATH_TO_LABELS)
117 categories = label_map_util.convert_label_map_to_categories(label_map, max_num_classes=NUM_CLASSES, use_display_name=True)
118 category_index = label_map_util.create_category_index(categories)
AttributeError: module 'utils.label_map_util' has no attribute 'load_labelmap'
有人知道这个问题的原因是什么吗?
谢谢。
【问题讨论】:
-
该回溯描述了“
ipython-input-3”,但您显示了python的命令行调用。你能显示你通过命令行调用得到的错误吗?如果你不能重现它,那么它几乎肯定与问题有关。 IIRCipython不适合 virtualenv(除非你在你的 virtualenv 中构建/安装它?) -
所以我将 Jupyter Notebook object_detection_tutorial.ipynb 转换为 python 脚本,并从命令行使用 ipython 调用它。我仍然遇到同样的错误。
-
commit that added this feature is relatively new。你确定你有一个兼容的版本吗?
-
我在 3 天前下载了存储库,在您链接提交之后很长一段时间。无论如何,我只是再次克隆它并运行 Jupyter notebook,它现在似乎可以工作了!不知道到底是什么问题,但谢谢!
标签: machine-learning tensorflow