Fix bias warmup LR init (#8356)
Browse filesPer https://github.com/ultralytics/yolov5/issues/8352
train.py
CHANGED
@@ -335,7 +335,7 @@ def train(hyp, opt, device, callbacks): # hyp is path/to/hyp.yaml or hyp dictio
|
|
335 |
accumulate = max(1, np.interp(ni, xi, [1, nbs / batch_size]).round())
|
336 |
for j, x in enumerate(optimizer.param_groups):
|
337 |
# bias lr falls from 0.1 to lr0, all other lrs rise from 0.0 to lr0
|
338 |
-
x['lr'] = np.interp(ni, xi, [hyp['warmup_bias_lr'] if j ==
|
339 |
if 'momentum' in x:
|
340 |
x['momentum'] = np.interp(ni, xi, [hyp['warmup_momentum'], hyp['momentum']])
|
341 |
|
|
|
335 |
accumulate = max(1, np.interp(ni, xi, [1, nbs / batch_size]).round())
|
336 |
for j, x in enumerate(optimizer.param_groups):
|
337 |
# bias lr falls from 0.1 to lr0, all other lrs rise from 0.0 to lr0
|
338 |
+
x['lr'] = np.interp(ni, xi, [hyp['warmup_bias_lr'] if j == 0 else 0.0, x['initial_lr'] * lf(epoch)])
|
339 |
if 'momentum' in x:
|
340 |
x['momentum'] = np.interp(ni, xi, [hyp['warmup_momentum'], hyp['momentum']])
|
341 |
|