Threshold For confidance for score of RCNN Detector
2 views (last 30 days)
Show older comments
Hi Guys
Just asking i want to know if it is possible to make threshold on confidance score on bounding box that means cetain value of confidance score below 0,50, the bounding box should not appear on image or
regards
0 Comments
Answers (1)
Roshni Garnayak
on 11 Sep 2019
Yes, it is possible to display only those bounding boxes which are above a certain threshold score. Refer to the following example of R-CNN Stop Sign Detector:
The following statement computes the bounding boxes along with their corresponding scores:
[bbox, score, label] = detect(rcnn, img, 'MiniBatchSize', 32);
“bboxes” is an M-by-4 array where each row of “bboxes” contains a four-element vector, [x,y,width,height], that specifies the upper–left corner and size of a bounding box in pixels. To draw the actual bounding boxes you need to call the “bbox” function.
You can refer to the following piece of code from the example to set a threshold for the scores:
[score, idx] = max(score);
bbox = bbox(idx, :);
annotation = sprintf('%s: (Confidence = %f)', label(idx), score);
detectedImg = insertObjectAnnotation(img, 'rectangle', bbox, annotation);
Instead of using “max” function, you can create your logic to collect the indexes of only the bounding boxes above a certain threshold score and then pass those indexes as argument to “bbox” function.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!