Threshold For confidance for score of RCNN Detector

10 views (last 30 days)
Abdussalam Elhanashi
Abdussalam Elhanashi on 8 Sep 2019
Answered: Roshni Garnayak on 11 Sep 2019
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

Answers (1)

Roshni Garnayak
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.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by