Counting objects in a "busy" image?
Afficher commentaires plus anciens
I am trying to write a MATLAB script to count the number of bottles visible in a still image. They have a consistent size, shape, and colour; but variable orientation, and are in amongst other objects (occasionally overlapping).
I have attempted to train a Fast-RCNN detector and count the number of detections above a certain threshold, but the results have been inaccurate due to false positives, and due to individual bottles being detected by multiple bounding boxes.
Is there a different approach which is more appropriate, or a change to my current method which would work better? (Ideally one which would be able to be repurposed for a different object)
load('bottles\detector.mat')
inputs = dir('bottles\inputs');
threshold = 0.9;
outputs = zeros(length(inputs),1);
for i = 3:length(inputs)
img = imread(['bottles\inputs\',inputs(i).name]);
[boxes,score,labels] = detect(detector,img,'NumStrongestRegions',Inf,'SelectStrongest',true);
score(score<threshold) = [];
numBottles = length(score);
imwrite(img,['bottles\outputs\',num2str(numBottles),'_',num2str(i),'.png']);
end
Réponses (0)
Catégories
En savoir plus sur Image Category Classification dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!