tianzhi0549/FCOS

Giou bug

OmerMagdy opened this issue · 0 comments

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 ?