This commit is contained in:
Glenn Jocher
2020-03-05 10:20:08 -08:00
parent b8b89a3132
commit 1dc1761f45
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -401,7 +401,7 @@ def compute_loss(p, targets, model): # predictions, targets, model
pbox = torch.cat((pxy, pwh), 1) # predicted box
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 - h['gr']) + h['gr'] * giou.detach().clamp(0).type(tobj.dtype) # giou ratio
tobj[b, a, gj, gi] = (1.0 - model.gr) + model.gr * giou.detach().clamp(0).type(tobj.dtype) # giou ratio
if 'default' in arc and model.nc > 1: # cls loss (only if multiple classes)
t = torch.zeros_like(ps[:, 5:]) # targets