LR schedule to 0.05 min
This commit is contained in:
parent
9c5e76b93d
commit
c6b59a0e8a
6
train.py
6
train.py
|
@ -20,7 +20,7 @@ last = wdir + 'last.pt'
|
|||
best = wdir + 'best.pt'
|
||||
results_file = 'results.txt'
|
||||
|
||||
# Hyperparameters (results68: 59.9 mAP@0.5 yolov3-spp-416) https://github.com/ultralytics/yolov3/issues/310
|
||||
# Hyperparameters https://github.com/ultralytics/yolov3/issues/310
|
||||
|
||||
hyp = {'giou': 3.54, # giou loss gain
|
||||
'cls': 37.4, # cls loss gain
|
||||
|
@ -29,7 +29,7 @@ hyp = {'giou': 3.54, # giou loss gain
|
|||
'obj_pw': 1.0, # obj BCELoss positive_weight
|
||||
'iou_t': 0.225, # iou training threshold
|
||||
'lr0': 0.01, # initial learning rate (SGD=5E-3, Adam=5E-4)
|
||||
'lrf': -4., # final LambdaLR learning rate = lr0 * (10 ** lrf)
|
||||
'lrf': 0.0005, # final learning rate (with cos scheduler)
|
||||
'momentum': 0.937, # SGD momentum
|
||||
'weight_decay': 0.000484, # optimizer weight decay
|
||||
'fl_gamma': 0.0, # focal loss gamma (efficientDet default is gamma=1.5)
|
||||
|
@ -137,7 +137,7 @@ def train():
|
|||
model, optimizer = amp.initialize(model, optimizer, opt_level='O1', verbosity=0)
|
||||
|
||||
# Scheduler https://github.com/ultralytics/yolov3/issues/238
|
||||
lf = lambda x: (1 + math.cos(x * math.pi / epochs)) / 2 # cosine https://arxiv.org/pdf/1812.01187.pdf
|
||||
lf = lambda x: (((1 + math.cos(x * math.pi / epochs)) / 2) ** 1.0) * 0.95 + 0.05 # cosine https://arxiv.org/pdf/1812.01187.pdf
|
||||
scheduler = lr_scheduler.LambdaLR(optimizer, lr_lambda=lf, last_epoch=start_epoch - 1)
|
||||
# scheduler = lr_scheduler.MultiStepLR(optimizer, [round(epochs * x) for x in [0.8, 0.9]], 0.1, start_epoch - 1)
|
||||
|
||||
|
|
Loading…
Reference in New Issue