Threshold for evaluation code R-CNN

1 次查看(过去 30 天)
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
Herein the code:-
load('gTruth.mat')
output = selectLabels(gTruth,'signal');
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;
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)

采纳的回答

Image Analyst
Image Analyst 2019-9-28
To filter a table you can do something like this
goodRows = [results.Scores] > 0.58;
resutls = results(goodRows, :);
  1 个评论
Abdussalam Elhanashi
thanks for your answer
kindly if you can where i put your answer in exactlly in my code

请先登录,再进行评论。

更多回答(2 个)

Abdussalam Elhanashi
hi
i got this error
Undefined operator '>' for input arguments of type 'cell'.
Error in Evaluationthedetector (line 29)
goodRows = [results.Scores] > 0.66;
  1 个评论
Image Analyst
Image Analyst 2019-9-29
Here is an example.
LastName = {'Sanchez';'Johnson';'Li';'Diaz';'Brown'};
Age = [38;43;38;40;49];
Smoker = logical([1;0;1;0;1]);
Height = [71;69;64;67;64];
Weight = [176;163;131;133;119];
BloodPressure = [124 93; 109 77; 125 83; 117 75; 122 80];
results = table(LastName,Age,Smoker,Height,Weight,BloodPressure)
goodRows = [results.Height] > 65
results = results(goodRows, :)
You'll see
results =
5×6 table
LastName Age Smoker Height Weight BloodPressure
___________ ___ ______ ______ ______ _____________
{'Sanchez'} 38 true 71 176 124 93
{'Johnson'} 43 false 69 163 109 77
{'Li' } 38 true 64 131 125 83
{'Diaz' } 40 false 67 133 117 75
{'Brown' } 49 true 64 119 122 80
goodRows =
5×1 logical array
1
1
0
1
0
results =
3×6 table
LastName Age Smoker Height Weight BloodPressure
___________ ___ ______ ______ ______ _____________
{'Sanchez'} 38 true 71 176 124 93
{'Johnson'} 43 false 69 163 109 77
{'Diaz' } 40 false 67 133 117 75
Note how results now has fewer rows than before filtering.
Put the code right after you call struct2table.

请先登录,再进行评论。


Abdussalam Elhanashi
Hi
I put the code and i got this error
The logical indices in position 1 contain a true value outside of the array bounds.
Error in Evaluationthedetector (line 26)
resutls = results(goodRows, :);

Community Treasure Hunt

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

Start Hunting!

Translated by