CrowdDet icon indicating copy to clipboard operation
CrowdDet copied to clipboard

bugs when calculating iou between gt and boxes ?

Open anxu829 opened this issue 4 years ago • 1 comments

here is your code in function box_overlap_ignore_opr:


    area_box = (box[:, 2] - box[:, 0] + 1) * (box[:, 3] - box[:, 1] + 1)
    area_gt = (gt[:, 2] - gt[:, 0] + 1) * (gt[:, 3] - gt[:, 1] + 1)
    width_height = torch.min(box[:, None, 2:], gt[:, 2:4]) - torch.max(
        box[:, None, :2], gt[:, :2])  # [N,M,2]

my question is that when you calculating the area of gt and box , you plus 1 to the width and height

but when you calculate the width_height of intersect box , you do not plus 1 , which means even a gt box can not have a very high iou intersection with it self

so i think the right way to calculate width_height is like this:


    width_height = torch.min(box[:, None, 2:], gt[:, 2:4]) - torch.max(
        box[:, None, :2], gt[:, :2]) + 1 

am i right :)

anxu829 avatar Jan 03 '21 15:01 anxu829

yeah you're right, whether one is added or not, it needs to be unified. Thank you for finding this bug 👍

xg-chu avatar Jan 05 '21 08:01 xg-chu