I try to caculate my detection accuracy, and find it is diffuclty to use the public function in matlab to meet my requirement.
such as the above picture, how to detect the result.
so I design the function
%% test the accuracy of the detection
function overlapRation= CalBoundingboxAcuuracy(Mbbox,bboxes)
%Mbbox--ground truth bounding box
%bboxes--detected bounding box
%method compare the detected width /width of the groundtruth
%wd--detected groundtruth in ground truth dataset
%wt-ground truth total width
%% designed by Jun Zhang May 10, 2019 in CU ICAR
if ~isempty(Mbbox)
wt=sum(Mbbox(:,3))
wd=0;
for i=1:size(Mbbox,1)
%ground truth dataset
Mbbox(i,:)
for j=1:size(bboxes) %the bouding box must be merged
%detected bbox
%rectint(Mbbox(4,:),bboxes(j,:))
overlapRatio = bboxOverlapRatio(Mbbox(i,:),bboxes(j,:),'Min');
wd=overlapRatio*Mbbox(i,3)+wd;
end
end
overlapRatio= wd/wt;
else
overlapRatio=1;
end