Update train.py test batch_size (#2148)
* Update train.py * Update loss.py
This commit is contained in:
1 parent
e9b3de463a
commit
86897e3663
2 files changed
+3
-4
No files matched your search
@@ -190,7 +190,7 @@ def train(hyp, opt, device, tb_writer=None, wandb=None):
|
||||
# Process 0
|
||||
if rank in [-1, 0]:
|
||||
ema.updates = start_epoch * nb // accumulate # set EMA updates
|
||||
testloader = create_dataloader(test_path, imgsz_test, total_batch_size, gs, opt, # testloader
|
||||
testloader = create_dataloader(test_path, imgsz_test, batch_size * 2, gs, opt, # testloader
|
||||
hyp=hyp, cache=opt.cache_images and not opt.notest, rect=True, rank=-1,
|
||||
world_size=opt.world_size, workers=opt.workers,
|
||||
pad=0.5, prefix=colorstr('val: '))[0]
|
||||
@@ -338,7 +338,7 @@ def train(hyp, opt, device, tb_writer=None, wandb=None):
|
||||
final_epoch = epoch + 1 == epochs
|
||||
if not opt.notest or final_epoch: # Calculate mAP
|
||||
results, maps, times = test.test(opt.data,
|
||||
batch_size=total_batch_size,
|
||||
batch_size=batch_size * 2,
|
||||
imgsz=imgsz_test,
|
||||
model=ema.ema,
|
||||
single_cls=opt.single_cls,
|
||||
|
||||
+1
-2
@@ -105,8 +105,7 @@ class ComputeLoss:
|
||||
BCEcls, BCEobj = FocalLoss(BCEcls, g), FocalLoss(BCEobj, g)
|
||||
|
||||
det = model.module.model[-1] if is_parallel(model) else model.model[-1] # Detect() module
|
||||
self.balance = {3: [3.67, 1.0, 0.43], 4: [3.78, 1.0, 0.39, 0.22], 5: [3.88, 1.0, 0.37, 0.17, 0.10]}[det.nl]
|
||||
# self.balance = [1.0] * det.nl
|
||||
self.balance = {3: [3.67, 1.0, 0.43], 4: [4.0, 1.0, 0.25, 0.06], 5: [4.0, 1.0, 0.25, 0.06, .02]}[det.nl]
|
||||
self.ssi = (det.stride == 16).nonzero(as_tuple=False).item() # stride 16 index
|
||||
self.BCEcls, self.BCEobj, self.gr, self.hyp, self.autobalance = BCEcls, BCEobj, model.gr, h, autobalance
|
||||
for k in 'na', 'nc', 'nl', 'anchors':
|
||||
|
||||
Reference in new issue
Block a user