比较两个边界框彼此Matlab [英] Compare two bounding boxes with each other Matlab

查看:211
本文介绍了比较两个边界框彼此Matlab的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个边界框的坐标,其中一个是groundtruth,另一个是我的工作结果。我想评估我的反对groundtruth一个的准确性。



边界框细节以这种格式保存 [x,y,width,height]

解决方案

我假设你正在检测一些对象,这是在广泛研究/研究的对象检测领域。评估准确性的最佳方法将是计算交集。这取自PASCAL VOC挑战,来自此处



如果你有一个边界框检测和一个地面实况边界框,那么它们之间的重叠区域应该大于或等于50%。假设地面实况边界框是 gt = [x_g,y_g,width_g,height_g] ,并且预测的边界框是 pr = [x_p,y_p, width_p,height_p] ,则可以使用以下公式计算重叠面积:

  intersectionArea = rectint (gt,pr); %如果你没有这个功能,然后写一个简单的自己计算两个矩形的交叉的面积。 
unionCoords = [min(x_g,x_p),min(y_g,y_p),max(x_g + width_g-1,x_p + width_p-1),max(y_g + height_g-1,y_p + height_p-1] ;
unionArea =(unionCoords(3)-unionCoords(1)+1)*(unionCoords(4)-unionCoords(2)+1);
overlapArea = intersectionArea / unionArea;超过0.5,认为它是一个有效的检测。

>

I have two the co-ordinates of two bounding boxes, one of them is the groundtruth and the other is the result of my work. I want to evaluate the accuracy of mine against the groundtruth one. So I'm asking if anyone has any suggestions

The bounding box details is saved in this format [x,y,width,height]

解决方案

I am assuming you are detecting some object and you are drawing a bounding box around it. This comes under widely studied/researched area of object detection. The best method of evaluating the accuracy will be calculating intersection over union. This is taken from the PASCAL VOC challenge, from here.

If you have a bounding box detection and a ground truth bounding box, then the area of overlap between them should be greater than or equal to 50%. Suppose the ground truth bounding box is gt=[x_g,y_g,width_g,height_g] and the predicted bounding box is pr=[x_p,y_p,width_p,height_p] then the area of overlap can be calculated using the formula:

intersectionArea=rectint(gt,pr); %If you don't have this function then write a simple one for yourself which calculates area of intersection of two rectangles.
unionCoords=[min(x_g,x_p),min(y_g,y_p),max(x_g+width_g-1,x_p+width_p-1),max(y_g+height_g-1,y_p+height_p-1];
unionArea=(unionCoords(3)-unionCoords(1)+1)*(unionCoords(4)-unionCoords(2)+1);
overlapArea=intersectionArea/unionArea; %This should be greater than 0.5 to consider it as a valid detection.

I hope its clear for you now.

这篇关于比较两个边界框彼此Matlab的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆