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]
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With