Upload config.json
Browse files- config.json +89 -0
config.json
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Shanghai AI Lab. All rights reserved.
|
2 |
+
_base_ = [
|
3 |
+
'../_base_/models/upernet_beit.py',
|
4 |
+
'../_base_/datasets/ade20k.py',
|
5 |
+
'../_base_/default_runtime.py',
|
6 |
+
'../_base_/schedules/schedule_160k.py'
|
7 |
+
]
|
8 |
+
crop_size = (640, 640)
|
9 |
+
# pretrained = 'https://conversationhub.blob.core.windows.net/beit-share-public/beit/beit_large_patch16_224_pt22k_ft22k.pth'
|
10 |
+
pretrained = 'pretrained/beit_large_patch16_224_pt22k_ft22k.pth'
|
11 |
+
model = dict(
|
12 |
+
pretrained=pretrained,
|
13 |
+
backbone=dict(
|
14 |
+
type='BEiTAdapter',
|
15 |
+
img_size=640,
|
16 |
+
patch_size=16,
|
17 |
+
embed_dim=1024,
|
18 |
+
depth=24,
|
19 |
+
num_heads=16,
|
20 |
+
mlp_ratio=4,
|
21 |
+
qkv_bias=True,
|
22 |
+
use_abs_pos_emb=False,
|
23 |
+
use_rel_pos_bias=True,
|
24 |
+
init_values=1e-6,
|
25 |
+
drop_path_rate=0.3,
|
26 |
+
conv_inplane=64,
|
27 |
+
n_points=4,
|
28 |
+
deform_num_heads=16,
|
29 |
+
cffn_ratio=0.25,
|
30 |
+
deform_ratio=0.5,
|
31 |
+
with_cp=True, # set with_cp=True to save memory
|
32 |
+
interaction_indexes=[[0, 5], [6, 11], [12, 17], [18, 23]],
|
33 |
+
),
|
34 |
+
decode_head=dict(
|
35 |
+
in_channels=[1024, 1024, 1024, 1024],
|
36 |
+
num_classes=150,
|
37 |
+
channels=1024,
|
38 |
+
),
|
39 |
+
auxiliary_head=dict(
|
40 |
+
in_channels=1024,
|
41 |
+
num_classes=150
|
42 |
+
),
|
43 |
+
test_cfg = dict(mode='slide', crop_size=crop_size, stride=(426, 426))
|
44 |
+
)
|
45 |
+
img_norm_cfg = dict(
|
46 |
+
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
47 |
+
train_pipeline = [
|
48 |
+
dict(type='LoadImageFromFile'),
|
49 |
+
dict(type='LoadAnnotations', reduce_zero_label=True),
|
50 |
+
dict(type='Resize', img_scale=(2048, 640), ratio_range=(0.5, 2.0)),
|
51 |
+
dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75),
|
52 |
+
dict(type='RandomFlip', prob=0.5),
|
53 |
+
dict(type='PhotoMetricDistortion'),
|
54 |
+
dict(type='Normalize', **img_norm_cfg),
|
55 |
+
dict(type='Pad', size=crop_size, pad_val=0, seg_pad_val=255),
|
56 |
+
dict(type='DefaultFormatBundle'),
|
57 |
+
dict(type='Collect', keys=['img', 'gt_semantic_seg'])
|
58 |
+
]
|
59 |
+
test_pipeline = [
|
60 |
+
dict(type='LoadImageFromFile'),
|
61 |
+
dict(
|
62 |
+
type='MultiScaleFlipAug',
|
63 |
+
img_scale=(2048, 640),
|
64 |
+
# img_ratios=[0.5, 0.75, 1.0, 1.25, 1.5, 1.75],
|
65 |
+
flip=False,
|
66 |
+
transforms=[
|
67 |
+
dict(type='Resize', keep_ratio=True),
|
68 |
+
dict(type='ResizeToMultiple', size_divisor=32),
|
69 |
+
dict(type='RandomFlip'),
|
70 |
+
dict(type='Normalize', **img_norm_cfg),
|
71 |
+
dict(type='ImageToTensor', keys=['img']),
|
72 |
+
dict(type='Collect', keys=['img']),
|
73 |
+
])
|
74 |
+
]
|
75 |
+
optimizer = dict(_delete_=True, type='AdamW', lr=2e-5, betas=(0.9, 0.999), weight_decay=0.05,
|
76 |
+
constructor='LayerDecayOptimizerConstructor',
|
77 |
+
paramwise_cfg=dict(num_layers=24, layer_decay_rate=0.90))
|
78 |
+
lr_config = dict(_delete_=True, policy='poly',
|
79 |
+
warmup='linear',
|
80 |
+
warmup_iters=1500,
|
81 |
+
warmup_ratio=1e-6,
|
82 |
+
power=1.0, min_lr=0.0, by_epoch=False)
|
83 |
+
data=dict(samples_per_gpu=2,
|
84 |
+
train=dict(pipeline=train_pipeline),
|
85 |
+
val=dict(pipeline=test_pipeline),
|
86 |
+
test=dict(pipeline=test_pipeline))
|
87 |
+
runner = dict(type='IterBasedRunner')
|
88 |
+
checkpoint_config = dict(by_epoch=False, interval=1000, max_keep_ckpts=1)
|
89 |
+
evaluation = dict(interval=16000, metric='mIoU', save_best='mIoU')
|