Threshold for evaluation code R-CNN

6 views (last 30 days)
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)

Accepted Answer

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

Sign in to comment.

More Answers (2)

Abdussalam Elhanashi
Abdussalam Elhanashi on 28 Sep 2019
hi
i got this error
Undefined operator '>' for input arguments of type 'cell'.
Error in Evaluationthedetector (line 29)
goodRows = [results.Scores] > 0.66;
  1 Comment
Image Analyst
Image Analyst on 29 Sep 2019
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.

Sign in to comment.


Abdussalam Elhanashi
Abdussalam Elhanashi on 29 Sep 2019
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