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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/segformer/mit_b4_20220624-d588d980.pth'
|
2 |
+
crop_size = (
|
3 |
+
1024,
|
4 |
+
1024,
|
5 |
+
)
|
6 |
+
data_preprocessor = dict(
|
7 |
+
bgr_to_rgb=True,
|
8 |
+
mean=[
|
9 |
+
123.675,
|
10 |
+
116.28,
|
11 |
+
103.53,
|
12 |
+
],
|
13 |
+
pad_val=0,
|
14 |
+
seg_pad_val=0,
|
15 |
+
size=(
|
16 |
+
1024,
|
17 |
+
1024,
|
18 |
+
),
|
19 |
+
std=[
|
20 |
+
58.395,
|
21 |
+
57.12,
|
22 |
+
57.375,
|
23 |
+
],
|
24 |
+
type='SegDataPreProcessor')
|
25 |
+
data_root = '/root/floor_boundary_segm/'
|
26 |
+
dataset_type = 'BoundaryDataset'
|
27 |
+
default_hooks = dict(
|
28 |
+
checkpoint=dict(by_epoch=False, interval=2000, type='CheckpointHook'),
|
29 |
+
logger=dict(interval=50, log_metric_by_epoch=False, type='LoggerHook'),
|
30 |
+
param_scheduler=dict(type='ParamSchedulerHook'),
|
31 |
+
sampler_seed=dict(type='DistSamplerSeedHook'),
|
32 |
+
timer=dict(type='IterTimerHook'),
|
33 |
+
visualization=dict(draw=True, interval=1, type='SegVisualizationHook'))
|
34 |
+
default_scope = 'mmseg'
|
35 |
+
env_cfg = dict(
|
36 |
+
cudnn_benchmark=True,
|
37 |
+
dist_cfg=dict(backend='nccl'),
|
38 |
+
mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0))
|
39 |
+
img_ratios = [
|
40 |
+
0.5,
|
41 |
+
0.75,
|
42 |
+
1.0,
|
43 |
+
1.25,
|
44 |
+
1.5,
|
45 |
+
]
|
46 |
+
load_from = '/opt/sdb/disk-sdb/layout_parser/checkpoints/iter_20000.pth'
|
47 |
+
log_level = 'INFO'
|
48 |
+
log_processor = dict(by_epoch=False)
|
49 |
+
model = dict(
|
50 |
+
backbone=dict(
|
51 |
+
attn_drop_rate=0.0,
|
52 |
+
drop_path_rate=0.1,
|
53 |
+
drop_rate=0.0,
|
54 |
+
embed_dims=64,
|
55 |
+
in_channels=3,
|
56 |
+
init_cfg=dict(
|
57 |
+
checkpoint=
|
58 |
+
'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/segformer/mit_b4_20220624-d588d980.pth',
|
59 |
+
type='Pretrained'),
|
60 |
+
mlp_ratio=4,
|
61 |
+
num_heads=[
|
62 |
+
1,
|
63 |
+
2,
|
64 |
+
5,
|
65 |
+
8,
|
66 |
+
],
|
67 |
+
num_layers=[
|
68 |
+
3,
|
69 |
+
8,
|
70 |
+
27,
|
71 |
+
3,
|
72 |
+
],
|
73 |
+
num_stages=4,
|
74 |
+
out_indices=(
|
75 |
+
0,
|
76 |
+
1,
|
77 |
+
2,
|
78 |
+
3,
|
79 |
+
),
|
80 |
+
patch_sizes=[
|
81 |
+
7,
|
82 |
+
3,
|
83 |
+
3,
|
84 |
+
3,
|
85 |
+
],
|
86 |
+
qkv_bias=True,
|
87 |
+
sr_ratios=[
|
88 |
+
8,
|
89 |
+
4,
|
90 |
+
2,
|
91 |
+
1,
|
92 |
+
],
|
93 |
+
type='MixVisionTransformer'),
|
94 |
+
data_preprocessor=dict(
|
95 |
+
bgr_to_rgb=True,
|
96 |
+
mean=[
|
97 |
+
123.675,
|
98 |
+
116.28,
|
99 |
+
103.53,
|
100 |
+
],
|
101 |
+
pad_val=0,
|
102 |
+
seg_pad_val=0,
|
103 |
+
size=(
|
104 |
+
1024,
|
105 |
+
1024,
|
106 |
+
),
|
107 |
+
std=[
|
108 |
+
58.395,
|
109 |
+
57.12,
|
110 |
+
57.375,
|
111 |
+
],
|
112 |
+
type='SegDataPreProcessor'),
|
113 |
+
decode_head=dict(
|
114 |
+
align_corners=False,
|
115 |
+
channels=256,
|
116 |
+
dropout_ratio=0.1,
|
117 |
+
in_channels=[
|
118 |
+
64,
|
119 |
+
128,
|
120 |
+
320,
|
121 |
+
512,
|
122 |
+
],
|
123 |
+
in_index=[
|
124 |
+
0,
|
125 |
+
1,
|
126 |
+
2,
|
127 |
+
3,
|
128 |
+
],
|
129 |
+
loss_decode=dict(
|
130 |
+
loss_weight=1.0, type='CrossEntropyLoss', use_sigmoid=False),
|
131 |
+
norm_cfg=dict(requires_grad=True, type='SyncBN'),
|
132 |
+
num_classes=5,
|
133 |
+
type='SegformerHead'),
|
134 |
+
pretrained=None,
|
135 |
+
test_cfg=dict(crop_size=(
|
136 |
+
1024,
|
137 |
+
1024,
|
138 |
+
), mode='slide', stride=(
|
139 |
+
768,
|
140 |
+
768,
|
141 |
+
)),
|
142 |
+
train_cfg=dict(),
|
143 |
+
type='EncoderDecoder')
|
144 |
+
norm_cfg = dict(requires_grad=True, type='SyncBN')
|
145 |
+
optim_wrapper = dict(
|
146 |
+
optimizer=dict(
|
147 |
+
betas=(
|
148 |
+
0.9,
|
149 |
+
0.999,
|
150 |
+
), lr=6e-05, type='AdamW', weight_decay=0.01),
|
151 |
+
paramwise_cfg=dict(
|
152 |
+
custom_keys=dict(
|
153 |
+
head=dict(lr_mult=10.0),
|
154 |
+
norm=dict(decay_mult=0.0),
|
155 |
+
pos_block=dict(decay_mult=0.0))),
|
156 |
+
type='OptimWrapper')
|
157 |
+
optimizer = dict(lr=0.01, momentum=0.9, type='SGD', weight_decay=0.0005)
|
158 |
+
param_scheduler = [
|
159 |
+
dict(
|
160 |
+
begin=0, by_epoch=False, end=1500, start_factor=1e-06,
|
161 |
+
type='LinearLR'),
|
162 |
+
dict(
|
163 |
+
begin=1500,
|
164 |
+
by_epoch=False,
|
165 |
+
end=160000,
|
166 |
+
eta_min=0.0,
|
167 |
+
power=1.0,
|
168 |
+
type='PolyLR'),
|
169 |
+
]
|
170 |
+
resume = True
|
171 |
+
test_cfg = dict(type='TestLoop')
|
172 |
+
test_dataloader = dict(
|
173 |
+
batch_size=1,
|
174 |
+
dataset=dict(
|
175 |
+
data_prefix=dict(img_path='img_dir/val', seg_map_path='ann_dir/val'),
|
176 |
+
data_root='/root/floor_boundary_segm/',
|
177 |
+
pipeline=[
|
178 |
+
dict(type='LoadImageFromFile'),
|
179 |
+
dict(keep_ratio=True, scale=(
|
180 |
+
1024,
|
181 |
+
1024,
|
182 |
+
), type='Resize'),
|
183 |
+
dict(type='LoadAnnotations'),
|
184 |
+
dict(type='PackSegInputs'),
|
185 |
+
],
|
186 |
+
type='BoundaryDataset'),
|
187 |
+
num_workers=4,
|
188 |
+
persistent_workers=True,
|
189 |
+
sampler=dict(shuffle=False, type='DefaultSampler'))
|
190 |
+
test_evaluator = dict(
|
191 |
+
iou_metrics=[
|
192 |
+
'mIoU',
|
193 |
+
], type='IoUMetric')
|
194 |
+
test_pipeline = [
|
195 |
+
dict(type='LoadImageFromFile'),
|
196 |
+
dict(
|
197 |
+
interpolation='bicubic',
|
198 |
+
keep_ratio=True,
|
199 |
+
scale=(
|
200 |
+
1024,
|
201 |
+
1024,
|
202 |
+
),
|
203 |
+
type='Resize'),
|
204 |
+
dict(type='LoadAnnotations'),
|
205 |
+
dict(type='PackSegInputs'),
|
206 |
+
]
|
207 |
+
train_cfg = dict(max_iters=20000, type='IterBasedTrainLoop', val_interval=2000)
|
208 |
+
train_dataloader = dict(
|
209 |
+
batch_size=1,
|
210 |
+
dataset=dict(
|
211 |
+
data_prefix=dict(
|
212 |
+
img_path='img_dir/train', seg_map_path='ann_dir/train'),
|
213 |
+
data_root='/root/floor_boundary_segm/',
|
214 |
+
pipeline=[
|
215 |
+
dict(type='LoadImageFromFile'),
|
216 |
+
dict(type='LoadAnnotations'),
|
217 |
+
dict(
|
218 |
+
keep_ratio=True,
|
219 |
+
ratio_range=(
|
220 |
+
0.5,
|
221 |
+
2.0,
|
222 |
+
),
|
223 |
+
scale=(
|
224 |
+
1024,
|
225 |
+
1024,
|
226 |
+
),
|
227 |
+
type='RandomResize'),
|
228 |
+
dict(
|
229 |
+
cat_max_ratio=0.75,
|
230 |
+
crop_size=(
|
231 |
+
1024,
|
232 |
+
1024,
|
233 |
+
),
|
234 |
+
type='RandomCrop'),
|
235 |
+
dict(prob=0.5, type='RandomFlip'),
|
236 |
+
dict(type='PhotoMetricDistortion'),
|
237 |
+
dict(type='PackSegInputs'),
|
238 |
+
],
|
239 |
+
type='BoundaryDataset'),
|
240 |
+
num_workers=2,
|
241 |
+
persistent_workers=True,
|
242 |
+
sampler=dict(shuffle=True, type='InfiniteSampler'))
|
243 |
+
train_pipeline = [
|
244 |
+
dict(type='LoadImageFromFile'),
|
245 |
+
dict(type='LoadAnnotations'),
|
246 |
+
dict(
|
247 |
+
keep_ratio=True,
|
248 |
+
ratio_range=(
|
249 |
+
0.5,
|
250 |
+
2.0,
|
251 |
+
),
|
252 |
+
scale=(
|
253 |
+
1024,
|
254 |
+
1024,
|
255 |
+
),
|
256 |
+
type='RandomResize'),
|
257 |
+
dict(cat_max_ratio=0.75, crop_size=(
|
258 |
+
1024,
|
259 |
+
1024,
|
260 |
+
), type='RandomCrop'),
|
261 |
+
dict(prob=0.5, type='RandomFlip'),
|
262 |
+
dict(type='PhotoMetricDistortion'),
|
263 |
+
dict(type='PackSegInputs'),
|
264 |
+
]
|
265 |
+
tta_model = dict(type='SegTTAModel')
|
266 |
+
tta_pipeline = [
|
267 |
+
dict(backend_args=None, type='LoadImageFromFile'),
|
268 |
+
dict(
|
269 |
+
transforms=[
|
270 |
+
[
|
271 |
+
dict(keep_ratio=True, scale_factor=0.5, type='Resize'),
|
272 |
+
dict(keep_ratio=True, scale_factor=0.75, type='Resize'),
|
273 |
+
dict(keep_ratio=True, scale_factor=1.0, type='Resize'),
|
274 |
+
dict(keep_ratio=True, scale_factor=1.25, type='Resize'),
|
275 |
+
dict(keep_ratio=True, scale_factor=1.5, type='Resize'),
|
276 |
+
dict(keep_ratio=True, scale_factor=1.75, type='Resize'),
|
277 |
+
],
|
278 |
+
[
|
279 |
+
dict(direction='horizontal', prob=0.0, type='RandomFlip'),
|
280 |
+
dict(direction='horizontal', prob=1.0, type='RandomFlip'),
|
281 |
+
],
|
282 |
+
[
|
283 |
+
dict(type='LoadAnnotations'),
|
284 |
+
],
|
285 |
+
[
|
286 |
+
dict(type='PackSegInputs'),
|
287 |
+
],
|
288 |
+
],
|
289 |
+
type='TestTimeAug'),
|
290 |
+
]
|
291 |
+
val_cfg = dict(type='ValLoop')
|
292 |
+
val_dataloader = dict(
|
293 |
+
batch_size=1,
|
294 |
+
dataset=dict(
|
295 |
+
data_prefix=dict(img_path='img_dir/val', seg_map_path='ann_dir/val'),
|
296 |
+
data_root='/root/floor_boundary_segm/',
|
297 |
+
pipeline=[
|
298 |
+
dict(type='LoadImageFromFile'),
|
299 |
+
dict(keep_ratio=True, scale=(
|
300 |
+
1024,
|
301 |
+
1024,
|
302 |
+
), type='Resize'),
|
303 |
+
dict(type='LoadAnnotations'),
|
304 |
+
dict(type='PackSegInputs'),
|
305 |
+
],
|
306 |
+
type='BoundaryDataset'),
|
307 |
+
num_workers=4,
|
308 |
+
persistent_workers=True,
|
309 |
+
sampler=dict(shuffle=False, type='DefaultSampler'))
|
310 |
+
val_evaluator = dict(
|
311 |
+
iou_metrics=[
|
312 |
+
'mIoU',
|
313 |
+
], type='IoUMetric')
|
314 |
+
val_pipeline = [
|
315 |
+
dict(type='LoadImageFromFile'),
|
316 |
+
dict(keep_ratio=True, scale=(
|
317 |
+
1024,
|
318 |
+
1024,
|
319 |
+
), type='Resize'),
|
320 |
+
dict(type='LoadAnnotations'),
|
321 |
+
dict(type='PackSegInputs'),
|
322 |
+
]
|
323 |
+
vis_backends = [
|
324 |
+
dict(type='LocalVisBackend'),
|
325 |
+
]
|
326 |
+
visualizer = dict(
|
327 |
+
name='visualizer',
|
328 |
+
type='SegLocalVisualizer',
|
329 |
+
vis_backends=[
|
330 |
+
dict(type='LocalVisBackend'),
|
331 |
+
dict(
|
332 |
+
init_kwargs=dict(
|
333 |
+
group='segformer',
|
334 |
+
name='1024x1024',
|
335 |
+
project='floorplan parser'),
|
336 |
+
type='WandbVisBackend'),
|
337 |
+
])
|