Return coordinates that passes threshold value for bounding boxes Google's Object Detection API

后端 未结 1 703
野性不改
野性不改 2021-01-25 02:06

Does anyone know how to get bounding box coordinates which only passes threshold value?

I found this answer (here\'s a link), so I tried using it and done the following

相关标签:
1条回答
  • 2021-01-25 02:09

    Update: The boxes and scores returned by previous functions are both numpy array objects, therefore you can use boolean indexing to filter out boxes below the threshold.

    This should give you the box that passes the threshold.

    true_boxes = boxes[0][scores[0] > min_score_thresh]
    

    And then you can do

    for i in range(true_boxes.shape[0]):
        ymin = true_boxes[i,0]*height
        xmin = true_boxes[i,1]*width
        ymax = true_boxes[i,2]*height
        xmax = true_boxes[i,3]*width
        print ("Top left")
        print (xmin,ymin,)
        print ("Bottom right")
        print (xmax,ymax)
    
    0 讨论(0)
提交回复
热议问题