diff --git a/train.py b/train.py index d3e20aa8..30313894 100644 --- a/train.py +++ b/train.py @@ -138,15 +138,11 @@ 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 - x / epochs # linear ramp to zero - # lf = lambda x: 10 ** (hyp['lrf'] * x / epochs) # exp ramp - # lf = lambda x: 1 - 10 ** (hyp['lrf'] * (1 - x / epochs)) # inverse exp ramp lf = lambda x: (1 + math.cos(x * math.pi / epochs)) / 2 * 0.99 + 0.01 # cosine https://arxiv.org/pdf/1812.01187.pdf - scheduler = lr_scheduler.LambdaLR(optimizer, lr_lambda=lf) - # scheduler = lr_scheduler.MultiStepLR(optimizer, milestones=[round(epochs * x) for x in [0.8, 0.9]], gamma=0.1) - scheduler.last_epoch = start_epoch + 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) - # # Plot lr schedule + # Plot lr schedule # y = [] # for _ in range(epochs): # scheduler.step()