tianzhi0549 / FCOS

FCOS: Fully Convolutional One-Stage Object Detection (ICCV'19)
https://arxiv.org/abs/1904.01355
Other
3.26k stars 630 forks source link

Giou bug #355

Open OmerMagdy opened 2 years ago

OmerMagdy commented 2 years ago

In the code the implementation of the Giou loss is different than the original code:

    w_intersect = torch.min(pred_left, target_left) + torch.min(pred_right, target_right)
    g_w_intersect = torch.max(pred_left, target_left) + torch.max( pred_right, target_right)
    h_intersect = torch.min(pred_bottom, target_bottom) + torch.min(pred_top, target_top)
    g_h_intersect = torch.max(pred_bottom, target_bottom) + torch.max(pred_top, target_top)
    ac_uion = g_w_intersect * g_h_intersect + 1e-7
    area_intersect = w_intersect * h_intersect
    area_union = target_area + pred_area - area_intersect
    ious = (area_intersect + 1.0) / (area_union + 1.0)
    gious = ious - (ac_uion - area_union) / ac_uion

I think the fixed two lines should be :

g_w_intersect =  torch.max(pred_right, target_right)-torch.min(pred_left, target_left)
g_h_intersect = torch.max(pred_bottom, target_bottom) - torch.min(pred_top, target_top)

Can I get the confirmation of that fix ?