Commit
·
a62a45b
1
Parent(s):
35dc935
prevent testloader caching on --notest
Browse files
train.py
CHANGED
@@ -165,8 +165,8 @@ def train(hyp, opt, device, tb_writer=None):
|
|
165 |
|
166 |
# Trainloader
|
167 |
dataloader, dataset = create_dataloader(train_path, imgsz, batch_size, gs, opt,
|
168 |
-
hyp=hyp, augment=True, cache=opt.cache_images, rect=opt.rect,
|
169 |
-
world_size=opt.world_size, workers=opt.workers)
|
170 |
mlc = np.concatenate(dataset.labels, 0)[:, 0].max() # max label class
|
171 |
nb = len(dataloader) # number of batches
|
172 |
assert mlc < nc, 'Label class %g exceeds nc=%g in %s. Possible class labels are 0-%g' % (mlc, nc, opt.data, nc - 1)
|
@@ -175,8 +175,8 @@ def train(hyp, opt, device, tb_writer=None):
|
|
175 |
if rank in [-1, 0]:
|
176 |
ema.updates = start_epoch * nb // accumulate # set EMA updates
|
177 |
testloader = create_dataloader(test_path, imgsz_test, total_batch_size, gs, opt,
|
178 |
-
hyp=hyp, augment=False, cache=opt.cache_images, rect=True,
|
179 |
-
world_size=opt.world_size, workers=opt.workers)[0] # testloader
|
180 |
|
181 |
if not opt.resume:
|
182 |
labels = np.concatenate(dataset.labels, 0)
|
|
|
165 |
|
166 |
# Trainloader
|
167 |
dataloader, dataset = create_dataloader(train_path, imgsz, batch_size, gs, opt,
|
168 |
+
hyp=hyp, augment=True, cache=opt.cache_images, rect=opt.rect,
|
169 |
+
rank=rank, world_size=opt.world_size, workers=opt.workers)
|
170 |
mlc = np.concatenate(dataset.labels, 0)[:, 0].max() # max label class
|
171 |
nb = len(dataloader) # number of batches
|
172 |
assert mlc < nc, 'Label class %g exceeds nc=%g in %s. Possible class labels are 0-%g' % (mlc, nc, opt.data, nc - 1)
|
|
|
175 |
if rank in [-1, 0]:
|
176 |
ema.updates = start_epoch * nb // accumulate # set EMA updates
|
177 |
testloader = create_dataloader(test_path, imgsz_test, total_batch_size, gs, opt,
|
178 |
+
hyp=hyp, augment=False, cache=opt.cache_images and not opt.notest, rect=True,
|
179 |
+
rank=-1, world_size=opt.world_size, workers=opt.workers)[0] # testloader
|
180 |
|
181 |
if not opt.resume:
|
182 |
labels = np.concatenate(dataset.labels, 0)
|