Threshold For confidence score

2 visualizzazioni (ultimi 30 giorni)
Abdussalam Elhanashi
Abdussalam Elhanashi il 8 Ott 2019
Hi Guys
I would like if possible how to make this Threshold 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 in results
i tried the below code but i got the error
Herein the code:-
load('gTruth.mat')
smokedetection = selectLabels(gTruth,'alarm');
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,'MiniBatchSize', 32);
% Store result
result(i).Boxes = bboxes;
T = 0.58; % Define threshold here
idx = scores >= T;
result(i).Scores = scores(idx);
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);
% and herein the error i got
Error using vision.internal.detector.evaluationInputValidation>checkDetectionResultsTable (line 66)
Invalid score value in row 1 of the detection results table: Expected input to be an array with number of
elements equal to 8.
Error in vision.internal.detector.evaluationInputValidation (line 6)
checkDetectionResultsTable(detectionResults, groundTruth, mfilename);
Error in evaluateDetectionPrecision (line 94)
vision.internal.detector.evaluationInputValidation(detectionResults, ...
Error in Evaluationthedetector (line 33)
[ap,recall,precision] = evaluateDetectionPrecision(results...
% Looking for your assistance

Risposte (1)

Harsha Priya Daggubati
Harsha Priya Daggubati il 11 Ott 2019
Hi,
I suspect the issue is due to the threshold you are using, try storing the bounding boxes in results based on the threshold.
T = 0.58; % Define threshold here
idx = scores >= T;
result(i).Boxes = bboxes(idx);
result(i).Scores = scores(idx);
Hope this helps!

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by