如果可能的话,我想如何对创建的R-CNN对象检测器进行评估和验证阈值,我试图在附加的脚本中使它达到阈值,但它不起作用,我想为得分打下阈值,如下所示0.58分数和bbox不应出现在结果中
我尝试了以下代码,但出现错误
在此输入代码:-
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);
%,这里是我得到的错误
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...