JAbrams
JAbrams

Reputation: 325

Tensorflow object detection API minimum score threshold

I'm running detection with the Tensorflow Object Detection API with the default model and I'd just like to print the detection scores to the console.

For example object_detection_tutorial.ipynb has a function called visualize_boxes_and_labels_on_image_array that draws bounding boxes on the image. This function has a parameter min_score_thresh=.5 and if you change it it draws bounding boxes for everything above that threshold.

i'm not visualizing the images though, just want to print out the score for anything > 0.2 but I can't find a way to specify this?

Currently it's only printing to the console detections with scores above .5 which i guess is the default?

Upvotes: 1

Views: 5467

Answers (3)

a10m
a10m

Reputation: 21

visualize_boxes_and_labels_on_image_array method has a parameter min_score_thresh. you can pass your threshold values as visualize_boxes_and_labels_on_image_array(min_score_thresh=.2).
Its default values is set to 0.5.

Upvotes: 2

Aman pradhan
Aman pradhan

Reputation: 268

Go to utils/visualization_utils.py and find visualize_boxes_and_labels_on_image_array() and change the default value of min_score_thresh to whatever you want. By default, the value is 0.5.

Upvotes: 0

Srinivas Bringu
Srinivas Bringu

Reputation: 452

Looks like you want to query based on scores, following is code you can use on output_dict

 for index, value in enumerate(output_dict['detection_classes'][0]):
          if(scores[index] > **0.2**):
              if((category_index.get(value)).get('name').encode('utf8') == b'person'):
                  print("Car exists at Index,value : ",index, value)
                  personExists = True[![enter image description here][1]][1]
      print("person Exists: {} ",personExists)  

Code here if formatting above is not clear:

enter image description here

Upvotes: 0

Related Questions