--resume EMA fix #292

This commit is contained in:
Glenn Jocher committed 2020-07-09 15:09:06 -07:00
1 parent 2b6209a9d5
commit 24c5a941f0
2 files changed
+5 -9

No files matched your search

+2 -2
View File
@@ -163,6 +163,7 @@ def train(hyp):
dataloader, dataset = create_dataloader(train_path, imgsz, batch_size, gs, opt,
hyp=hyp, augment=True, cache=opt.cache_images, rect=opt.rect)
mlc = np.concatenate(dataset.labels, 0)[:, 0].max() # max label class
nb = len(dataloader) # number of batches
assert mlc < nc, 'Label class %g exceeds nc=%g in %s. Correct your labels or your model.' % (mlc, nc, opt.cfg)
# Testloader
@@ -191,11 +192,10 @@ def train(hyp):
check_anchors(dataset, model=model, thr=hyp['anchor_t'], imgsz=imgsz)
# Exponential moving average
ema = torch_utils.ModelEMA(model)
ema = torch_utils.ModelEMA(model, updates=start_epoch * nb / accumulate)
# Start training
t0 = time.time()
nb = len(dataloader) # number of batches
nw = max(3 * nb, 1e3) # number of warmup iterations, max(3 epochs, 1k iterations)
maps = np.zeros(nc) # mAP per class
results = (0, 0, 0, 0, 0, 0, 0) # 'P', 'R', 'mAP', 'F1', 'val GIoU', 'val Objectness', 'val Classification'