TensorFlow Object Detection API print objects found on image to console

前端 未结 6 1763
星月不相逢
星月不相逢 2021-02-01 06:31

I\'m trying to return list of objects that have been found at image with TF Object Detection API.

To do that I\'m using print([category_index.get(i) for

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-01 06:45

    // this will load the labels and categories along with category index
    
    label_map = label_map_util.load_labelmap(PATH_TO_LABELS)
    
    categories = label_map_util.convert_label_map_to_categories(label_map, max_num_classes=NUM_CLASSES, use_display_name=True)
    
    category_index = label_map_util.create_category_index(categories)
    
    
    //to print the identified object do the following :
    

    print category instead of category index. The index holds the numeric value and the category contains the name of the objects. Once identified with the mentioned threshold the

    min_score_thresh = 0.5
    
    print([category.get(1)] for i in classes[0] if scores[0, i] > min_score_thresh)
    

    this will print the identified category.

提交回复
热议问题