|
|
|
@ -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'
|
|
|
|
|