cyclic-40e.py 2.23 KB
Newer Older
zhangwenwei's avatar
zhangwenwei committed
1
2
3
4
5
6
# The schedule is usually used by models trained on KITTI dataset
# The learning rate set in the cyclic schedule is the initial learning rate
# rather than the max learning rate. Since the target_ratio is (10, 1e-4),
# the learning rate will change from 0.0018 to 0.018, than go to 0.0018*1e-4
lr = 0.0018
# The optimizer follows the setting in SECOND.Pytorch, but here we use
7
# the official AdamW optimizer implemented by PyTorch.
jshilong's avatar
jshilong committed
8
9
10
11
12
13
optim_wrapper = dict(
    type='OptimWrapper',
    optimizer=dict(type='AdamW', lr=lr, betas=(0.95, 0.99), weight_decay=0.01),
    clip_grad=dict(max_norm=10, norm_type=2))
# learning rate
param_scheduler = [
14
15
16
17
    # learning rate scheduler
    # During the first 16 epochs, learning rate increases from 0 to lr * 10
    # during the next 24 epochs, learning rate decreases from lr * 10 to
    # lr * 1e-4
jshilong's avatar
jshilong committed
18
19
    dict(
        type='CosineAnnealingLR',
20
        T_max=16,
jshilong's avatar
jshilong committed
21
22
        eta_min=lr * 10,
        begin=0,
23
24
25
        end=16,
        by_epoch=True,
        convert_to_iter_based=True),
jshilong's avatar
jshilong committed
26
27
    dict(
        type='CosineAnnealingLR',
28
        T_max=24,
jshilong's avatar
jshilong committed
29
        eta_min=lr * 1e-4,
30
31
32
33
        begin=16,
        end=40,
        by_epoch=True,
        convert_to_iter_based=True),
34
35
36
    # momentum scheduler
    # During the first 16 epochs, momentum increases from 0 to 0.85 / 0.95
    # during the next 24 epochs, momentum increases from 0.85 / 0.95 to 1
jshilong's avatar
jshilong committed
37
    dict(
38
        type='CosineAnnealingMomentum',
39
        T_max=16,
jshilong's avatar
jshilong committed
40
41
        eta_min=0.85 / 0.95,
        begin=0,
42
43
44
        end=16,
        by_epoch=True,
        convert_to_iter_based=True),
jshilong's avatar
jshilong committed
45
    dict(
46
        type='CosineAnnealingMomentum',
47
        T_max=24,
jshilong's avatar
jshilong committed
48
        eta_min=1,
49
50
51
52
        begin=16,
        end=40,
        by_epoch=True,
        convert_to_iter_based=True)
jshilong's avatar
jshilong committed
53
54
55
]

# Runtime settings,training schedule for 40e
56
57
# Although the max_epochs is 40, this schedule is usually used we
# RepeatDataset with repeat ratio N, thus the actual max epoch
zhangwenwei's avatar
zhangwenwei committed
58
# number could be Nx40
59
60
train_cfg = dict(by_epoch=True, max_epochs=40, val_interval=1)
val_cfg = dict()
jshilong's avatar
jshilong committed
61
test_cfg = dict()
62
63
64
65
66
67

# Default setting for scaling LR automatically
#   - `enable` means enable scaling LR automatically
#       or not by default.
#   - `base_batch_size` = (8 GPUs) x (6 samples per GPU).
auto_scale_lr = dict(enable=False, base_batch_size=48)