AttributeError: keypoints - object detection using tensorflow 1.14

Viewed 1266

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?

This is the error I got:

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
2 Answers

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

you can define "convert_label_map_to_categories()" just above to line 43 will resolve this issue.

get the method from here

Related