From 1dc1761f45fe46f077694e1a70472cd7eb788e0c Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 5 Mar 2020 10:20:08 -0800 Subject: [PATCH] updates --- train.py | 2 +- utils/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/train.py b/train.py index 5ca0efe4..b12b2b41 100644 --- a/train.py +++ b/train.py @@ -211,7 +211,7 @@ def train(): print('Starting training for %g epochs...' % epochs) for epoch in range(start_epoch, epochs): # epoch ------------------------------------------------------------------ model.train() - model.hyp['gr'] = 1 - (1 + math.cos(min(epoch * 2, epochs) * math.pi / epochs)) / 2 # GIoU <-> 1.0 loss ratio + model.gr = 1 - (1 + math.cos(min(epoch * 2, epochs) * math.pi / epochs)) / 2 # GIoU <-> 1.0 loss ratio # Prebias if prebias: diff --git a/utils/utils.py b/utils/utils.py index 482f8974..f3403120 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -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