Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compare two bounding boxes with each other Matlab

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]

like image 603
Tak Avatar asked Mar 11 '14 01:03

Tak


People also ask

How do you combine two bounding boxes in Matlab?

Increase the size of bounding boxes, make them overlap and try to merge. change the valuse expansionAmount in your code. By the way you totally copied the exaple code from matlab. And only use either regionprops or stoke width variation to remove non text region , the code you copied using both.

How do you check if bounding boxes overlap?

Two axes aligned boxes (of any dimension) overlap if and only if the projections to all axes overlap. The projection to an axis is simply the coordinate range for that axis. The blue and the green boxes in the image above overlap because their projections to both axes overlap.

Can bounding boxes overlap?

In object detection, it is usual to have bounding box targets to identify objects in images. These bounding boxes may sometimes overlap. In some models like Mask RCNN the bounding boxes are predicted directly and the overlap of the bounding boxes in not a problem.

How do you calculate IoU between two boxes?

Intersection over Union calculation example Area of Union: Area of the Red Bounding Box + Area of the Green Bounding Box - Area of Overlap = 10 10 + 10 10 - 25 = 175. IoU: Area of Overlap / Area of Union = 25 / 175 ~ 0.14 - poor IoU.


1 Answers

Edit: I have corrected the mistake pointed by other users.

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. See here for visuals.

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.
unionArea = (width_g*height_g)+(width_p*height_p)-intersectionArea;
overlapArea = intersectionArea/unionArea; %This should be greater than 0.5 to consider it as a valid detection.

I hope its clear for you now.

like image 58
Autonomous Avatar answered Sep 28 '22 05:09

Autonomous