Threshold for evaluation the R-CNN detector

1 view (last 30 days)
Hi Guys
I would like if possible how to make this Treshold for Evaluation and validation of created R-CNN object Detector, i tried to make it in the attached scripts but it does not work, I want to make Threshold for score that like below 0.58 that score and bboxes should not be appeared
Herein the code:-
load('gTruth.mat')
smokedetection = selectLabels(gTruth,'smokealarm');
if ~isfolder(fullfile('EvaluationData'))
mkdir EvaluationData
addpath('EvaluationData');
evaluationData = objectDetectorTrainingData(gTruth,...
'SamplingFactor',1,'WriteLocation','EvaluationData');
end
imds = imageDatastore(fullfile('EvaluationData'));
numImages = height(evaluationData);
result(numImages,:) = struct('Boxes',[],'Scores',[]);
for i = 1:numImages
% Read Image
I = readimage(imds,i);
% Detect the object of interest
[bboxes, scores] = detect(detector,I,'Threshold',1);
% Store result
result(i).Boxes = bboxes;
result(i).Scores = scores;
end
% Convert structure to table
results = struct2table(result);
overlap = 0.1;
% Evaluate Metrics
[ap,recall,precision] = evaluateDetectionPrecision(results...
,evaluationData(:,2),overlap);
[am,fppi,missRate] = evaluateDetectionMissRate(results,evaluationData(:,2),overlap);
% Plot Metrics
subplot(1,2,1);
plot(recall,precision);
xlabel('Recall');
ylabel('Precision');
title(sprintf('Average Precision = %.1f', ap))
grid on
subplot(1,2,2);
loglog(fppi, missRate);
xlabel('False Positives Per Image');
ylabel('Log Average Miss Rate');
title(sprintf('Log Average Miss Rate = %.1f', am))
grid on

Accepted Answer

Harsha Priya Daggubati
Harsha Priya Daggubati on 23 Sep 2019
Hi,
One possible way to get only the scores returned by ‘detect’ greater than a value, say 0.58 is to store only the score value greater than 0.58 and its corresponding bboxes in result and use it in your evaluation metrics. You can also try using Overlap Threshold option for ‘evaluateDetectionPrecision’function as mentioned in the following documentation link.
  1 Comment
Abdussalam Elhanashi
Abdussalam Elhanashi on 23 Sep 2019
Thanks for your reply
I am looking if possible how to implement this greater than 0.58 inside the above code
Thanks

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!