-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathupernet_vit-b16_ln_mln_512x512_ade20k_160k.py
89 lines (84 loc) · 2.51 KB
/
upernet_vit-b16_ln_mln_512x512_ade20k_160k.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
_base_ = [
'../_base_/datasets/ade20k.py',
'../_base_/default_runtime.py',
]
# model settings
norm_cfg = dict(type='BN')
model = dict(
type='EncoderDecoder',
pretrained='jittorhub://vit_base_p16_224-80ecf9dd.pkl',
backbone=dict(
type='VisionTransformer',
img_size=(512, 512),
patch_size=16,
in_channels=3,
embed_dims=768,
num_layers=12,
num_heads=12,
mlp_ratio=4,
out_indices=(2, 5, 8, 11),
qkv_bias=True,
drop_rate=0.0,
attn_drop_rate=0.0,
drop_path_rate=0,
with_cls_token=True,
norm_cfg=dict(type='LN', eps=1e-6),
act_cfg=dict(type='GELU'),
norm_eval=False,
final_norm=True,
interpolate_mode='bicubic'),
neck=dict(
type='MultiLevelNeck',
in_channels=[768, 768, 768, 768],
out_channels=768,
scales=[4, 2, 1, 0.5]),
decode_head=dict(
type='UPerHead',
in_channels=[768, 768, 768, 768],
in_index=[0, 1, 2, 3],
pool_scales=(1, 2, 3, 6),
channels=512,
dropout_ratio=0.1,
num_classes=150,
norm_cfg=norm_cfg,
align_corners=False,
loss_decode=dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
auxiliary_head=dict(
type='FCNHead',
in_channels=768,
in_index=3,
channels=256,
num_convs=1,
concat_input=False,
dropout_ratio=0.1,
num_classes=150,
norm_cfg=norm_cfg,
align_corners=False,
loss_decode=dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
# model training and testing settings
train_cfg=dict(),
test_cfg=dict(mode='whole')) # yapf: disable
parameter_groups_generator = dict(type="CustomPrameterGroupsGenerator",
custom_keys={
'pos_embed': dict(decay_mult=0.),
'cls_token': dict(decay_mult=0.),
'norm': dict(decay_mult=0.)
})
optimizer = dict(
type='CustomAdamW',
lr=0.0001,
betas=(0.9, 0.999),
weight_decay=0.05,
)
max_iter = 160000
eval_interval = 8000
checkpoint_interval = 8000
scheduler = dict(type='PolyLR',
warmup='linear',
warmup_iters=1500,
warmup_ratio=1e-6,
max_steps=max_iter,
power=1.0,
min_lr=0)