From 59de209ab26e6898b0599b0afb39d5c29fea77fe Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 27 Dec 2019 11:51:27 -0800 Subject: [PATCH] updates --- utils/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/utils.py b/utils/utils.py index a7e67b0c..7448496c 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -391,15 +391,15 @@ def compute_loss(p, targets, model): # predictions, targets, model if nb: # number of targets ng += nb ps = pi[b, a, gj, gi] # prediction subset corresponding to targets - tobj[b, a, gj, gi] = 1.0 # obj # ps[:, 2:4] = torch.sigmoid(ps[:, 2:4]) # wh power loss (uncomment) # GIoU pxy = torch.sigmoid(ps[:, 0:2]) # pxy = pxy * s - (s - 1) / 2, s = 1.5 (scale_xy) pwh = torch.exp(ps[:, 2:4]).clamp(max=1E3) * anchor_vec[i] pbox = torch.cat((pxy, pwh), 1) # predicted box - giou = 1.0 - bbox_iou(pbox.t(), tbox[i], x1y1x2y2=False, GIoU=True) # giou computation - lbox += giou.sum() if red == 'sum' else giou.mean() # giou loss + giou = bbox_iou(pbox.t(), tbox[i], x1y1x2y2=False, GIoU=True) # giou computation + lbox += (1.0 - giou).sum() if red == 'sum' else (1.0 - giou).mean() # giou loss + tobj[b, a, gj, gi] = 1.0 # giou.type(tobj.dtype) # obj if 'default' in arc and model.nc > 1: # cls loss (only if multiple classes) t = torch.zeros_like(ps[:, 5:]) # targets