-
Notifications
You must be signed in to change notification settings - Fork 78
/
ban_vit-b16-clip_bit_512x512_80k_s2looking.py
72 lines (67 loc) · 2.19 KB
/
ban_vit-b16-clip_bit_512x512_80k_s2looking.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
_base_ = [
'../_base_/models/ban_vit-b16.py',
'../common/standard_512x512_40k_s2looking.py']
crop_size = (512, 512)
model = dict(
asymetric_input=True,
encoder_resolution=dict(
size=(224, 224),
mode='bilinear'),
image_encoder=dict(
frozen_exclude=[]),
decode_head=dict(
type='BitemporalAdapterHead',
ban_cfg=dict(
clip_channels=768,
fusion_index=[0, 1, 2],
side_enc_cfg=dict(
type='mmseg.ResNetV1c',
init_cfg=dict(
type='Pretrained', checkpoint='open-mmlab://resnet18_v1c'),
in_channels=3,
depth=18,
num_stages=3,
out_indices=(2,),
dilations=(1, 1, 1),
strides=(1, 2, 1),
norm_cfg=dict(type='SyncBN', requires_grad=True),
norm_eval=False,
style='pytorch',
contract_dilation=True)),
ban_dec_cfg=dict(
type='BAN_BITHead',
in_channels=256,
channels=32,
num_classes=2)),
test_cfg=dict(mode='slide', crop_size=crop_size, stride=(crop_size[0]//2, crop_size[1]//2)))
optim_wrapper = dict(
_delete_=True,
type='AmpOptimWrapper',
optimizer=dict(
type='AdamW', lr=0.0001, betas=(0.9, 0.999), weight_decay=0.0001),
paramwise_cfg=dict(
custom_keys={
'img_encoder': dict(lr_mult=0.1, decay_mult=1.0),
'norm': dict(decay_mult=0.),
'mask_decoder': dict(lr_mult=10.)
}),
loss_scale='dynamic',
clip_grad=dict(max_norm=0.01, norm_type=2))
# learning policy
param_scheduler = [
dict(
type='LinearLR', start_factor=1e-6, by_epoch=False, begin=0, end=1000),
dict(
type='PolyLR',
power=1.0,
begin=1000,
end=80000,
eta_min=0.0,
by_epoch=False,
)
]
# training schedule for 80k
train_cfg = dict(type='IterBasedTrainLoop', max_iters=80000, val_interval=8000)
default_hooks = dict(checkpoint=dict(type='CheckpointHook', interval=8000))
train_dataloader = dict(batch_size=8, num_workers=8)
val_dataloader = dict(batch_size=1, num_workers=1)