aadex commited on
Commit
cb4a205
·
verified ·
1 Parent(s): 0b55069

Upload upernet_alibi_vit_tiny_512x512_ade20k.py with huggingface_hub

Browse files
upernet_alibi_vit_tiny_512x512_ade20k.py ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ crop_size = (
2
+ 512,
3
+ 512,
4
+ )
5
+ custom_imports = dict(
6
+ allow_failed_imports=False, imports=[
7
+ 'segmentation',
8
+ ])
9
+ data_preprocessor = dict(
10
+ bgr_to_rgb=True,
11
+ mean=[
12
+ 123.675,
13
+ 116.28,
14
+ 103.53,
15
+ ],
16
+ pad_val=0,
17
+ seg_pad_val=255,
18
+ size=(
19
+ 512,
20
+ 512,
21
+ ),
22
+ std=[
23
+ 58.395,
24
+ 57.12,
25
+ 57.375,
26
+ ],
27
+ type='SegDataPreProcessor')
28
+ data_root = 'data/ade/ADEChallengeData2016'
29
+ dataset_type = 'ADE20KDataset'
30
+ default_hooks = dict(
31
+ checkpoint=dict(
32
+ by_epoch=False, interval=4000, save_best='mIoU',
33
+ type='CheckpointHook'),
34
+ logger=dict(interval=50, log_metric_by_epoch=False, type='LoggerHook'),
35
+ param_scheduler=dict(type='ParamSchedulerHook'),
36
+ sampler_seed=dict(type='DistSamplerSeedHook'),
37
+ timer=dict(type='IterTimerHook'),
38
+ visualization=dict(type='SegVisualizationHook'))
39
+ default_scope = 'mmseg'
40
+ depth = 12
41
+ env_cfg = dict(
42
+ cudnn_benchmark=True,
43
+ dist_cfg=dict(backend='nccl'),
44
+ mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0))
45
+ hidden_dim = 192
46
+ launcher = 'none'
47
+ load_from = None
48
+ log_level = 'INFO'
49
+ log_processor = dict(by_epoch=False)
50
+ mlp_dim = 768
51
+ model = dict(
52
+ auxiliary_head=dict(
53
+ align_corners=False,
54
+ channels=256,
55
+ concat_input=False,
56
+ dropout_ratio=0.1,
57
+ in_channels=192,
58
+ in_index=3,
59
+ loss_decode=dict(
60
+ loss_weight=0.4, type='CrossEntropyLoss', use_sigmoid=False),
61
+ norm_cfg=dict(requires_grad=True, type='SyncBN'),
62
+ num_classes=150,
63
+ num_convs=1,
64
+ type='FCNHead'),
65
+ backbone=dict(
66
+ attention_dropout=0.0,
67
+ depth=12,
68
+ dropout=0.0,
69
+ hidden_dim=192,
70
+ img_size=512,
71
+ in_chans=3,
72
+ init_cfg=dict(
73
+ checkpoint='checkpoints/alibi_vit_imagenet100_best.pth',
74
+ type='Pretrained'),
75
+ mlp_dim=768,
76
+ num_heads=3,
77
+ out_indices=(
78
+ 2,
79
+ 5,
80
+ 8,
81
+ 11,
82
+ ),
83
+ patch_size=16,
84
+ pretrain_img_size=224,
85
+ type='ALiBiViTBackbone'),
86
+ data_preprocessor=dict(
87
+ bgr_to_rgb=True,
88
+ mean=[
89
+ 123.675,
90
+ 116.28,
91
+ 103.53,
92
+ ],
93
+ pad_val=0,
94
+ seg_pad_val=255,
95
+ size=(
96
+ 512,
97
+ 512,
98
+ ),
99
+ std=[
100
+ 58.395,
101
+ 57.12,
102
+ 57.375,
103
+ ],
104
+ type='SegDataPreProcessor'),
105
+ decode_head=dict(
106
+ align_corners=False,
107
+ channels=512,
108
+ dropout_ratio=0.1,
109
+ in_channels=[
110
+ 192,
111
+ 192,
112
+ 192,
113
+ 192,
114
+ ],
115
+ in_index=[
116
+ 0,
117
+ 1,
118
+ 2,
119
+ 3,
120
+ ],
121
+ loss_decode=dict(
122
+ loss_weight=1.0, type='CrossEntropyLoss', use_sigmoid=False),
123
+ norm_cfg=dict(requires_grad=True, type='SyncBN'),
124
+ num_classes=150,
125
+ pool_scales=(
126
+ 1,
127
+ 2,
128
+ 3,
129
+ 6,
130
+ ),
131
+ type='UPerHead'),
132
+ neck=dict(
133
+ in_channels=[
134
+ 192,
135
+ 192,
136
+ 192,
137
+ 192,
138
+ ],
139
+ out_channels=192,
140
+ scales=[
141
+ 4,
142
+ 2,
143
+ 1,
144
+ 0.5,
145
+ ],
146
+ type='MultiLevelNeck'),
147
+ test_cfg=dict(mode='whole'),
148
+ train_cfg=dict(),
149
+ type='EncoderDecoder')
150
+ norm_cfg = dict(requires_grad=True, type='SyncBN')
151
+ num_classes = 150
152
+ num_heads = 3
153
+ optim_wrapper = dict(
154
+ clip_grad=dict(max_norm=1.0, norm_type=2),
155
+ optimizer=dict(
156
+ betas=(
157
+ 0.9,
158
+ 0.999,
159
+ ), lr=0.0004, type='AdamW', weight_decay=0.05),
160
+ paramwise_cfg=dict(custom_keys=dict(backbone=dict(lr_mult=0.1))),
161
+ type='AmpOptimWrapper')
162
+ param_scheduler = [
163
+ dict(
164
+ begin=0, by_epoch=False, end=500, start_factor=1e-06, type='LinearLR'),
165
+ dict(
166
+ begin=500,
167
+ by_epoch=False,
168
+ end=40000,
169
+ eta_min=0.0,
170
+ power=1.0,
171
+ type='PolyLR'),
172
+ ]
173
+ patch_size = 16
174
+ resume = True
175
+ test_cfg = dict(type='TestLoop')
176
+ test_dataloader = dict(
177
+ batch_size=1,
178
+ dataset=dict(
179
+ data_prefix=dict(
180
+ img_path='images/validation',
181
+ seg_map_path='annotations/validation'),
182
+ data_root='data/ade/ADEChallengeData2016',
183
+ pipeline=[
184
+ dict(type='LoadImageFromFile'),
185
+ dict(keep_ratio=True, scale=(
186
+ 2048,
187
+ 512,
188
+ ), type='Resize'),
189
+ dict(reduce_zero_label=True, type='LoadAnnotations'),
190
+ dict(type='PackSegInputs'),
191
+ ],
192
+ type='ADE20KDataset'),
193
+ num_workers=4,
194
+ persistent_workers=True,
195
+ sampler=dict(shuffle=False, type='DefaultSampler'))
196
+ test_evaluator = dict(
197
+ iou_metrics=[
198
+ 'mIoU',
199
+ ], type='IoUMetric')
200
+ test_pipeline = [
201
+ dict(type='LoadImageFromFile'),
202
+ dict(keep_ratio=True, scale=(
203
+ 2048,
204
+ 512,
205
+ ), type='Resize'),
206
+ dict(reduce_zero_label=True, type='LoadAnnotations'),
207
+ dict(type='PackSegInputs'),
208
+ ]
209
+ train_cfg = dict(max_iters=40000, type='IterBasedTrainLoop', val_interval=4000)
210
+ train_dataloader = dict(
211
+ batch_size=16,
212
+ dataset=dict(
213
+ data_prefix=dict(
214
+ img_path='images/training', seg_map_path='annotations/training'),
215
+ data_root='data/ade/ADEChallengeData2016',
216
+ pipeline=[
217
+ dict(type='LoadImageFromFile'),
218
+ dict(reduce_zero_label=True, type='LoadAnnotations'),
219
+ dict(
220
+ keep_ratio=True,
221
+ ratio_range=(
222
+ 0.5,
223
+ 2.0,
224
+ ),
225
+ scale=(
226
+ 2048,
227
+ 512,
228
+ ),
229
+ type='RandomResize'),
230
+ dict(
231
+ cat_max_ratio=0.75, crop_size=(
232
+ 512,
233
+ 512,
234
+ ), type='RandomCrop'),
235
+ dict(prob=0.5, type='RandomFlip'),
236
+ dict(type='PhotoMetricDistortion'),
237
+ dict(type='PackSegInputs'),
238
+ ],
239
+ type='ADE20KDataset'),
240
+ num_workers=8,
241
+ persistent_workers=True,
242
+ sampler=dict(shuffle=True, type='InfiniteSampler'))
243
+ train_pipeline = [
244
+ dict(type='LoadImageFromFile'),
245
+ dict(reduce_zero_label=True, type='LoadAnnotations'),
246
+ dict(
247
+ keep_ratio=True,
248
+ ratio_range=(
249
+ 0.5,
250
+ 2.0,
251
+ ),
252
+ scale=(
253
+ 2048,
254
+ 512,
255
+ ),
256
+ type='RandomResize'),
257
+ dict(cat_max_ratio=0.75, crop_size=(
258
+ 512,
259
+ 512,
260
+ ), type='RandomCrop'),
261
+ dict(prob=0.5, type='RandomFlip'),
262
+ dict(type='PhotoMetricDistortion'),
263
+ dict(type='PackSegInputs'),
264
+ ]
265
+ val_cfg = dict(type='ValLoop')
266
+ val_dataloader = dict(
267
+ batch_size=1,
268
+ dataset=dict(
269
+ data_prefix=dict(
270
+ img_path='images/validation',
271
+ seg_map_path='annotations/validation'),
272
+ data_root='data/ade/ADEChallengeData2016',
273
+ pipeline=[
274
+ dict(type='LoadImageFromFile'),
275
+ dict(keep_ratio=True, scale=(
276
+ 2048,
277
+ 512,
278
+ ), type='Resize'),
279
+ dict(reduce_zero_label=True, type='LoadAnnotations'),
280
+ dict(type='PackSegInputs'),
281
+ ],
282
+ type='ADE20KDataset'),
283
+ num_workers=4,
284
+ persistent_workers=True,
285
+ sampler=dict(shuffle=False, type='DefaultSampler'))
286
+ val_evaluator = dict(
287
+ iou_metrics=[
288
+ 'mIoU',
289
+ ], type='IoUMetric')
290
+ vis_backends = [
291
+ dict(type='LocalVisBackend'),
292
+ dict(
293
+ init_kwargs=dict(
294
+ name='upernet_alibi_vit_tiny_512x512_ade20k',
295
+ project='vit-segmentation',
296
+ tags=[
297
+ 'alibi_vit',
298
+ 'ade20k',
299
+ 'upernet',
300
+ ]),
301
+ type='WandbVisBackend'),
302
+ ]
303
+ visualizer = dict(
304
+ name='visualizer',
305
+ type='SegLocalVisualizer',
306
+ vis_backends=[
307
+ dict(type='LocalVisBackend'),
308
+ dict(
309
+ init_kwargs=dict(
310
+ name='upernet_alibi_vit_tiny_512x512_ade20k',
311
+ project='vit-segmentation',
312
+ tags=[
313
+ 'alibi_vit',
314
+ 'ade20k',
315
+ 'upernet',
316
+ ]),
317
+ type='WandbVisBackend'),
318
+ ])
319
+ work_dir = './work_dirs/upernet_alibi_vit_tiny_512x512_ade20k'