--resume bug fix #187
This commit is contained in:
1 parent
b9da3ea46a
commit
ad4c22cbfe
1 file changed
+7
-3
@@ -133,9 +133,13 @@ def train(hyp):
|
|||||||
with open(results_file, 'w') as file:
|
with open(results_file, 'w') as file:
|
||||||
file.write(ckpt['training_results']) # write results.txt
|
file.write(ckpt['training_results']) # write results.txt
|
||||||
|
|
||||||
|
# epochs
|
||||||
start_epoch = ckpt['epoch'] + 1
|
start_epoch = ckpt['epoch'] + 1
|
||||||
assert opt.epochs > start_epoch, '%s has already trained %g epochs. --epochs must be greater than %g' % \
|
if epochs < start_epoch:
|
||||||
(opt.weights, ckpt['epoch'], ckpt['epoch'])
|
print('%s has been trained for %g epochs. Fine-tuning for %g additional epochs.' %
|
||||||
|
(opt.weights, ckpt['epoch'], epochs))
|
||||||
|
epochs += ckpt['epoch'] # finetune additional epochs
|
||||||
|
|
||||||
del ckpt
|
del ckpt
|
||||||
|
|
||||||
# Mixed precision training https://github.com/NVIDIA/apex
|
# Mixed precision training https://github.com/NVIDIA/apex
|
||||||
@@ -166,7 +170,7 @@ def train(hyp):
|
|||||||
|
|
||||||
# Testloader
|
# Testloader
|
||||||
testloader = create_dataloader(test_path, imgsz_test, batch_size, gs, opt,
|
testloader = create_dataloader(test_path, imgsz_test, batch_size, gs, opt,
|
||||||
hyp=hyp, augment=False, cache=opt.cache_images, rect=True)[0]
|
hyp=hyp, augment=False, cache=opt.cache_images, rect=True)[0]
|
||||||
|
|
||||||
# Model parameters
|
# Model parameters
|
||||||
hyp['cls'] *= nc / 80. # scale coco-tuned hyp['cls'] to current dataset
|
hyp['cls'] *= nc / 80. # scale coco-tuned hyp['cls'] to current dataset
|
||||||
|
|||||||
Reference in new issue
Block a user