How to detect multiple stop sign using RCNN?

1 次查看(过去 30 天)
Hi,
I've tried the code given in the documentation as below.
It work. Then I try to change the testing image with this image (attachment). But the code only detect one stop sign as the result attachment.
I've tried to comment one line in the code that display only the stongest score. But it still detect one stop sign. supposedly there are 3 stop sign that can be found in the image.
% Display strongest detection result.
[score, idx] = max(score);
How can I improve the code to make it able to detect multiple stop sign?

回答(1 个)

yanqi liu
yanqi liu 2021-11-24
yes,sir,please use
[bboxes,scores] = detect(detector,I,'Threshold',0.1);
to get more rects,and then filter by score value
  4 个评论
Syukri Yazed
Syukri Yazed 2021-11-25
I'm using RCNN, thus I'm using your first suggestion.
load('RcnnNet1.mat', 'RcnnNet')
img = imread('stopsign2_many.PNG');
[bboxes, scores, label] = detect(RcnnNet, img, 'NumStrongestRegions', inf);
[score, idx] = max(scores);
annotation = sprintf('%s: (Confidence = %f)', label(idx), scores);
detectedImg = insertObjectAnnotation(img, 'rectangle', bboxes, annotation);
figure
imshow(detectedImg)
the result is like this, (attachment 1 - result_NumStrongestRegion_inf.png). From the result it shows that all the detected regions have the same confidence level.
Then, I change 'inf' to '1000', just to make it to detect less. The result is as in the attachment (result_NumStrongestRegion_1000wB.png). From the result it shows there are three regions detected. But only 2 are correct. What I'm concern is the confidence scores are the same.
Thus, I think I need to add this line after [score, idx]
bboxes = bboxes(idx, :); % using detect(RcnnNet, img, 'NumStrongestRegions', 1000);
The result shows only one stopsign has been detected with score value = 1.
When using below (inf)
bboxes = bboxes(idx, :); % using detect(RcnnNet, img, 'NumStrongestRegions', inf);
The result shows wrong stopsign detection.
yanqi liu
yanqi liu 2021-11-26
yes,sir,it exist wrong detect result by rcnn,may be use faster rcnn or yolo to detect

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by