问题描述
我使用 tensorflow 对象检测 api 进行了自定义对象检测.我在运行 object_detection_tutorial.ipynb
时遇到了这个错误,我不知道该怎么做.谁能帮我解决这个问题?
I did custom object detection with tensorflow object detection api.I got this error when I ran the object_detection_tutorial.ipynb
and I can't understand what to do.Anyone can help me to solve this problem?
这是我得到的错误:
AttributeError Traceback (most recent call last)
<ipython-input-1-e2452dcef500> in <module>
41 tf.import_graph_def(od_graph_def, name='')
42
---> 43 category_index = label_map_util.create_category_index_from_labelmap(path_to_labels, use_display_name=True)
44
45 def run_inference_for_single_image(image, graph):
C:\Users\Tal\Desktop\models\research\object_detection\utils\label_map_util.py in create_category_index_from_labelmap(label_map_path, use_display_name)
313 {1: {'id': 1, 'name': 'dog'}, 2: {'id': 2, 'name': 'cat'}, ...}
314 """
--> 315 categories = create_categories_from_labelmap(label_map_path, use_display_name)
316 return create_category_index(categories)
317
C:\Users\Tal\Desktop\models\research\object_detection\utils\label_map_util.py in create_categories_from_labelmap(label_map_path, use_display_name)
296 max_num_classes = max(item.id for item in label_map.item)
297 return convert_label_map_to_categories(label_map, max_num_classes,
--> 298 use_display_name)
299
300
C:\Users\Tal\Desktop\models\research\object_detection\utils\label_map_util.py in convert_label_map_to_categories(label_map, max_num_classes, use_display_name)
131 list_of_ids_already_added.append(item.id)
132 category = {'id': item.id, 'name': name}
--> 133 if item.keypoints:
134 keypoints = {}
135 list_of_keypoint_ids = []
AttributeError: keypoints
推荐答案
我也遇到了同样的问题.如您所见,错误来源是 convert_label_map_to_categories()
函数.这主要是由于此功能最近发生了变化.作为(临时)解决方法,我建议您使用旧版本的此功能.例如,您可以使用从这里一>.你可以替换或创建新的这个函数到你的 C:\Users\Tal\Desktop\models\research\object_detection\utils\label_map_util.py
I also had the same issue. As you can notice that the source of error is convert_label_map_to_categories()
function. This is mainly due to the recent changes with this function. As a (temporary) work around, I would suggest you to use this function from an older version. For instance, you can use from here. You can replace or create new this function to your C:\Users\Tal\Desktop\models\research\object_detection\utils\label_map_util.py
这篇关于AttributeError: 关键点 - 使用 tensorflow 1.14 的对象检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!