add preprocessing and dataset code
Browse files- configs/alc/semseg-pt-v3m1-0-base-scannet200-debug.py +294 -0
- configs/alc/semseg-pt-v3m1-0-base-scannet200.py +294 -0
- configs/alc/semseg-pt-v3m1-0-base-wn199-debug.py +291 -0
- configs/alc/semseg-pt-v3m1-0-base-wn199.py +291 -0
- configs/scannet/semseg-pt-v3m1-1-ppt-extreme-alc.py +782 -0
- configs/scannet200/semseg-pt-v3m1-1-ppt-extreme-alc.py +972 -0
- configs/scannetpp/semseg-pt-v3m1-2-ppt-extreme-alc.py +445 -0
- pointcept/datasets/alc.py +156 -0
- pointcept/datasets/preprocessing/alc/preprocess_arkitscenes_labelmaker_consensus.py +375 -0
configs/alc/semseg-pt-v3m1-0-base-scannet200-debug.py
ADDED
@@ -0,0 +1,294 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pointcept.datasets.preprocessing.scannet.meta_data.scannet200_constants import (
|
2 |
+
CLASS_LABELS_200,
|
3 |
+
)
|
4 |
+
|
5 |
+
|
6 |
+
_base_ = ["../_base_/default_runtime.py"]
|
7 |
+
|
8 |
+
# misc custom setting
|
9 |
+
batch_size = 2 # bs: total bs in all gpus
|
10 |
+
num_worker = 24
|
11 |
+
mix_prob = 0.8
|
12 |
+
empty_cache = False
|
13 |
+
enable_amp = True
|
14 |
+
|
15 |
+
# model settings
|
16 |
+
model = dict(
|
17 |
+
type="DefaultSegmentorV2",
|
18 |
+
num_classes=200,
|
19 |
+
backbone_out_channels=64,
|
20 |
+
backbone=dict(
|
21 |
+
type="PT-v3m1",
|
22 |
+
in_channels=6,
|
23 |
+
order=["z", "z-trans", "hilbert", "hilbert-trans"],
|
24 |
+
stride=(2, 2, 2, 2),
|
25 |
+
enc_depths=(2, 2, 2, 6, 2),
|
26 |
+
enc_channels=(32, 64, 128, 256, 512),
|
27 |
+
enc_num_head=(2, 4, 8, 16, 32),
|
28 |
+
enc_patch_size=(1024, 1024, 1024, 1024, 1024),
|
29 |
+
dec_depths=(2, 2, 2, 2),
|
30 |
+
dec_channels=(64, 64, 128, 256),
|
31 |
+
dec_num_head=(4, 4, 8, 16),
|
32 |
+
dec_patch_size=(1024, 1024, 1024, 1024),
|
33 |
+
mlp_ratio=4,
|
34 |
+
qkv_bias=True,
|
35 |
+
qk_scale=None,
|
36 |
+
attn_drop=0.0,
|
37 |
+
proj_drop=0.0,
|
38 |
+
drop_path=0.3,
|
39 |
+
shuffle_orders=True,
|
40 |
+
pre_norm=True,
|
41 |
+
enable_rpe=False,
|
42 |
+
enable_flash=True,
|
43 |
+
upcast_attention=False,
|
44 |
+
upcast_softmax=False,
|
45 |
+
cls_mode=False,
|
46 |
+
pdnorm_bn=False,
|
47 |
+
pdnorm_ln=False,
|
48 |
+
pdnorm_decouple=True,
|
49 |
+
pdnorm_adaptive=False,
|
50 |
+
pdnorm_affine=True,
|
51 |
+
pdnorm_conditions=("ScanNet", "S3DIS", "Structured3D"),
|
52 |
+
),
|
53 |
+
criteria=[
|
54 |
+
dict(type="CrossEntropyLoss", loss_weight=1.0, ignore_index=-1),
|
55 |
+
dict(type="LovaszLoss", mode="multiclass", loss_weight=1.0, ignore_index=-1),
|
56 |
+
],
|
57 |
+
)
|
58 |
+
|
59 |
+
# scheduler settings
|
60 |
+
epoch = 800
|
61 |
+
optimizer = dict(type="AdamW", lr=0.006, weight_decay=0.05)
|
62 |
+
scheduler = dict(
|
63 |
+
type="OneCycleLR",
|
64 |
+
max_lr=[0.006, 0.0006],
|
65 |
+
pct_start=0.05,
|
66 |
+
anneal_strategy="cos",
|
67 |
+
div_factor=10.0,
|
68 |
+
final_div_factor=1000.0,
|
69 |
+
)
|
70 |
+
param_dicts = [dict(keyword="block", lr=0.0006)]
|
71 |
+
|
72 |
+
# dataset settings
|
73 |
+
dataset_type = "ARKitScenesLabelMakerScanNet200Dataset"
|
74 |
+
data_root = "data/alc"
|
75 |
+
|
76 |
+
data = dict(
|
77 |
+
num_classes=200,
|
78 |
+
ignore_index=-1,
|
79 |
+
names=CLASS_LABELS_200,
|
80 |
+
train=dict(
|
81 |
+
type=dataset_type,
|
82 |
+
split="train",
|
83 |
+
data_root=data_root,
|
84 |
+
transform=[
|
85 |
+
dict(type="CenterShift", apply_z=True),
|
86 |
+
dict(type="RandomDropout", dropout_ratio=0.2, dropout_application_ratio=0.2),
|
87 |
+
# dict(type="RandomRotateTargetAngle", angle=(1/2, 1, 3/2), center=[0, 0, 0], axis="z", p=0.75),
|
88 |
+
dict(type="RandomRotate", angle=[-1, 1], axis="z", center=[0, 0, 0], p=0.5),
|
89 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="x", p=0.5),
|
90 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="y", p=0.5),
|
91 |
+
dict(type="RandomScale", scale=[0.9, 1.1]),
|
92 |
+
# dict(type="RandomShift", shift=[0.2, 0.2, 0.2]),
|
93 |
+
dict(type="RandomFlip", p=0.5),
|
94 |
+
dict(type="RandomJitter", sigma=0.005, clip=0.02),
|
95 |
+
dict(type="ElasticDistortion", distortion_params=[[0.2, 0.4], [0.8, 1.6]]),
|
96 |
+
dict(type="ChromaticAutoContrast", p=0.2, blend_factor=None),
|
97 |
+
dict(type="ChromaticTranslation", p=0.95, ratio=0.05),
|
98 |
+
dict(type="ChromaticJitter", p=0.95, std=0.05),
|
99 |
+
# dict(type="HueSaturationTranslation", hue_max=0.2, saturation_max=0.2),
|
100 |
+
# dict(type="RandomColorDrop", p=0.2, color_augment=0.0),
|
101 |
+
dict(
|
102 |
+
type="GridSample",
|
103 |
+
grid_size=0.02,
|
104 |
+
hash_type="fnv",
|
105 |
+
mode="train",
|
106 |
+
return_grid_coord=True,
|
107 |
+
),
|
108 |
+
dict(type="SphereCrop", point_max=102400, mode="random"),
|
109 |
+
dict(type="CenterShift", apply_z=False),
|
110 |
+
dict(type="NormalizeColor"),
|
111 |
+
# dict(type="ShufflePoint"),
|
112 |
+
dict(type="ToTensor"),
|
113 |
+
dict(
|
114 |
+
type="Collect",
|
115 |
+
keys=("coord", "grid_coord", "segment"),
|
116 |
+
feat_keys=("color", "normal"),
|
117 |
+
),
|
118 |
+
],
|
119 |
+
test_mode=False,
|
120 |
+
),
|
121 |
+
val=dict(
|
122 |
+
type=dataset_type,
|
123 |
+
split="val",
|
124 |
+
data_root=data_root,
|
125 |
+
transform=[
|
126 |
+
dict(type="CenterShift", apply_z=True),
|
127 |
+
dict(
|
128 |
+
type="GridSample",
|
129 |
+
grid_size=0.02,
|
130 |
+
hash_type="fnv",
|
131 |
+
mode="train",
|
132 |
+
return_grid_coord=True,
|
133 |
+
),
|
134 |
+
dict(type="CenterShift", apply_z=False),
|
135 |
+
dict(type="NormalizeColor"),
|
136 |
+
dict(type="ToTensor"),
|
137 |
+
dict(
|
138 |
+
type="Collect",
|
139 |
+
keys=("coord", "grid_coord", "segment"),
|
140 |
+
feat_keys=("color", "normal"),
|
141 |
+
),
|
142 |
+
],
|
143 |
+
test_mode=False,
|
144 |
+
),
|
145 |
+
test=dict(
|
146 |
+
type=dataset_type,
|
147 |
+
split="val",
|
148 |
+
data_root=data_root,
|
149 |
+
transform=[
|
150 |
+
dict(type="CenterShift", apply_z=True),
|
151 |
+
dict(type="NormalizeColor"),
|
152 |
+
],
|
153 |
+
test_mode=True,
|
154 |
+
test_cfg=dict(
|
155 |
+
voxelize=dict(
|
156 |
+
type="GridSample",
|
157 |
+
grid_size=0.02,
|
158 |
+
hash_type="fnv",
|
159 |
+
mode="test",
|
160 |
+
keys=("coord", "color", "normal"),
|
161 |
+
return_grid_coord=True,
|
162 |
+
),
|
163 |
+
crop=None,
|
164 |
+
post_transform=[
|
165 |
+
dict(type="CenterShift", apply_z=False),
|
166 |
+
dict(type="ToTensor"),
|
167 |
+
dict(
|
168 |
+
type="Collect",
|
169 |
+
keys=("coord", "grid_coord", "index"),
|
170 |
+
feat_keys=("color", "normal"),
|
171 |
+
),
|
172 |
+
],
|
173 |
+
aug_transform=[
|
174 |
+
[
|
175 |
+
dict(
|
176 |
+
type="RandomRotateTargetAngle",
|
177 |
+
angle=[0],
|
178 |
+
axis="z",
|
179 |
+
center=[0, 0, 0],
|
180 |
+
p=1,
|
181 |
+
)
|
182 |
+
],
|
183 |
+
[
|
184 |
+
dict(
|
185 |
+
type="RandomRotateTargetAngle",
|
186 |
+
angle=[1 / 2],
|
187 |
+
axis="z",
|
188 |
+
center=[0, 0, 0],
|
189 |
+
p=1,
|
190 |
+
)
|
191 |
+
],
|
192 |
+
[
|
193 |
+
dict(
|
194 |
+
type="RandomRotateTargetAngle",
|
195 |
+
angle=[1],
|
196 |
+
axis="z",
|
197 |
+
center=[0, 0, 0],
|
198 |
+
p=1,
|
199 |
+
)
|
200 |
+
],
|
201 |
+
[
|
202 |
+
dict(
|
203 |
+
type="RandomRotateTargetAngle",
|
204 |
+
angle=[3 / 2],
|
205 |
+
axis="z",
|
206 |
+
center=[0, 0, 0],
|
207 |
+
p=1,
|
208 |
+
)
|
209 |
+
],
|
210 |
+
[
|
211 |
+
dict(
|
212 |
+
type="RandomRotateTargetAngle",
|
213 |
+
angle=[0],
|
214 |
+
axis="z",
|
215 |
+
center=[0, 0, 0],
|
216 |
+
p=1,
|
217 |
+
),
|
218 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
219 |
+
],
|
220 |
+
[
|
221 |
+
dict(
|
222 |
+
type="RandomRotateTargetAngle",
|
223 |
+
angle=[1 / 2],
|
224 |
+
axis="z",
|
225 |
+
center=[0, 0, 0],
|
226 |
+
p=1,
|
227 |
+
),
|
228 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
229 |
+
],
|
230 |
+
[
|
231 |
+
dict(
|
232 |
+
type="RandomRotateTargetAngle",
|
233 |
+
angle=[1],
|
234 |
+
axis="z",
|
235 |
+
center=[0, 0, 0],
|
236 |
+
p=1,
|
237 |
+
),
|
238 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
239 |
+
],
|
240 |
+
[
|
241 |
+
dict(
|
242 |
+
type="RandomRotateTargetAngle",
|
243 |
+
angle=[3 / 2],
|
244 |
+
axis="z",
|
245 |
+
center=[0, 0, 0],
|
246 |
+
p=1,
|
247 |
+
),
|
248 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
249 |
+
],
|
250 |
+
[
|
251 |
+
dict(
|
252 |
+
type="RandomRotateTargetAngle",
|
253 |
+
angle=[0],
|
254 |
+
axis="z",
|
255 |
+
center=[0, 0, 0],
|
256 |
+
p=1,
|
257 |
+
),
|
258 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
259 |
+
],
|
260 |
+
[
|
261 |
+
dict(
|
262 |
+
type="RandomRotateTargetAngle",
|
263 |
+
angle=[1 / 2],
|
264 |
+
axis="z",
|
265 |
+
center=[0, 0, 0],
|
266 |
+
p=1,
|
267 |
+
),
|
268 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
269 |
+
],
|
270 |
+
[
|
271 |
+
dict(
|
272 |
+
type="RandomRotateTargetAngle",
|
273 |
+
angle=[1],
|
274 |
+
axis="z",
|
275 |
+
center=[0, 0, 0],
|
276 |
+
p=1,
|
277 |
+
),
|
278 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
279 |
+
],
|
280 |
+
[
|
281 |
+
dict(
|
282 |
+
type="RandomRotateTargetAngle",
|
283 |
+
angle=[3 / 2],
|
284 |
+
axis="z",
|
285 |
+
center=[0, 0, 0],
|
286 |
+
p=1,
|
287 |
+
),
|
288 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
289 |
+
],
|
290 |
+
[dict(type="RandomFlip", p=1)],
|
291 |
+
],
|
292 |
+
),
|
293 |
+
),
|
294 |
+
)
|
configs/alc/semseg-pt-v3m1-0-base-scannet200.py
ADDED
@@ -0,0 +1,294 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pointcept.datasets.preprocessing.scannet.meta_data.scannet200_constants import (
|
2 |
+
CLASS_LABELS_200,
|
3 |
+
)
|
4 |
+
|
5 |
+
|
6 |
+
_base_ = ["../_base_/default_runtime.py"]
|
7 |
+
|
8 |
+
# misc custom setting
|
9 |
+
batch_size = 12 # bs: total bs in all gpus
|
10 |
+
num_worker = 24
|
11 |
+
mix_prob = 0.8
|
12 |
+
empty_cache = False
|
13 |
+
enable_amp = True
|
14 |
+
|
15 |
+
# model settings
|
16 |
+
model = dict(
|
17 |
+
type="DefaultSegmentorV2",
|
18 |
+
num_classes=200,
|
19 |
+
backbone_out_channels=64,
|
20 |
+
backbone=dict(
|
21 |
+
type="PT-v3m1",
|
22 |
+
in_channels=6,
|
23 |
+
order=["z", "z-trans", "hilbert", "hilbert-trans"],
|
24 |
+
stride=(2, 2, 2, 2),
|
25 |
+
enc_depths=(2, 2, 2, 6, 2),
|
26 |
+
enc_channels=(32, 64, 128, 256, 512),
|
27 |
+
enc_num_head=(2, 4, 8, 16, 32),
|
28 |
+
enc_patch_size=(1024, 1024, 1024, 1024, 1024),
|
29 |
+
dec_depths=(2, 2, 2, 2),
|
30 |
+
dec_channels=(64, 64, 128, 256),
|
31 |
+
dec_num_head=(4, 4, 8, 16),
|
32 |
+
dec_patch_size=(1024, 1024, 1024, 1024),
|
33 |
+
mlp_ratio=4,
|
34 |
+
qkv_bias=True,
|
35 |
+
qk_scale=None,
|
36 |
+
attn_drop=0.0,
|
37 |
+
proj_drop=0.0,
|
38 |
+
drop_path=0.3,
|
39 |
+
shuffle_orders=True,
|
40 |
+
pre_norm=True,
|
41 |
+
enable_rpe=False,
|
42 |
+
enable_flash=True,
|
43 |
+
upcast_attention=False,
|
44 |
+
upcast_softmax=False,
|
45 |
+
cls_mode=False,
|
46 |
+
pdnorm_bn=False,
|
47 |
+
pdnorm_ln=False,
|
48 |
+
pdnorm_decouple=True,
|
49 |
+
pdnorm_adaptive=False,
|
50 |
+
pdnorm_affine=True,
|
51 |
+
pdnorm_conditions=("ScanNet", "S3DIS", "Structured3D", "ALC"),
|
52 |
+
),
|
53 |
+
criteria=[
|
54 |
+
dict(type="CrossEntropyLoss", loss_weight=1.0, ignore_index=-1),
|
55 |
+
dict(type="LovaszLoss", mode="multiclass", loss_weight=1.0, ignore_index=-1),
|
56 |
+
],
|
57 |
+
)
|
58 |
+
|
59 |
+
# scheduler settings
|
60 |
+
epoch = 800
|
61 |
+
optimizer = dict(type="AdamW", lr=0.00161, weight_decay=0.05)
|
62 |
+
scheduler = dict(
|
63 |
+
type="OneCycleLR",
|
64 |
+
max_lr=[0.00161, 0.000161],
|
65 |
+
pct_start=0.05,
|
66 |
+
anneal_strategy="cos",
|
67 |
+
div_factor=10.0,
|
68 |
+
final_div_factor=1000.0,
|
69 |
+
)
|
70 |
+
param_dicts = [dict(keyword="block", lr=0.0006)]
|
71 |
+
|
72 |
+
# dataset settings
|
73 |
+
dataset_type = "ARKitScenesLabelMakerScanNet200Dataset"
|
74 |
+
data_root = "data/alc"
|
75 |
+
|
76 |
+
data = dict(
|
77 |
+
num_classes=200,
|
78 |
+
ignore_index=-1,
|
79 |
+
names=CLASS_LABELS_200,
|
80 |
+
train=dict(
|
81 |
+
type=dataset_type,
|
82 |
+
split="train",
|
83 |
+
data_root=data_root,
|
84 |
+
transform=[
|
85 |
+
dict(type="CenterShift", apply_z=True),
|
86 |
+
dict(type="RandomDropout", dropout_ratio=0.2, dropout_application_ratio=0.2),
|
87 |
+
# dict(type="RandomRotateTargetAngle", angle=(1/2, 1, 3/2), center=[0, 0, 0], axis="z", p=0.75),
|
88 |
+
dict(type="RandomRotate", angle=[-1, 1], axis="z", center=[0, 0, 0], p=0.5),
|
89 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="x", p=0.5),
|
90 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="y", p=0.5),
|
91 |
+
dict(type="RandomScale", scale=[0.9, 1.1]),
|
92 |
+
# dict(type="RandomShift", shift=[0.2, 0.2, 0.2]),
|
93 |
+
dict(type="RandomFlip", p=0.5),
|
94 |
+
dict(type="RandomJitter", sigma=0.005, clip=0.02),
|
95 |
+
dict(type="ElasticDistortion", distortion_params=[[0.2, 0.4], [0.8, 1.6]]),
|
96 |
+
dict(type="ChromaticAutoContrast", p=0.2, blend_factor=None),
|
97 |
+
dict(type="ChromaticTranslation", p=0.95, ratio=0.05),
|
98 |
+
dict(type="ChromaticJitter", p=0.95, std=0.05),
|
99 |
+
# dict(type="HueSaturationTranslation", hue_max=0.2, saturation_max=0.2),
|
100 |
+
# dict(type="RandomColorDrop", p=0.2, color_augment=0.0),
|
101 |
+
dict(
|
102 |
+
type="GridSample",
|
103 |
+
grid_size=0.02,
|
104 |
+
hash_type="fnv",
|
105 |
+
mode="train",
|
106 |
+
return_grid_coord=True,
|
107 |
+
),
|
108 |
+
dict(type="SphereCrop", point_max=102400, mode="random"),
|
109 |
+
dict(type="CenterShift", apply_z=False),
|
110 |
+
dict(type="NormalizeColor"),
|
111 |
+
# dict(type="ShufflePoint"),
|
112 |
+
dict(type="ToTensor"),
|
113 |
+
dict(
|
114 |
+
type="Collect",
|
115 |
+
keys=("coord", "grid_coord", "segment"),
|
116 |
+
feat_keys=("color", "normal"),
|
117 |
+
),
|
118 |
+
],
|
119 |
+
test_mode=False,
|
120 |
+
),
|
121 |
+
val=dict(
|
122 |
+
type=dataset_type,
|
123 |
+
split="val",
|
124 |
+
data_root=data_root,
|
125 |
+
transform=[
|
126 |
+
dict(type="CenterShift", apply_z=True),
|
127 |
+
dict(
|
128 |
+
type="GridSample",
|
129 |
+
grid_size=0.02,
|
130 |
+
hash_type="fnv",
|
131 |
+
mode="train",
|
132 |
+
return_grid_coord=True,
|
133 |
+
),
|
134 |
+
dict(type="CenterShift", apply_z=False),
|
135 |
+
dict(type="NormalizeColor"),
|
136 |
+
dict(type="ToTensor"),
|
137 |
+
dict(
|
138 |
+
type="Collect",
|
139 |
+
keys=("coord", "grid_coord", "segment"),
|
140 |
+
feat_keys=("color", "normal"),
|
141 |
+
),
|
142 |
+
],
|
143 |
+
test_mode=False,
|
144 |
+
),
|
145 |
+
test=dict(
|
146 |
+
type=dataset_type,
|
147 |
+
split="val",
|
148 |
+
data_root=data_root,
|
149 |
+
transform=[
|
150 |
+
dict(type="CenterShift", apply_z=True),
|
151 |
+
dict(type="NormalizeColor"),
|
152 |
+
],
|
153 |
+
test_mode=True,
|
154 |
+
test_cfg=dict(
|
155 |
+
voxelize=dict(
|
156 |
+
type="GridSample",
|
157 |
+
grid_size=0.02,
|
158 |
+
hash_type="fnv",
|
159 |
+
mode="test",
|
160 |
+
keys=("coord", "color", "normal"),
|
161 |
+
return_grid_coord=True,
|
162 |
+
),
|
163 |
+
crop=None,
|
164 |
+
post_transform=[
|
165 |
+
dict(type="CenterShift", apply_z=False),
|
166 |
+
dict(type="ToTensor"),
|
167 |
+
dict(
|
168 |
+
type="Collect",
|
169 |
+
keys=("coord", "grid_coord", "index"),
|
170 |
+
feat_keys=("color", "normal"),
|
171 |
+
),
|
172 |
+
],
|
173 |
+
aug_transform=[
|
174 |
+
[
|
175 |
+
dict(
|
176 |
+
type="RandomRotateTargetAngle",
|
177 |
+
angle=[0],
|
178 |
+
axis="z",
|
179 |
+
center=[0, 0, 0],
|
180 |
+
p=1,
|
181 |
+
)
|
182 |
+
],
|
183 |
+
[
|
184 |
+
dict(
|
185 |
+
type="RandomRotateTargetAngle",
|
186 |
+
angle=[1 / 2],
|
187 |
+
axis="z",
|
188 |
+
center=[0, 0, 0],
|
189 |
+
p=1,
|
190 |
+
)
|
191 |
+
],
|
192 |
+
[
|
193 |
+
dict(
|
194 |
+
type="RandomRotateTargetAngle",
|
195 |
+
angle=[1],
|
196 |
+
axis="z",
|
197 |
+
center=[0, 0, 0],
|
198 |
+
p=1,
|
199 |
+
)
|
200 |
+
],
|
201 |
+
[
|
202 |
+
dict(
|
203 |
+
type="RandomRotateTargetAngle",
|
204 |
+
angle=[3 / 2],
|
205 |
+
axis="z",
|
206 |
+
center=[0, 0, 0],
|
207 |
+
p=1,
|
208 |
+
)
|
209 |
+
],
|
210 |
+
[
|
211 |
+
dict(
|
212 |
+
type="RandomRotateTargetAngle",
|
213 |
+
angle=[0],
|
214 |
+
axis="z",
|
215 |
+
center=[0, 0, 0],
|
216 |
+
p=1,
|
217 |
+
),
|
218 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
219 |
+
],
|
220 |
+
[
|
221 |
+
dict(
|
222 |
+
type="RandomRotateTargetAngle",
|
223 |
+
angle=[1 / 2],
|
224 |
+
axis="z",
|
225 |
+
center=[0, 0, 0],
|
226 |
+
p=1,
|
227 |
+
),
|
228 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
229 |
+
],
|
230 |
+
[
|
231 |
+
dict(
|
232 |
+
type="RandomRotateTargetAngle",
|
233 |
+
angle=[1],
|
234 |
+
axis="z",
|
235 |
+
center=[0, 0, 0],
|
236 |
+
p=1,
|
237 |
+
),
|
238 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
239 |
+
],
|
240 |
+
[
|
241 |
+
dict(
|
242 |
+
type="RandomRotateTargetAngle",
|
243 |
+
angle=[3 / 2],
|
244 |
+
axis="z",
|
245 |
+
center=[0, 0, 0],
|
246 |
+
p=1,
|
247 |
+
),
|
248 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
249 |
+
],
|
250 |
+
[
|
251 |
+
dict(
|
252 |
+
type="RandomRotateTargetAngle",
|
253 |
+
angle=[0],
|
254 |
+
axis="z",
|
255 |
+
center=[0, 0, 0],
|
256 |
+
p=1,
|
257 |
+
),
|
258 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
259 |
+
],
|
260 |
+
[
|
261 |
+
dict(
|
262 |
+
type="RandomRotateTargetAngle",
|
263 |
+
angle=[1 / 2],
|
264 |
+
axis="z",
|
265 |
+
center=[0, 0, 0],
|
266 |
+
p=1,
|
267 |
+
),
|
268 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
269 |
+
],
|
270 |
+
[
|
271 |
+
dict(
|
272 |
+
type="RandomRotateTargetAngle",
|
273 |
+
angle=[1],
|
274 |
+
axis="z",
|
275 |
+
center=[0, 0, 0],
|
276 |
+
p=1,
|
277 |
+
),
|
278 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
279 |
+
],
|
280 |
+
[
|
281 |
+
dict(
|
282 |
+
type="RandomRotateTargetAngle",
|
283 |
+
angle=[3 / 2],
|
284 |
+
axis="z",
|
285 |
+
center=[0, 0, 0],
|
286 |
+
p=1,
|
287 |
+
),
|
288 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
289 |
+
],
|
290 |
+
[dict(type="RandomFlip", p=1)],
|
291 |
+
],
|
292 |
+
),
|
293 |
+
),
|
294 |
+
)
|
configs/alc/semseg-pt-v3m1-0-base-wn199-debug.py
ADDED
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pointcept.datasets.preprocessing.alc.preprocess_arkitscenes_labelmaker_consensus import WORDNET_NAMES
|
2 |
+
|
3 |
+
_base_ = ["../_base_/default_runtime.py"]
|
4 |
+
|
5 |
+
# misc custom setting
|
6 |
+
batch_size = 1 # bs: total bs in all gpus
|
7 |
+
num_worker = 24
|
8 |
+
mix_prob = 0.8
|
9 |
+
empty_cache = False
|
10 |
+
enable_amp = True
|
11 |
+
|
12 |
+
# model settings
|
13 |
+
model = dict(
|
14 |
+
type="DefaultSegmentorV2",
|
15 |
+
num_classes=185,
|
16 |
+
backbone_out_channels=64,
|
17 |
+
backbone=dict(
|
18 |
+
type="PT-v3m1",
|
19 |
+
in_channels=6,
|
20 |
+
order=["z", "z-trans", "hilbert", "hilbert-trans"],
|
21 |
+
stride=(2, 2, 2, 2),
|
22 |
+
enc_depths=(2, 2, 2, 6, 2),
|
23 |
+
enc_channels=(32, 64, 128, 256, 512),
|
24 |
+
enc_num_head=(2, 4, 8, 16, 32),
|
25 |
+
enc_patch_size=(1024, 1024, 1024, 1024, 1024),
|
26 |
+
dec_depths=(2, 2, 2, 2),
|
27 |
+
dec_channels=(64, 64, 128, 256),
|
28 |
+
dec_num_head=(4, 4, 8, 16),
|
29 |
+
dec_patch_size=(1024, 1024, 1024, 1024),
|
30 |
+
mlp_ratio=4,
|
31 |
+
qkv_bias=True,
|
32 |
+
qk_scale=None,
|
33 |
+
attn_drop=0.0,
|
34 |
+
proj_drop=0.0,
|
35 |
+
drop_path=0.3,
|
36 |
+
shuffle_orders=True,
|
37 |
+
pre_norm=True,
|
38 |
+
enable_rpe=False,
|
39 |
+
enable_flash=True,
|
40 |
+
upcast_attention=False,
|
41 |
+
upcast_softmax=False,
|
42 |
+
cls_mode=False,
|
43 |
+
pdnorm_bn=False,
|
44 |
+
pdnorm_ln=False,
|
45 |
+
pdnorm_decouple=True,
|
46 |
+
pdnorm_adaptive=False,
|
47 |
+
pdnorm_affine=True,
|
48 |
+
pdnorm_conditions=("ScanNet", "S3DIS", "Structured3D"),
|
49 |
+
),
|
50 |
+
criteria=[
|
51 |
+
dict(type="CrossEntropyLoss", loss_weight=1.0, ignore_index=-1),
|
52 |
+
dict(type="LovaszLoss", mode="multiclass", loss_weight=1.0, ignore_index=-1),
|
53 |
+
],
|
54 |
+
)
|
55 |
+
|
56 |
+
# scheduler settings
|
57 |
+
epoch = 800
|
58 |
+
optimizer = dict(type="AdamW", lr=0.006, weight_decay=0.05)
|
59 |
+
scheduler = dict(
|
60 |
+
type="OneCycleLR",
|
61 |
+
max_lr=[0.006, 0.0006],
|
62 |
+
pct_start=0.05,
|
63 |
+
anneal_strategy="cos",
|
64 |
+
div_factor=10.0,
|
65 |
+
final_div_factor=1000.0,
|
66 |
+
)
|
67 |
+
param_dicts = [dict(keyword="block", lr=0.0006)]
|
68 |
+
|
69 |
+
# dataset settings
|
70 |
+
dataset_type = "ARKitScenesLabelMakerConsensusDataset"
|
71 |
+
data_root = "data/alc"
|
72 |
+
|
73 |
+
data = dict(
|
74 |
+
num_classes=185,
|
75 |
+
ignore_index=-1,
|
76 |
+
names=WORDNET_NAMES,
|
77 |
+
train=dict(
|
78 |
+
type=dataset_type,
|
79 |
+
split="train",
|
80 |
+
data_root=data_root,
|
81 |
+
transform=[
|
82 |
+
dict(type="CenterShift", apply_z=True),
|
83 |
+
dict(type="RandomDropout", dropout_ratio=0.2, dropout_application_ratio=0.2),
|
84 |
+
# dict(type="RandomRotateTargetAngle", angle=(1/2, 1, 3/2), center=[0, 0, 0], axis="z", p=0.75),
|
85 |
+
dict(type="RandomRotate", angle=[-1, 1], axis="z", center=[0, 0, 0], p=0.5),
|
86 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="x", p=0.5),
|
87 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="y", p=0.5),
|
88 |
+
dict(type="RandomScale", scale=[0.9, 1.1]),
|
89 |
+
# dict(type="RandomShift", shift=[0.2, 0.2, 0.2]),
|
90 |
+
dict(type="RandomFlip", p=0.5),
|
91 |
+
dict(type="RandomJitter", sigma=0.005, clip=0.02),
|
92 |
+
dict(type="ElasticDistortion", distortion_params=[[0.2, 0.4], [0.8, 1.6]]),
|
93 |
+
dict(type="ChromaticAutoContrast", p=0.2, blend_factor=None),
|
94 |
+
dict(type="ChromaticTranslation", p=0.95, ratio=0.05),
|
95 |
+
dict(type="ChromaticJitter", p=0.95, std=0.05),
|
96 |
+
# dict(type="HueSaturationTranslation", hue_max=0.2, saturation_max=0.2),
|
97 |
+
# dict(type="RandomColorDrop", p=0.2, color_augment=0.0),
|
98 |
+
dict(
|
99 |
+
type="GridSample",
|
100 |
+
grid_size=0.02,
|
101 |
+
hash_type="fnv",
|
102 |
+
mode="train",
|
103 |
+
return_grid_coord=True,
|
104 |
+
),
|
105 |
+
dict(type="SphereCrop", point_max=102400, mode="random"),
|
106 |
+
dict(type="CenterShift", apply_z=False),
|
107 |
+
dict(type="NormalizeColor"),
|
108 |
+
# dict(type="ShufflePoint"),
|
109 |
+
dict(type="ToTensor"),
|
110 |
+
dict(
|
111 |
+
type="Collect",
|
112 |
+
keys=("coord", "grid_coord", "segment"),
|
113 |
+
feat_keys=("color", "normal"),
|
114 |
+
),
|
115 |
+
],
|
116 |
+
test_mode=False,
|
117 |
+
),
|
118 |
+
val=dict(
|
119 |
+
type=dataset_type,
|
120 |
+
split="val",
|
121 |
+
data_root=data_root,
|
122 |
+
transform=[
|
123 |
+
dict(type="CenterShift", apply_z=True),
|
124 |
+
dict(
|
125 |
+
type="GridSample",
|
126 |
+
grid_size=0.02,
|
127 |
+
hash_type="fnv",
|
128 |
+
mode="train",
|
129 |
+
return_grid_coord=True,
|
130 |
+
),
|
131 |
+
dict(type="CenterShift", apply_z=False),
|
132 |
+
dict(type="NormalizeColor"),
|
133 |
+
dict(type="ToTensor"),
|
134 |
+
dict(
|
135 |
+
type="Collect",
|
136 |
+
keys=("coord", "grid_coord", "segment"),
|
137 |
+
feat_keys=("color", "normal"),
|
138 |
+
),
|
139 |
+
],
|
140 |
+
test_mode=False,
|
141 |
+
),
|
142 |
+
test=dict(
|
143 |
+
type=dataset_type,
|
144 |
+
split="val",
|
145 |
+
data_root=data_root,
|
146 |
+
transform=[
|
147 |
+
dict(type="CenterShift", apply_z=True),
|
148 |
+
dict(type="NormalizeColor"),
|
149 |
+
],
|
150 |
+
test_mode=True,
|
151 |
+
test_cfg=dict(
|
152 |
+
voxelize=dict(
|
153 |
+
type="GridSample",
|
154 |
+
grid_size=0.02,
|
155 |
+
hash_type="fnv",
|
156 |
+
mode="test",
|
157 |
+
keys=("coord", "color", "normal"),
|
158 |
+
return_grid_coord=True,
|
159 |
+
),
|
160 |
+
crop=None,
|
161 |
+
post_transform=[
|
162 |
+
dict(type="CenterShift", apply_z=False),
|
163 |
+
dict(type="ToTensor"),
|
164 |
+
dict(
|
165 |
+
type="Collect",
|
166 |
+
keys=("coord", "grid_coord", "index"),
|
167 |
+
feat_keys=("color", "normal"),
|
168 |
+
),
|
169 |
+
],
|
170 |
+
aug_transform=[
|
171 |
+
[
|
172 |
+
dict(
|
173 |
+
type="RandomRotateTargetAngle",
|
174 |
+
angle=[0],
|
175 |
+
axis="z",
|
176 |
+
center=[0, 0, 0],
|
177 |
+
p=1,
|
178 |
+
)
|
179 |
+
],
|
180 |
+
[
|
181 |
+
dict(
|
182 |
+
type="RandomRotateTargetAngle",
|
183 |
+
angle=[1 / 2],
|
184 |
+
axis="z",
|
185 |
+
center=[0, 0, 0],
|
186 |
+
p=1,
|
187 |
+
)
|
188 |
+
],
|
189 |
+
[
|
190 |
+
dict(
|
191 |
+
type="RandomRotateTargetAngle",
|
192 |
+
angle=[1],
|
193 |
+
axis="z",
|
194 |
+
center=[0, 0, 0],
|
195 |
+
p=1,
|
196 |
+
)
|
197 |
+
],
|
198 |
+
[
|
199 |
+
dict(
|
200 |
+
type="RandomRotateTargetAngle",
|
201 |
+
angle=[3 / 2],
|
202 |
+
axis="z",
|
203 |
+
center=[0, 0, 0],
|
204 |
+
p=1,
|
205 |
+
)
|
206 |
+
],
|
207 |
+
[
|
208 |
+
dict(
|
209 |
+
type="RandomRotateTargetAngle",
|
210 |
+
angle=[0],
|
211 |
+
axis="z",
|
212 |
+
center=[0, 0, 0],
|
213 |
+
p=1,
|
214 |
+
),
|
215 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
216 |
+
],
|
217 |
+
[
|
218 |
+
dict(
|
219 |
+
type="RandomRotateTargetAngle",
|
220 |
+
angle=[1 / 2],
|
221 |
+
axis="z",
|
222 |
+
center=[0, 0, 0],
|
223 |
+
p=1,
|
224 |
+
),
|
225 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
226 |
+
],
|
227 |
+
[
|
228 |
+
dict(
|
229 |
+
type="RandomRotateTargetAngle",
|
230 |
+
angle=[1],
|
231 |
+
axis="z",
|
232 |
+
center=[0, 0, 0],
|
233 |
+
p=1,
|
234 |
+
),
|
235 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
236 |
+
],
|
237 |
+
[
|
238 |
+
dict(
|
239 |
+
type="RandomRotateTargetAngle",
|
240 |
+
angle=[3 / 2],
|
241 |
+
axis="z",
|
242 |
+
center=[0, 0, 0],
|
243 |
+
p=1,
|
244 |
+
),
|
245 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
246 |
+
],
|
247 |
+
[
|
248 |
+
dict(
|
249 |
+
type="RandomRotateTargetAngle",
|
250 |
+
angle=[0],
|
251 |
+
axis="z",
|
252 |
+
center=[0, 0, 0],
|
253 |
+
p=1,
|
254 |
+
),
|
255 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
256 |
+
],
|
257 |
+
[
|
258 |
+
dict(
|
259 |
+
type="RandomRotateTargetAngle",
|
260 |
+
angle=[1 / 2],
|
261 |
+
axis="z",
|
262 |
+
center=[0, 0, 0],
|
263 |
+
p=1,
|
264 |
+
),
|
265 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
266 |
+
],
|
267 |
+
[
|
268 |
+
dict(
|
269 |
+
type="RandomRotateTargetAngle",
|
270 |
+
angle=[1],
|
271 |
+
axis="z",
|
272 |
+
center=[0, 0, 0],
|
273 |
+
p=1,
|
274 |
+
),
|
275 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
276 |
+
],
|
277 |
+
[
|
278 |
+
dict(
|
279 |
+
type="RandomRotateTargetAngle",
|
280 |
+
angle=[3 / 2],
|
281 |
+
axis="z",
|
282 |
+
center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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pointcept.datasets.preprocessing.alc.preprocess_arkitscenes_labelmaker_consensus import WORDNET_NAMES
|
2 |
+
|
3 |
+
_base_ = ["../_base_/default_runtime.py"]
|
4 |
+
|
5 |
+
# misc custom setting
|
6 |
+
batch_size = 12 # bs: total bs in all gpus
|
7 |
+
num_worker = 24
|
8 |
+
mix_prob = 0.8
|
9 |
+
empty_cache = False
|
10 |
+
enable_amp = True
|
11 |
+
|
12 |
+
# model settings
|
13 |
+
model = dict(
|
14 |
+
type="DefaultSegmentorV2",
|
15 |
+
num_classes=185,
|
16 |
+
backbone_out_channels=64,
|
17 |
+
backbone=dict(
|
18 |
+
type="PT-v3m1",
|
19 |
+
in_channels=6,
|
20 |
+
order=["z", "z-trans", "hilbert", "hilbert-trans"],
|
21 |
+
stride=(2, 2, 2, 2),
|
22 |
+
enc_depths=(2, 2, 2, 6, 2),
|
23 |
+
enc_channels=(32, 64, 128, 256, 512),
|
24 |
+
enc_num_head=(2, 4, 8, 16, 32),
|
25 |
+
enc_patch_size=(1024, 1024, 1024, 1024, 1024),
|
26 |
+
dec_depths=(2, 2, 2, 2),
|
27 |
+
dec_channels=(64, 64, 128, 256),
|
28 |
+
dec_num_head=(4, 4, 8, 16),
|
29 |
+
dec_patch_size=(1024, 1024, 1024, 1024),
|
30 |
+
mlp_ratio=4,
|
31 |
+
qkv_bias=True,
|
32 |
+
qk_scale=None,
|
33 |
+
attn_drop=0.0,
|
34 |
+
proj_drop=0.0,
|
35 |
+
drop_path=0.3,
|
36 |
+
shuffle_orders=True,
|
37 |
+
pre_norm=True,
|
38 |
+
enable_rpe=False,
|
39 |
+
enable_flash=True,
|
40 |
+
upcast_attention=False,
|
41 |
+
upcast_softmax=False,
|
42 |
+
cls_mode=False,
|
43 |
+
pdnorm_bn=False,
|
44 |
+
pdnorm_ln=False,
|
45 |
+
pdnorm_decouple=True,
|
46 |
+
pdnorm_adaptive=False,
|
47 |
+
pdnorm_affine=True,
|
48 |
+
pdnorm_conditions=("ScanNet", "S3DIS", "Structured3D"),
|
49 |
+
),
|
50 |
+
criteria=[
|
51 |
+
dict(type="CrossEntropyLoss", loss_weight=1.0, ignore_index=-1),
|
52 |
+
dict(type="LovaszLoss", mode="multiclass", loss_weight=1.0, ignore_index=-1),
|
53 |
+
],
|
54 |
+
)
|
55 |
+
|
56 |
+
# scheduler settings
|
57 |
+
epoch = 800
|
58 |
+
optimizer = dict(type="AdamW", lr=0.006, weight_decay=0.05)
|
59 |
+
scheduler = dict(
|
60 |
+
type="OneCycleLR",
|
61 |
+
max_lr=[0.006, 0.0006],
|
62 |
+
pct_start=0.05,
|
63 |
+
anneal_strategy="cos",
|
64 |
+
div_factor=10.0,
|
65 |
+
final_div_factor=1000.0,
|
66 |
+
)
|
67 |
+
param_dicts = [dict(keyword="block", lr=0.0006)]
|
68 |
+
|
69 |
+
# dataset settings
|
70 |
+
dataset_type = "ARKitScenesLabelMakerConsensusDataset"
|
71 |
+
data_root = "data/alc"
|
72 |
+
|
73 |
+
data = dict(
|
74 |
+
num_classes=185,
|
75 |
+
ignore_index=-1,
|
76 |
+
names=WORDNET_NAMES,
|
77 |
+
train=dict(
|
78 |
+
type=dataset_type,
|
79 |
+
split="train",
|
80 |
+
data_root=data_root,
|
81 |
+
transform=[
|
82 |
+
dict(type="CenterShift", apply_z=True),
|
83 |
+
dict(type="RandomDropout", dropout_ratio=0.2, dropout_application_ratio=0.2),
|
84 |
+
# dict(type="RandomRotateTargetAngle", angle=(1/2, 1, 3/2), center=[0, 0, 0], axis="z", p=0.75),
|
85 |
+
dict(type="RandomRotate", angle=[-1, 1], axis="z", center=[0, 0, 0], p=0.5),
|
86 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="x", p=0.5),
|
87 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="y", p=0.5),
|
88 |
+
dict(type="RandomScale", scale=[0.9, 1.1]),
|
89 |
+
# dict(type="RandomShift", shift=[0.2, 0.2, 0.2]),
|
90 |
+
dict(type="RandomFlip", p=0.5),
|
91 |
+
dict(type="RandomJitter", sigma=0.005, clip=0.02),
|
92 |
+
dict(type="ElasticDistortion", distortion_params=[[0.2, 0.4], [0.8, 1.6]]),
|
93 |
+
dict(type="ChromaticAutoContrast", p=0.2, blend_factor=None),
|
94 |
+
dict(type="ChromaticTranslation", p=0.95, ratio=0.05),
|
95 |
+
dict(type="ChromaticJitter", p=0.95, std=0.05),
|
96 |
+
# dict(type="HueSaturationTranslation", hue_max=0.2, saturation_max=0.2),
|
97 |
+
# dict(type="RandomColorDrop", p=0.2, color_augment=0.0),
|
98 |
+
dict(
|
99 |
+
type="GridSample",
|
100 |
+
grid_size=0.02,
|
101 |
+
hash_type="fnv",
|
102 |
+
mode="train",
|
103 |
+
return_grid_coord=True,
|
104 |
+
),
|
105 |
+
dict(type="SphereCrop", point_max=102400, mode="random"),
|
106 |
+
dict(type="CenterShift", apply_z=False),
|
107 |
+
dict(type="NormalizeColor"),
|
108 |
+
# dict(type="ShufflePoint"),
|
109 |
+
dict(type="ToTensor"),
|
110 |
+
dict(
|
111 |
+
type="Collect",
|
112 |
+
keys=("coord", "grid_coord", "segment"),
|
113 |
+
feat_keys=("color", "normal"),
|
114 |
+
),
|
115 |
+
],
|
116 |
+
test_mode=False,
|
117 |
+
),
|
118 |
+
val=dict(
|
119 |
+
type=dataset_type,
|
120 |
+
split="val",
|
121 |
+
data_root=data_root,
|
122 |
+
transform=[
|
123 |
+
dict(type="CenterShift", apply_z=True),
|
124 |
+
dict(
|
125 |
+
type="GridSample",
|
126 |
+
grid_size=0.02,
|
127 |
+
hash_type="fnv",
|
128 |
+
mode="train",
|
129 |
+
return_grid_coord=True,
|
130 |
+
),
|
131 |
+
dict(type="CenterShift", apply_z=False),
|
132 |
+
dict(type="NormalizeColor"),
|
133 |
+
dict(type="ToTensor"),
|
134 |
+
dict(
|
135 |
+
type="Collect",
|
136 |
+
keys=("coord", "grid_coord", "segment"),
|
137 |
+
feat_keys=("color", "normal"),
|
138 |
+
),
|
139 |
+
],
|
140 |
+
test_mode=False,
|
141 |
+
),
|
142 |
+
test=dict(
|
143 |
+
type=dataset_type,
|
144 |
+
split="val",
|
145 |
+
data_root=data_root,
|
146 |
+
transform=[
|
147 |
+
dict(type="CenterShift", apply_z=True),
|
148 |
+
dict(type="NormalizeColor"),
|
149 |
+
],
|
150 |
+
test_mode=True,
|
151 |
+
test_cfg=dict(
|
152 |
+
voxelize=dict(
|
153 |
+
type="GridSample",
|
154 |
+
grid_size=0.02,
|
155 |
+
hash_type="fnv",
|
156 |
+
mode="test",
|
157 |
+
keys=("coord", "color", "normal"),
|
158 |
+
return_grid_coord=True,
|
159 |
+
),
|
160 |
+
crop=None,
|
161 |
+
post_transform=[
|
162 |
+
dict(type="CenterShift", apply_z=False),
|
163 |
+
dict(type="ToTensor"),
|
164 |
+
dict(
|
165 |
+
type="Collect",
|
166 |
+
keys=("coord", "grid_coord", "index"),
|
167 |
+
feat_keys=("color", "normal"),
|
168 |
+
),
|
169 |
+
],
|
170 |
+
aug_transform=[
|
171 |
+
[
|
172 |
+
dict(
|
173 |
+
type="RandomRotateTargetAngle",
|
174 |
+
angle=[0],
|
175 |
+
axis="z",
|
176 |
+
center=[0, 0, 0],
|
177 |
+
p=1,
|
178 |
+
)
|
179 |
+
],
|
180 |
+
[
|
181 |
+
dict(
|
182 |
+
type="RandomRotateTargetAngle",
|
183 |
+
angle=[1 / 2],
|
184 |
+
axis="z",
|
185 |
+
center=[0, 0, 0],
|
186 |
+
p=1,
|
187 |
+
)
|
188 |
+
],
|
189 |
+
[
|
190 |
+
dict(
|
191 |
+
type="RandomRotateTargetAngle",
|
192 |
+
angle=[1],
|
193 |
+
axis="z",
|
194 |
+
center=[0, 0, 0],
|
195 |
+
p=1,
|
196 |
+
)
|
197 |
+
],
|
198 |
+
[
|
199 |
+
dict(
|
200 |
+
type="RandomRotateTargetAngle",
|
201 |
+
angle=[3 / 2],
|
202 |
+
axis="z",
|
203 |
+
center=[0, 0, 0],
|
204 |
+
p=1,
|
205 |
+
)
|
206 |
+
],
|
207 |
+
[
|
208 |
+
dict(
|
209 |
+
type="RandomRotateTargetAngle",
|
210 |
+
angle=[0],
|
211 |
+
axis="z",
|
212 |
+
center=[0, 0, 0],
|
213 |
+
p=1,
|
214 |
+
),
|
215 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
216 |
+
],
|
217 |
+
[
|
218 |
+
dict(
|
219 |
+
type="RandomRotateTargetAngle",
|
220 |
+
angle=[1 / 2],
|
221 |
+
axis="z",
|
222 |
+
center=[0, 0, 0],
|
223 |
+
p=1,
|
224 |
+
),
|
225 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
226 |
+
],
|
227 |
+
[
|
228 |
+
dict(
|
229 |
+
type="RandomRotateTargetAngle",
|
230 |
+
angle=[1],
|
231 |
+
axis="z",
|
232 |
+
center=[0, 0, 0],
|
233 |
+
p=1,
|
234 |
+
),
|
235 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
236 |
+
],
|
237 |
+
[
|
238 |
+
dict(
|
239 |
+
type="RandomRotateTargetAngle",
|
240 |
+
angle=[3 / 2],
|
241 |
+
axis="z",
|
242 |
+
center=[0, 0, 0],
|
243 |
+
p=1,
|
244 |
+
),
|
245 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
246 |
+
],
|
247 |
+
[
|
248 |
+
dict(
|
249 |
+
type="RandomRotateTargetAngle",
|
250 |
+
angle=[0],
|
251 |
+
axis="z",
|
252 |
+
center=[0, 0, 0],
|
253 |
+
p=1,
|
254 |
+
),
|
255 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
256 |
+
],
|
257 |
+
[
|
258 |
+
dict(
|
259 |
+
type="RandomRotateTargetAngle",
|
260 |
+
angle=[1 / 2],
|
261 |
+
axis="z",
|
262 |
+
center=[0, 0, 0],
|
263 |
+
p=1,
|
264 |
+
),
|
265 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
266 |
+
],
|
267 |
+
[
|
268 |
+
dict(
|
269 |
+
type="RandomRotateTargetAngle",
|
270 |
+
angle=[1],
|
271 |
+
axis="z",
|
272 |
+
center=[0, 0, 0],
|
273 |
+
p=1,
|
274 |
+
),
|
275 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
276 |
+
],
|
277 |
+
[
|
278 |
+
dict(
|
279 |
+
type="RandomRotateTargetAngle",
|
280 |
+
angle=[3 / 2],
|
281 |
+
axis="z",
|
282 |
+
center=[0, 0, 0],
|
283 |
+
p=1,
|
284 |
+
),
|
285 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
286 |
+
],
|
287 |
+
[dict(type="RandomFlip", p=1)],
|
288 |
+
],
|
289 |
+
),
|
290 |
+
),
|
291 |
+
)
|
configs/scannet/semseg-pt-v3m1-1-ppt-extreme-alc.py
ADDED
@@ -0,0 +1,782 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = ["../_base_/default_runtime.py"]
|
2 |
+
|
3 |
+
# misc custom setting
|
4 |
+
batch_size = 24 # bs: total bs in all gpus
|
5 |
+
num_worker = 48
|
6 |
+
mix_prob = 0.8
|
7 |
+
empty_cache = False
|
8 |
+
enable_amp = True
|
9 |
+
find_unused_parameters = True
|
10 |
+
|
11 |
+
# trainer
|
12 |
+
train = dict(
|
13 |
+
type="MultiDatasetTrainer",
|
14 |
+
)
|
15 |
+
|
16 |
+
# model
|
17 |
+
model = dict(
|
18 |
+
type="PPT-v1m1",
|
19 |
+
backbone=dict(
|
20 |
+
type="PT-v3m1",
|
21 |
+
in_channels=6,
|
22 |
+
order=("z", "z-trans", "hilbert", "hilbert-trans"),
|
23 |
+
stride=(2, 2, 2, 2),
|
24 |
+
enc_depths=(3, 3, 3, 6, 3),
|
25 |
+
enc_channels=(48, 96, 192, 384, 512),
|
26 |
+
enc_num_head=(3, 6, 12, 24, 32),
|
27 |
+
enc_patch_size=(1024, 1024, 1024, 1024, 1024),
|
28 |
+
dec_depths=(3, 3, 3, 3),
|
29 |
+
dec_channels=(64, 96, 192, 384),
|
30 |
+
dec_num_head=(4, 6, 12, 24),
|
31 |
+
dec_patch_size=(1024, 1024, 1024, 1024),
|
32 |
+
mlp_ratio=4,
|
33 |
+
qkv_bias=True,
|
34 |
+
qk_scale=None,
|
35 |
+
attn_drop=0.0,
|
36 |
+
proj_drop=0.0,
|
37 |
+
drop_path=0.3,
|
38 |
+
shuffle_orders=True,
|
39 |
+
pre_norm=True,
|
40 |
+
enable_rpe=False,
|
41 |
+
enable_flash=True,
|
42 |
+
upcast_attention=False,
|
43 |
+
upcast_softmax=False,
|
44 |
+
cls_mode=False,
|
45 |
+
pdnorm_bn=True,
|
46 |
+
pdnorm_ln=True,
|
47 |
+
pdnorm_decouple=True,
|
48 |
+
pdnorm_adaptive=False,
|
49 |
+
pdnorm_affine=True,
|
50 |
+
pdnorm_conditions=(
|
51 |
+
"S3DIS",
|
52 |
+
"ScanNet",
|
53 |
+
"Structured3D",
|
54 |
+
"ALC",
|
55 |
+
# "ScanNet200"
|
56 |
+
),
|
57 |
+
),
|
58 |
+
criteria=[dict(type="CrossEntropyLoss", loss_weight=1.0, ignore_index=-1), dict(type="LovaszLoss", mode="multiclass", loss_weight=1.0, ignore_index=-1)],
|
59 |
+
backbone_out_channels=64,
|
60 |
+
context_channels=256,
|
61 |
+
conditions=(
|
62 |
+
"S3DIS",
|
63 |
+
"ScanNet",
|
64 |
+
"Structured3D",
|
65 |
+
"ALC",
|
66 |
+
# "ScanNet200"
|
67 |
+
),
|
68 |
+
template="[x]",
|
69 |
+
clip_model="ViT-B/16",
|
70 |
+
class_name=(
|
71 |
+
"wall",
|
72 |
+
"floor",
|
73 |
+
"cabinet",
|
74 |
+
"bed",
|
75 |
+
"chair",
|
76 |
+
"sofa",
|
77 |
+
"table",
|
78 |
+
"door",
|
79 |
+
"window",
|
80 |
+
"bookshelf",
|
81 |
+
"bookcase",
|
82 |
+
"picture",
|
83 |
+
"counter",
|
84 |
+
"desk",
|
85 |
+
"shelves",
|
86 |
+
"curtain",
|
87 |
+
"dresser",
|
88 |
+
"pillow",
|
89 |
+
"mirror",
|
90 |
+
"ceiling",
|
91 |
+
"refrigerator",
|
92 |
+
"television",
|
93 |
+
"shower curtain",
|
94 |
+
"nightstand",
|
95 |
+
"toilet",
|
96 |
+
"sink",
|
97 |
+
"lamp",
|
98 |
+
"bathtub",
|
99 |
+
"garbagebin",
|
100 |
+
"board",
|
101 |
+
"beam",
|
102 |
+
"column",
|
103 |
+
"clutter",
|
104 |
+
"otherstructure",
|
105 |
+
"otherfurniture",
|
106 |
+
"otherprop",
|
107 |
+
"book",
|
108 |
+
"ashcan",
|
109 |
+
"display",
|
110 |
+
"cushion",
|
111 |
+
"box",
|
112 |
+
"doorframe",
|
113 |
+
"swivel chair",
|
114 |
+
"towel",
|
115 |
+
"backpack",
|
116 |
+
"chest of drawers",
|
117 |
+
"apparel",
|
118 |
+
"armchair",
|
119 |
+
"plant",
|
120 |
+
"radiator",
|
121 |
+
"toilet tissue",
|
122 |
+
"shoe",
|
123 |
+
"bag",
|
124 |
+
"bottle",
|
125 |
+
"countertop",
|
126 |
+
"coffee table",
|
127 |
+
"computer keyboard",
|
128 |
+
"fridge",
|
129 |
+
"stool",
|
130 |
+
"computer",
|
131 |
+
"mug",
|
132 |
+
"telephone",
|
133 |
+
"light",
|
134 |
+
"jacket",
|
135 |
+
"microwave",
|
136 |
+
"footstool",
|
137 |
+
"baggage",
|
138 |
+
"laptop",
|
139 |
+
"printer",
|
140 |
+
"shower stall",
|
141 |
+
"soap dispenser",
|
142 |
+
"stove",
|
143 |
+
"fan",
|
144 |
+
"paper",
|
145 |
+
"stand",
|
146 |
+
"bench",
|
147 |
+
"wardrobe",
|
148 |
+
"blanket",
|
149 |
+
"booth",
|
150 |
+
"duplicator",
|
151 |
+
"bar",
|
152 |
+
"soap dish",
|
153 |
+
"switch",
|
154 |
+
"coffee maker",
|
155 |
+
"decoration",
|
156 |
+
"range hood",
|
157 |
+
"blackboard",
|
158 |
+
"clock",
|
159 |
+
"railing",
|
160 |
+
"mat",
|
161 |
+
"seat",
|
162 |
+
"bannister",
|
163 |
+
"container",
|
164 |
+
"mouse",
|
165 |
+
"person",
|
166 |
+
"stairway",
|
167 |
+
"basket",
|
168 |
+
"dumbbell",
|
169 |
+
"bucket",
|
170 |
+
"windowsill",
|
171 |
+
"signboard",
|
172 |
+
"dishwasher",
|
173 |
+
"loudspeaker",
|
174 |
+
"washer",
|
175 |
+
"paper towel",
|
176 |
+
"clothes hamper",
|
177 |
+
"piano",
|
178 |
+
"sack",
|
179 |
+
"handcart",
|
180 |
+
"blind",
|
181 |
+
"dish rack",
|
182 |
+
"mailbox",
|
183 |
+
"bicycle",
|
184 |
+
"ladder",
|
185 |
+
"rack",
|
186 |
+
"tray",
|
187 |
+
"toaster",
|
188 |
+
"paper cutter",
|
189 |
+
"plunger",
|
190 |
+
"dryer",
|
191 |
+
"guitar",
|
192 |
+
"fire extinguisher",
|
193 |
+
"pitcher",
|
194 |
+
"pipe",
|
195 |
+
"plate",
|
196 |
+
"vacuum",
|
197 |
+
"bowl",
|
198 |
+
"hat",
|
199 |
+
"rod",
|
200 |
+
"water cooler",
|
201 |
+
"kettle",
|
202 |
+
"oven",
|
203 |
+
"scale",
|
204 |
+
"broom",
|
205 |
+
"hand blower",
|
206 |
+
"coatrack",
|
207 |
+
"teddy",
|
208 |
+
"alarm clock",
|
209 |
+
"ironing board",
|
210 |
+
"fire alarm",
|
211 |
+
"machine",
|
212 |
+
"music stand",
|
213 |
+
"fireplace",
|
214 |
+
"furniture",
|
215 |
+
"vase",
|
216 |
+
"vent",
|
217 |
+
"candle",
|
218 |
+
"crate",
|
219 |
+
"dustpan",
|
220 |
+
"earphone",
|
221 |
+
"jar",
|
222 |
+
"projector",
|
223 |
+
"gat",
|
224 |
+
"step",
|
225 |
+
"step stool",
|
226 |
+
"vending machine",
|
227 |
+
"coat",
|
228 |
+
"coat hanger",
|
229 |
+
"drinking fountain",
|
230 |
+
"hamper",
|
231 |
+
"thermostat",
|
232 |
+
"banner",
|
233 |
+
"iron",
|
234 |
+
"soap",
|
235 |
+
"chopping board",
|
236 |
+
"kitchen island",
|
237 |
+
"shirt",
|
238 |
+
"sleeping bag",
|
239 |
+
"tire",
|
240 |
+
"toothbrush",
|
241 |
+
"bathrobe",
|
242 |
+
"faucet",
|
243 |
+
"slipper",
|
244 |
+
"thermos",
|
245 |
+
"tripod",
|
246 |
+
"dispenser",
|
247 |
+
"heater",
|
248 |
+
"pool table",
|
249 |
+
"remote control",
|
250 |
+
"stapler",
|
251 |
+
"treadmill",
|
252 |
+
"beanbag",
|
253 |
+
"dartboard",
|
254 |
+
"metronome",
|
255 |
+
"rope",
|
256 |
+
"sewing machine",
|
257 |
+
"shredder",
|
258 |
+
"toolbox",
|
259 |
+
"water heater",
|
260 |
+
"brush",
|
261 |
+
"control",
|
262 |
+
"dais",
|
263 |
+
"dollhouse",
|
264 |
+
"envelope",
|
265 |
+
"food",
|
266 |
+
"frying pan",
|
267 |
+
"helmet",
|
268 |
+
"tennis racket",
|
269 |
+
"umbrella",
|
270 |
+
"couch",
|
271 |
+
"shelf",
|
272 |
+
"office chair",
|
273 |
+
"monitor",
|
274 |
+
"kitchen cabinet",
|
275 |
+
"clothes",
|
276 |
+
"tv",
|
277 |
+
"end table",
|
278 |
+
"dining table",
|
279 |
+
"keyboard",
|
280 |
+
"toilet paper",
|
281 |
+
"tv stand",
|
282 |
+
"whiteboard",
|
283 |
+
"trash can",
|
284 |
+
"closet",
|
285 |
+
"stairs",
|
286 |
+
"computer tower",
|
287 |
+
"bin",
|
288 |
+
"ottoman",
|
289 |
+
"washing machine",
|
290 |
+
"copier",
|
291 |
+
"sofa chair",
|
292 |
+
"file cabinet",
|
293 |
+
"shower",
|
294 |
+
"paper towel dispenser",
|
295 |
+
"blinds",
|
296 |
+
"suitcase",
|
297 |
+
"rail",
|
298 |
+
"recycling bin",
|
299 |
+
"laundry basket",
|
300 |
+
"clothes dryer",
|
301 |
+
"toilet paper holder",
|
302 |
+
"speaker",
|
303 |
+
"bathroom stall",
|
304 |
+
"shower wall",
|
305 |
+
"cup",
|
306 |
+
"storage bin",
|
307 |
+
"paper towel roll",
|
308 |
+
"bulletin board",
|
309 |
+
"kitchen counter",
|
310 |
+
"toilet paper dispenser",
|
311 |
+
"mini fridge",
|
312 |
+
"ball",
|
313 |
+
"shower curtain rod",
|
314 |
+
"shower door",
|
315 |
+
"pillar",
|
316 |
+
"ledge",
|
317 |
+
"toaster oven",
|
318 |
+
"toilet seat cover dispenser",
|
319 |
+
"cart",
|
320 |
+
"storage container",
|
321 |
+
"tissue box",
|
322 |
+
"light switch",
|
323 |
+
"power outlet",
|
324 |
+
"sign",
|
325 |
+
"closet door",
|
326 |
+
"vacuum cleaner",
|
327 |
+
"stuffed animal",
|
328 |
+
"headphones",
|
329 |
+
"guitar case",
|
330 |
+
"hair dryer",
|
331 |
+
"water bottle",
|
332 |
+
"handicap bar",
|
333 |
+
"purse",
|
334 |
+
"shower floor",
|
335 |
+
"water pitcher",
|
336 |
+
"paper bag",
|
337 |
+
"projector screen",
|
338 |
+
"divider",
|
339 |
+
"laundry detergent",
|
340 |
+
"bathroom counter",
|
341 |
+
"object",
|
342 |
+
"bathroom vanity",
|
343 |
+
"closet wall",
|
344 |
+
"laundry hamper",
|
345 |
+
"bathroom stall door",
|
346 |
+
"ceiling light",
|
347 |
+
"trash bin",
|
348 |
+
"stair rail",
|
349 |
+
"tube",
|
350 |
+
"bathroom cabinet",
|
351 |
+
"cd case",
|
352 |
+
"closet rod",
|
353 |
+
"coffee kettle",
|
354 |
+
"structure",
|
355 |
+
"shower head",
|
356 |
+
"keyboard piano",
|
357 |
+
"case of water bottles",
|
358 |
+
"coat rack",
|
359 |
+
"storage organizer",
|
360 |
+
"folded chair",
|
361 |
+
"power strip",
|
362 |
+
"calendar",
|
363 |
+
"poster",
|
364 |
+
"potted plant",
|
365 |
+
"luggage",
|
366 |
+
"mattress",
|
367 |
+
),
|
368 |
+
valid_index=(
|
369 |
+
(0, 1, 4, 5, 6, 7, 8, 10, 19, 29, 30, 31, 32),
|
370 |
+
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 15, 20, 22, 24, 25, 27, 34),
|
371 |
+
(0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 25, 26, 33, 34, 35),
|
372 |
+
(
|
373 |
+
0,
|
374 |
+
4,
|
375 |
+
36,
|
376 |
+
2,
|
377 |
+
7,
|
378 |
+
1,
|
379 |
+
37,
|
380 |
+
6,
|
381 |
+
8,
|
382 |
+
9,
|
383 |
+
38,
|
384 |
+
39,
|
385 |
+
40,
|
386 |
+
11,
|
387 |
+
19,
|
388 |
+
41,
|
389 |
+
13,
|
390 |
+
42,
|
391 |
+
43,
|
392 |
+
5,
|
393 |
+
25,
|
394 |
+
44,
|
395 |
+
26,
|
396 |
+
45,
|
397 |
+
46,
|
398 |
+
47,
|
399 |
+
3,
|
400 |
+
15,
|
401 |
+
18,
|
402 |
+
48,
|
403 |
+
49,
|
404 |
+
50,
|
405 |
+
51,
|
406 |
+
52,
|
407 |
+
53,
|
408 |
+
54,
|
409 |
+
55,
|
410 |
+
24,
|
411 |
+
56,
|
412 |
+
57,
|
413 |
+
58,
|
414 |
+
59,
|
415 |
+
60,
|
416 |
+
61,
|
417 |
+
62,
|
418 |
+
63,
|
419 |
+
27,
|
420 |
+
22,
|
421 |
+
64,
|
422 |
+
65,
|
423 |
+
66,
|
424 |
+
67,
|
425 |
+
68,
|
426 |
+
69,
|
427 |
+
70,
|
428 |
+
71,
|
429 |
+
72,
|
430 |
+
73,
|
431 |
+
74,
|
432 |
+
75,
|
433 |
+
76,
|
434 |
+
77,
|
435 |
+
78,
|
436 |
+
79,
|
437 |
+
80,
|
438 |
+
81,
|
439 |
+
82,
|
440 |
+
83,
|
441 |
+
84,
|
442 |
+
85,
|
443 |
+
86,
|
444 |
+
87,
|
445 |
+
88,
|
446 |
+
89,
|
447 |
+
90,
|
448 |
+
91,
|
449 |
+
92,
|
450 |
+
93,
|
451 |
+
94,
|
452 |
+
95,
|
453 |
+
96,
|
454 |
+
97,
|
455 |
+
31,
|
456 |
+
98,
|
457 |
+
99,
|
458 |
+
100,
|
459 |
+
101,
|
460 |
+
102,
|
461 |
+
103,
|
462 |
+
104,
|
463 |
+
105,
|
464 |
+
106,
|
465 |
+
107,
|
466 |
+
108,
|
467 |
+
109,
|
468 |
+
110,
|
469 |
+
111,
|
470 |
+
52,
|
471 |
+
112,
|
472 |
+
113,
|
473 |
+
114,
|
474 |
+
115,
|
475 |
+
116,
|
476 |
+
117,
|
477 |
+
118,
|
478 |
+
119,
|
479 |
+
120,
|
480 |
+
121,
|
481 |
+
122,
|
482 |
+
123,
|
483 |
+
124,
|
484 |
+
125,
|
485 |
+
126,
|
486 |
+
127,
|
487 |
+
128,
|
488 |
+
129,
|
489 |
+
130,
|
490 |
+
131,
|
491 |
+
132,
|
492 |
+
133,
|
493 |
+
134,
|
494 |
+
135,
|
495 |
+
136,
|
496 |
+
137,
|
497 |
+
138,
|
498 |
+
139,
|
499 |
+
140,
|
500 |
+
141,
|
501 |
+
142,
|
502 |
+
143,
|
503 |
+
144,
|
504 |
+
145,
|
505 |
+
146,
|
506 |
+
147,
|
507 |
+
148,
|
508 |
+
149,
|
509 |
+
150,
|
510 |
+
151,
|
511 |
+
152,
|
512 |
+
153,
|
513 |
+
154,
|
514 |
+
155,
|
515 |
+
156,
|
516 |
+
157,
|
517 |
+
158,
|
518 |
+
159,
|
519 |
+
160,
|
520 |
+
161,
|
521 |
+
162,
|
522 |
+
163,
|
523 |
+
164,
|
524 |
+
165,
|
525 |
+
166,
|
526 |
+
167,
|
527 |
+
168,
|
528 |
+
169,
|
529 |
+
170,
|
530 |
+
171,
|
531 |
+
172,
|
532 |
+
173,
|
533 |
+
174,
|
534 |
+
175,
|
535 |
+
176,
|
536 |
+
177,
|
537 |
+
178,
|
538 |
+
179,
|
539 |
+
180,
|
540 |
+
181,
|
541 |
+
182,
|
542 |
+
183,
|
543 |
+
184,
|
544 |
+
185,
|
545 |
+
186,
|
546 |
+
187,
|
547 |
+
188,
|
548 |
+
189,
|
549 |
+
190,
|
550 |
+
191,
|
551 |
+
192,
|
552 |
+
193,
|
553 |
+
194,
|
554 |
+
195,
|
555 |
+
196,
|
556 |
+
197,
|
557 |
+
198,
|
558 |
+
),
|
559 |
+
),
|
560 |
+
backbone_mode=False,
|
561 |
+
)
|
562 |
+
|
563 |
+
# optimizer
|
564 |
+
# epoch = 800
|
565 |
+
# eval_epoch = 800
|
566 |
+
epoch = 1000
|
567 |
+
eval_epoch = 1000
|
568 |
+
# epoch = 1600
|
569 |
+
# eval_epoch = 1600
|
570 |
+
optimizer = dict(type="AdamW", lr=0.005, weight_decay=0.05)
|
571 |
+
scheduler = dict(
|
572 |
+
type="OneCycleLR",
|
573 |
+
max_lr=[0.005, 0.0005],
|
574 |
+
pct_start=0.05,
|
575 |
+
anneal_strategy="cos",
|
576 |
+
div_factor=10.0,
|
577 |
+
final_div_factor=1000.0,
|
578 |
+
)
|
579 |
+
param_dicts = [dict(keyword="block", lr=0.0005)]
|
580 |
+
|
581 |
+
# datasets
|
582 |
+
data = dict(
|
583 |
+
num_classes=20,
|
584 |
+
ignore_index=-1,
|
585 |
+
names=["wall", "floor", "cabinet", "bed", "chair", "sofa", "table", "door", "window", "bookshelf", "picture", "counter", "desk", "curtain", "refridgerator", "shower curtain", "toilet", "sink", "bathtub", "otherfurniture"],
|
586 |
+
train=dict(
|
587 |
+
type="ConcatDataset",
|
588 |
+
datasets=[
|
589 |
+
# # Structured3DDataset
|
590 |
+
# dict(
|
591 |
+
# type="Structured3DDataset",
|
592 |
+
# split=["train", "val", "test"],
|
593 |
+
# data_root="data/structured3d",
|
594 |
+
# transform=[
|
595 |
+
# dict(type="CenterShift", apply_z=True),
|
596 |
+
# dict(type="RandomDropout", dropout_ratio=0.2, dropout_application_ratio=0.2),
|
597 |
+
# dict(type="RandomRotate", angle=[-1, 1], axis="z", center=[0, 0, 0], p=0.5),
|
598 |
+
# dict(type="RandomRotate", angle=[-0.015625, 0.015625], axis="x", p=0.5),
|
599 |
+
# dict(type="RandomRotate", angle=[-0.015625, 0.015625], axis="y", p=0.5),
|
600 |
+
# dict(type="RandomScale", scale=[0.9, 1.1]),
|
601 |
+
# dict(type="RandomFlip", p=0.5),
|
602 |
+
# dict(type="RandomJitter", sigma=0.005, clip=0.02),
|
603 |
+
# dict(type="ElasticDistortion", distortion_params=[[0.2, 0.4], [0.8, 1.6]]),
|
604 |
+
# dict(type="ChromaticAutoContrast", p=0.2, blend_factor=None),
|
605 |
+
# dict(type="ChromaticTranslation", p=0.95, ratio=0.05),
|
606 |
+
# dict(type="ChromaticJitter", p=0.95, std=0.05),
|
607 |
+
# dict(type="GridSample", grid_size=0.02, hash_type="fnv", mode="train", return_grid_coord=True),
|
608 |
+
# dict(type="SphereCrop", sample_rate=0.8, mode="random"),
|
609 |
+
# dict(type="SphereCrop", point_max=102400, mode="random"),
|
610 |
+
# dict(type="CenterShift", apply_z=False),
|
611 |
+
# dict(type="NormalizeColor"),
|
612 |
+
# dict(type="Add", keys_dict=dict(condition="Structured3D")),
|
613 |
+
# dict(type="ToTensor"),
|
614 |
+
# dict(type="Collect", keys=("coord", "grid_coord", "segment", "condition"), feat_keys=("color", "normal")),
|
615 |
+
# ],
|
616 |
+
# test_mode=False,
|
617 |
+
# loop=1,
|
618 |
+
# ),
|
619 |
+
# ScanNetDataset
|
620 |
+
dict(
|
621 |
+
type="ScanNetDataset",
|
622 |
+
split="train",
|
623 |
+
data_root="data/scannet",
|
624 |
+
transform=[
|
625 |
+
dict(type="CenterShift", apply_z=True),
|
626 |
+
dict(type="RandomDropout", dropout_ratio=0.2, dropout_application_ratio=0.2),
|
627 |
+
dict(type="RandomRotate", angle=[-1, 1], axis="z", center=[0, 0, 0], p=0.5),
|
628 |
+
dict(type="RandomRotate", angle=[-0.015625, 0.015625], axis="x", p=0.5),
|
629 |
+
dict(type="RandomRotate", angle=[-0.015625, 0.015625], axis="y", p=0.5),
|
630 |
+
dict(type="RandomScale", scale=[0.9, 1.1]),
|
631 |
+
dict(type="RandomFlip", p=0.5),
|
632 |
+
dict(type="RandomJitter", sigma=0.005, clip=0.02),
|
633 |
+
dict(type="ElasticDistortion", distortion_params=[[0.2, 0.4], [0.8, 1.6]]),
|
634 |
+
dict(type="ChromaticAutoContrast", p=0.2, blend_factor=None),
|
635 |
+
dict(type="ChromaticTranslation", p=0.95, ratio=0.05),
|
636 |
+
dict(type="ChromaticJitter", p=0.95, std=0.05),
|
637 |
+
dict(type="GridSample", grid_size=0.02, hash_type="fnv", mode="train", return_grid_coord=True),
|
638 |
+
dict(type="SphereCrop", point_max=102400, mode="random"),
|
639 |
+
dict(type="CenterShift", apply_z=False),
|
640 |
+
dict(type="NormalizeColor"),
|
641 |
+
dict(type="ShufflePoint"),
|
642 |
+
dict(type="Add", keys_dict=dict(condition="ScanNet")),
|
643 |
+
dict(type="ToTensor"),
|
644 |
+
dict(type="Collect", keys=("coord", "grid_coord", "segment", "condition"), feat_keys=("color", "normal")),
|
645 |
+
],
|
646 |
+
test_mode=False,
|
647 |
+
loop=1,
|
648 |
+
),
|
649 |
+
# S3DISDataset
|
650 |
+
dict(
|
651 |
+
type="S3DISDataset",
|
652 |
+
split=("Area_1", "Area_2", "Area_3", "Area_4", "Area_6"),
|
653 |
+
data_root="data/s3dis",
|
654 |
+
transform=[
|
655 |
+
dict(type="CenterShift", apply_z=True),
|
656 |
+
dict(type="RandomDropout", dropout_ratio=0.2, dropout_application_ratio=0.2),
|
657 |
+
dict(type="RandomRotate", angle=[-1, 1], axis="z", center=[0, 0, 0], p=0.5),
|
658 |
+
dict(type="RandomRotate", angle=[-0.015625, 0.015625], axis="x", p=0.5),
|
659 |
+
dict(type="RandomRotate", angle=[-0.015625, 0.015625], axis="y", p=0.5),
|
660 |
+
dict(type="RandomScale", scale=[0.9, 1.1]),
|
661 |
+
dict(type="RandomFlip", p=0.5),
|
662 |
+
dict(type="RandomJitter", sigma=0.005, clip=0.02),
|
663 |
+
dict(type="ChromaticAutoContrast", p=0.2, blend_factor=None),
|
664 |
+
dict(type="ChromaticTranslation", p=0.95, ratio=0.05),
|
665 |
+
dict(type="ChromaticJitter", p=0.95, std=0.05),
|
666 |
+
dict(type="GridSample", grid_size=0.02, hash_type="fnv", mode="train", return_grid_coord=True),
|
667 |
+
dict(type="SphereCrop", sample_rate=0.6, mode="random"),
|
668 |
+
dict(type="SphereCrop", point_max=204800, mode="random"),
|
669 |
+
dict(type="CenterShift", apply_z=False),
|
670 |
+
dict(type="NormalizeColor"),
|
671 |
+
dict(type="Add", keys_dict=dict(condition="S3DIS")),
|
672 |
+
dict(type="ToTensor"),
|
673 |
+
dict(type="Collect", keys=("coord", "grid_coord", "segment", "condition"), feat_keys=("color", "normal")),
|
674 |
+
],
|
675 |
+
test_mode=False,
|
676 |
+
loop=1,
|
677 |
+
),
|
678 |
+
# ALC
|
679 |
+
dict(
|
680 |
+
type="ARKitScenesLabelMakerConsensusDataset",
|
681 |
+
split=["train", "val"],
|
682 |
+
data_root="data/alc",
|
683 |
+
transform=[
|
684 |
+
dict(type="CenterShift", apply_z=True),
|
685 |
+
dict(type="RandomDropout", dropout_ratio=0.2, dropout_application_ratio=0.2),
|
686 |
+
# dict(type="RandomRotateTargetAngle", angle=(1/2, 1, 3/2), center=[0, 0, 0], axis="z", p=0.75),
|
687 |
+
dict(type="RandomRotate", angle=[-1, 1], axis="z", center=[0, 0, 0], p=0.5),
|
688 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="x", p=0.5),
|
689 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="y", p=0.5),
|
690 |
+
dict(type="RandomScale", scale=[0.9, 1.1]),
|
691 |
+
# dict(type="RandomShift", shift=[0.2, 0.2, 0.2]),
|
692 |
+
dict(type="RandomFlip", p=0.5),
|
693 |
+
dict(type="RandomJitter", sigma=0.005, clip=0.02),
|
694 |
+
dict(type="ElasticDistortion", distortion_params=[[0.2, 0.4], [0.8, 1.6]]),
|
695 |
+
dict(type="ChromaticAutoContrast", p=0.2, blend_factor=None),
|
696 |
+
dict(type="ChromaticTranslation", p=0.95, ratio=0.05),
|
697 |
+
dict(type="ChromaticJitter", p=0.95, std=0.05),
|
698 |
+
# dict(type="HueSaturationTranslation", hue_max=0.2, saturation_max=0.2),
|
699 |
+
# dict(type="RandomColorDrop", p=0.2, color_augment=0.0),
|
700 |
+
dict(
|
701 |
+
type="GridSample",
|
702 |
+
grid_size=0.02,
|
703 |
+
hash_type="fnv",
|
704 |
+
mode="train",
|
705 |
+
return_grid_coord=True,
|
706 |
+
),
|
707 |
+
dict(type="SphereCrop", point_max=102400, mode="random"),
|
708 |
+
dict(type="CenterShift", apply_z=False),
|
709 |
+
dict(type="NormalizeColor"),
|
710 |
+
# dict(type="ShufflePoint"),
|
711 |
+
dict(type="Add", keys_dict=dict(condition="ALC")),
|
712 |
+
dict(type="ToTensor"),
|
713 |
+
dict(
|
714 |
+
type="Collect",
|
715 |
+
keys=("coord", "grid_coord", "segment", "condition"),
|
716 |
+
feat_keys=("color", "normal"),
|
717 |
+
),
|
718 |
+
],
|
719 |
+
test_mode=False,
|
720 |
+
loop=2,
|
721 |
+
),
|
722 |
+
],
|
723 |
+
loop=1,
|
724 |
+
),
|
725 |
+
val=dict(
|
726 |
+
type="ScanNetDataset",
|
727 |
+
split="val",
|
728 |
+
data_root="data/scannet",
|
729 |
+
transform=[
|
730 |
+
dict(type="CenterShift", apply_z=True),
|
731 |
+
dict(type="GridSample", grid_size=0.02, hash_type="fnv", mode="train", return_grid_coord=True),
|
732 |
+
dict(type="CenterShift", apply_z=False),
|
733 |
+
dict(type="NormalizeColor"),
|
734 |
+
dict(type="ToTensor"),
|
735 |
+
dict(type="Add", keys_dict=dict(condition="ScanNet")),
|
736 |
+
dict(type="Collect", keys=("coord", "grid_coord", "segment", "condition"), feat_keys=("color", "normal")),
|
737 |
+
],
|
738 |
+
test_mode=False,
|
739 |
+
),
|
740 |
+
test=dict(
|
741 |
+
type="ScanNetDataset",
|
742 |
+
split="val",
|
743 |
+
data_root="data/scannet",
|
744 |
+
transform=[dict(type="CenterShift", apply_z=True), dict(type="NormalizeColor")],
|
745 |
+
test_mode=True,
|
746 |
+
test_cfg=dict(
|
747 |
+
voxelize=dict(type="GridSample", grid_size=0.02, hash_type="fnv", mode="test", keys=("coord", "color", "normal"), return_grid_coord=True),
|
748 |
+
crop=None,
|
749 |
+
post_transform=[
|
750 |
+
dict(type="CenterShift", apply_z=False),
|
751 |
+
dict(type="Add", keys_dict=dict(condition="ScanNet")),
|
752 |
+
dict(type="ToTensor"),
|
753 |
+
dict(type="Collect", keys=("coord", "grid_coord", "index", "condition"), feat_keys=("color", "normal")),
|
754 |
+
],
|
755 |
+
aug_transform=[
|
756 |
+
[{"type": "RandomRotateTargetAngle", "angle": [0], "axis": "z", "center": [0, 0, 0], "p": 1}],
|
757 |
+
[{"type": "RandomRotateTargetAngle", "angle": [0.5], "axis": "z", "center": [0, 0, 0], "p": 1}],
|
758 |
+
[{"type": "RandomRotateTargetAngle", "angle": [1], "axis": "z", "center": [0, 0, 0], "p": 1}],
|
759 |
+
[{"type": "RandomRotateTargetAngle", "angle": [1.5], "axis": "z", "center": [0, 0, 0], "p": 1}],
|
760 |
+
[{"type": "RandomRotateTargetAngle", "angle": [0], "axis": "z", "center": [0, 0, 0], "p": 1}, {"type": "RandomScale", "scale": [0.95, 0.95]}],
|
761 |
+
[{"type": "RandomRotateTargetAngle", "angle": [0.5], "axis": "z", "center": [0, 0, 0], "p": 1}, {"type": "RandomScale", "scale": [0.95, 0.95]}],
|
762 |
+
[{"type": "RandomRotateTargetAngle", "angle": [1], "axis": "z", "center": [0, 0, 0], "p": 1}, {"type": "RandomScale", "scale": [0.95, 0.95]}],
|
763 |
+
[{"type": "RandomRotateTargetAngle", "angle": [1.5], "axis": "z", "center": [0, 0, 0], "p": 1}, {"type": "RandomScale", "scale": [0.95, 0.95]}],
|
764 |
+
[{"type": "RandomRotateTargetAngle", "angle": [0], "axis": "z", "center": [0, 0, 0], "p": 1}, {"type": "RandomScale", "scale": [1.05, 1.05]}],
|
765 |
+
[{"type": "RandomRotateTargetAngle", "angle": [0.5], "axis": "z", "center": [0, 0, 0], "p": 1}, {"type": "RandomScale", "scale": [1.05, 1.05]}],
|
766 |
+
[{"type": "RandomRotateTargetAngle", "angle": [1], "axis": "z", "center": [0, 0, 0], "p": 1}, {"type": "RandomScale", "scale": [1.05, 1.05]}],
|
767 |
+
[{"type": "RandomRotateTargetAngle", "angle": [1.5], "axis": "z", "center": [0, 0, 0], "p": 1}, {"type": "RandomScale", "scale": [1.05, 1.05]}],
|
768 |
+
[{"type": "RandomFlip", "p": 1}],
|
769 |
+
],
|
770 |
+
),
|
771 |
+
),
|
772 |
+
)
|
773 |
+
|
774 |
+
# hook
|
775 |
+
hooks = [
|
776 |
+
dict(type="CheckpointLoader"),
|
777 |
+
dict(type="IterationTimer", warmup_iter=2),
|
778 |
+
dict(type="InformationWriter"),
|
779 |
+
dict(type="SemSegEvaluator"),
|
780 |
+
dict(type="CheckpointSaver", save_freq=None),
|
781 |
+
dict(type="PreciseE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ch_size = 24 # bs: total bs in all gpus
|
7 |
+
num_worker = 36
|
8 |
+
mix_prob = 0.8
|
9 |
+
empty_cache = False
|
10 |
+
enable_amp = True
|
11 |
+
find_unused_parameters = True
|
12 |
+
|
13 |
+
# trainer
|
14 |
+
train = dict(
|
15 |
+
type="MultiDatasetTrainer",
|
16 |
+
)
|
17 |
+
|
18 |
+
# model
|
19 |
+
model = dict(
|
20 |
+
type="PPT-v1m1",
|
21 |
+
backbone=dict(
|
22 |
+
type="PT-v3m1",
|
23 |
+
in_channels=6,
|
24 |
+
order=("z", "z-trans", "hilbert", "hilbert-trans"),
|
25 |
+
stride=(2, 2, 2, 2),
|
26 |
+
enc_depths=(3, 3, 3, 6, 3),
|
27 |
+
enc_channels=(48, 96, 192, 384, 512),
|
28 |
+
enc_num_head=(3, 6, 12, 24, 32),
|
29 |
+
enc_patch_size=(1024, 1024, 1024, 1024, 1024),
|
30 |
+
dec_depths=(3, 3, 3, 3),
|
31 |
+
dec_channels=(64, 96, 192, 384),
|
32 |
+
dec_num_head=(4, 6, 12, 24),
|
33 |
+
dec_patch_size=(1024, 1024, 1024, 1024),
|
34 |
+
mlp_ratio=4,
|
35 |
+
qkv_bias=True,
|
36 |
+
qk_scale=None,
|
37 |
+
attn_drop=0.0,
|
38 |
+
proj_drop=0.0,
|
39 |
+
drop_path=0.3,
|
40 |
+
shuffle_orders=True,
|
41 |
+
pre_norm=True,
|
42 |
+
enable_rpe=False,
|
43 |
+
enable_flash=True,
|
44 |
+
upcast_attention=False,
|
45 |
+
upcast_softmax=False,
|
46 |
+
cls_mode=False,
|
47 |
+
pdnorm_bn=True,
|
48 |
+
pdnorm_ln=True,
|
49 |
+
pdnorm_decouple=True,
|
50 |
+
pdnorm_adaptive=False,
|
51 |
+
pdnorm_affine=True,
|
52 |
+
pdnorm_conditions=(
|
53 |
+
"S3DIS",
|
54 |
+
# "ScanNet",
|
55 |
+
"Structured3D",
|
56 |
+
"ALC",
|
57 |
+
"ScanNet200",
|
58 |
+
),
|
59 |
+
),
|
60 |
+
criteria=[dict(type="CrossEntropyLoss", loss_weight=1.0, ignore_index=-1), dict(type="LovaszLoss", mode="multiclass", loss_weight=1.0, ignore_index=-1)],
|
61 |
+
backbone_out_channels=64,
|
62 |
+
context_channels=256,
|
63 |
+
conditions=(
|
64 |
+
"S3DIS",
|
65 |
+
# "ScanNet",
|
66 |
+
"Structured3D",
|
67 |
+
"ALC",
|
68 |
+
"ScanNet200",
|
69 |
+
),
|
70 |
+
template="[x]",
|
71 |
+
clip_model="ViT-B/16",
|
72 |
+
class_name=(
|
73 |
+
"wall",
|
74 |
+
"floor",
|
75 |
+
"cabinet",
|
76 |
+
"bed",
|
77 |
+
"chair",
|
78 |
+
"sofa",
|
79 |
+
"table",
|
80 |
+
"door",
|
81 |
+
"window",
|
82 |
+
"bookshelf",
|
83 |
+
"bookcase",
|
84 |
+
"picture",
|
85 |
+
"counter",
|
86 |
+
"desk",
|
87 |
+
"shelves",
|
88 |
+
"curtain",
|
89 |
+
"dresser",
|
90 |
+
"pillow",
|
91 |
+
"mirror",
|
92 |
+
"ceiling",
|
93 |
+
"refrigerator",
|
94 |
+
"television",
|
95 |
+
"shower curtain",
|
96 |
+
"nightstand",
|
97 |
+
"toilet",
|
98 |
+
"sink",
|
99 |
+
"lamp",
|
100 |
+
"bathtub",
|
101 |
+
"garbagebin",
|
102 |
+
"board",
|
103 |
+
"beam",
|
104 |
+
"column",
|
105 |
+
"clutter",
|
106 |
+
"otherstructure",
|
107 |
+
"otherfurniture",
|
108 |
+
"otherprop",
|
109 |
+
"book",
|
110 |
+
"ashcan",
|
111 |
+
"display",
|
112 |
+
"cushion",
|
113 |
+
"box",
|
114 |
+
"doorframe",
|
115 |
+
"swivel chair",
|
116 |
+
"towel",
|
117 |
+
"backpack",
|
118 |
+
"chest of drawers",
|
119 |
+
"apparel",
|
120 |
+
"armchair",
|
121 |
+
"plant",
|
122 |
+
"radiator",
|
123 |
+
"toilet tissue",
|
124 |
+
"shoe",
|
125 |
+
"bag",
|
126 |
+
"bottle",
|
127 |
+
"countertop",
|
128 |
+
"coffee table",
|
129 |
+
"computer keyboard",
|
130 |
+
"fridge",
|
131 |
+
"stool",
|
132 |
+
"computer",
|
133 |
+
"mug",
|
134 |
+
"telephone",
|
135 |
+
"light",
|
136 |
+
"jacket",
|
137 |
+
"microwave",
|
138 |
+
"footstool",
|
139 |
+
"baggage",
|
140 |
+
"laptop",
|
141 |
+
"printer",
|
142 |
+
"shower stall",
|
143 |
+
"soap dispenser",
|
144 |
+
"stove",
|
145 |
+
"fan",
|
146 |
+
"paper",
|
147 |
+
"stand",
|
148 |
+
"bench",
|
149 |
+
"wardrobe",
|
150 |
+
"blanket",
|
151 |
+
"booth",
|
152 |
+
"duplicator",
|
153 |
+
"bar",
|
154 |
+
"soap dish",
|
155 |
+
"switch",
|
156 |
+
"coffee maker",
|
157 |
+
"decoration",
|
158 |
+
"range hood",
|
159 |
+
"blackboard",
|
160 |
+
"clock",
|
161 |
+
"railing",
|
162 |
+
"mat",
|
163 |
+
"seat",
|
164 |
+
"bannister",
|
165 |
+
"container",
|
166 |
+
"mouse",
|
167 |
+
"person",
|
168 |
+
"stairway",
|
169 |
+
"basket",
|
170 |
+
"dumbbell",
|
171 |
+
"bucket",
|
172 |
+
"windowsill",
|
173 |
+
"signboard",
|
174 |
+
"dishwasher",
|
175 |
+
"loudspeaker",
|
176 |
+
"washer",
|
177 |
+
"paper towel",
|
178 |
+
"clothes hamper",
|
179 |
+
"piano",
|
180 |
+
"sack",
|
181 |
+
"handcart",
|
182 |
+
"blind",
|
183 |
+
"dish rack",
|
184 |
+
"mailbox",
|
185 |
+
"bicycle",
|
186 |
+
"ladder",
|
187 |
+
"rack",
|
188 |
+
"tray",
|
189 |
+
"toaster",
|
190 |
+
"paper cutter",
|
191 |
+
"plunger",
|
192 |
+
"dryer",
|
193 |
+
"guitar",
|
194 |
+
"fire extinguisher",
|
195 |
+
"pitcher",
|
196 |
+
"pipe",
|
197 |
+
"plate",
|
198 |
+
"vacuum",
|
199 |
+
"bowl",
|
200 |
+
"hat",
|
201 |
+
"rod",
|
202 |
+
"water cooler",
|
203 |
+
"kettle",
|
204 |
+
"oven",
|
205 |
+
"scale",
|
206 |
+
"broom",
|
207 |
+
"hand blower",
|
208 |
+
"coatrack",
|
209 |
+
"teddy",
|
210 |
+
"alarm clock",
|
211 |
+
"ironing board",
|
212 |
+
"fire alarm",
|
213 |
+
"machine",
|
214 |
+
"music stand",
|
215 |
+
"fireplace",
|
216 |
+
"furniture",
|
217 |
+
"vase",
|
218 |
+
"vent",
|
219 |
+
"candle",
|
220 |
+
"crate",
|
221 |
+
"dustpan",
|
222 |
+
"earphone",
|
223 |
+
"jar",
|
224 |
+
"projector",
|
225 |
+
"gat",
|
226 |
+
"step",
|
227 |
+
"step stool",
|
228 |
+
"vending machine",
|
229 |
+
"coat",
|
230 |
+
"coat hanger",
|
231 |
+
"drinking fountain",
|
232 |
+
"hamper",
|
233 |
+
"thermostat",
|
234 |
+
"banner",
|
235 |
+
"iron",
|
236 |
+
"soap",
|
237 |
+
"chopping board",
|
238 |
+
"kitchen island",
|
239 |
+
"shirt",
|
240 |
+
"sleeping bag",
|
241 |
+
"tire",
|
242 |
+
"toothbrush",
|
243 |
+
"bathrobe",
|
244 |
+
"faucet",
|
245 |
+
"slipper",
|
246 |
+
"thermos",
|
247 |
+
"tripod",
|
248 |
+
"dispenser",
|
249 |
+
"heater",
|
250 |
+
"pool table",
|
251 |
+
"remote control",
|
252 |
+
"stapler",
|
253 |
+
"treadmill",
|
254 |
+
"beanbag",
|
255 |
+
"dartboard",
|
256 |
+
"metronome",
|
257 |
+
"rope",
|
258 |
+
"sewing machine",
|
259 |
+
"shredder",
|
260 |
+
"toolbox",
|
261 |
+
"water heater",
|
262 |
+
"brush",
|
263 |
+
"control",
|
264 |
+
"dais",
|
265 |
+
"dollhouse",
|
266 |
+
"envelope",
|
267 |
+
"food",
|
268 |
+
"frying pan",
|
269 |
+
"helmet",
|
270 |
+
"tennis racket",
|
271 |
+
"umbrella",
|
272 |
+
"couch",
|
273 |
+
"shelf",
|
274 |
+
"office chair",
|
275 |
+
"monitor",
|
276 |
+
"kitchen cabinet",
|
277 |
+
"clothes",
|
278 |
+
"tv",
|
279 |
+
"end table",
|
280 |
+
"dining table",
|
281 |
+
"keyboard",
|
282 |
+
"toilet paper",
|
283 |
+
"tv stand",
|
284 |
+
"whiteboard",
|
285 |
+
"trash can",
|
286 |
+
"closet",
|
287 |
+
"stairs",
|
288 |
+
"computer tower",
|
289 |
+
"bin",
|
290 |
+
"ottoman",
|
291 |
+
"washing machine",
|
292 |
+
"copier",
|
293 |
+
"sofa chair",
|
294 |
+
"file cabinet",
|
295 |
+
"shower",
|
296 |
+
"paper towel dispenser",
|
297 |
+
"blinds",
|
298 |
+
"suitcase",
|
299 |
+
"rail",
|
300 |
+
"recycling bin",
|
301 |
+
"laundry basket",
|
302 |
+
"clothes dryer",
|
303 |
+
"toilet paper holder",
|
304 |
+
"speaker",
|
305 |
+
"bathroom stall",
|
306 |
+
"shower wall",
|
307 |
+
"cup",
|
308 |
+
"storage bin",
|
309 |
+
"paper towel roll",
|
310 |
+
"bulletin board",
|
311 |
+
"kitchen counter",
|
312 |
+
"toilet paper dispenser",
|
313 |
+
"mini fridge",
|
314 |
+
"ball",
|
315 |
+
"shower curtain rod",
|
316 |
+
"shower door",
|
317 |
+
"pillar",
|
318 |
+
"ledge",
|
319 |
+
"toaster oven",
|
320 |
+
"toilet seat cover dispenser",
|
321 |
+
"cart",
|
322 |
+
"storage container",
|
323 |
+
"tissue box",
|
324 |
+
"light switch",
|
325 |
+
"power outlet",
|
326 |
+
"sign",
|
327 |
+
"closet door",
|
328 |
+
"vacuum cleaner",
|
329 |
+
"stuffed animal",
|
330 |
+
"headphones",
|
331 |
+
"guitar case",
|
332 |
+
"hair dryer",
|
333 |
+
"water bottle",
|
334 |
+
"handicap bar",
|
335 |
+
"purse",
|
336 |
+
"shower floor",
|
337 |
+
"water pitcher",
|
338 |
+
"paper bag",
|
339 |
+
"projector screen",
|
340 |
+
"divider",
|
341 |
+
"laundry detergent",
|
342 |
+
"bathroom counter",
|
343 |
+
"object",
|
344 |
+
"bathroom vanity",
|
345 |
+
"closet wall",
|
346 |
+
"laundry hamper",
|
347 |
+
"bathroom stall door",
|
348 |
+
"ceiling light",
|
349 |
+
"trash bin",
|
350 |
+
"stair rail",
|
351 |
+
"tube",
|
352 |
+
"bathroom cabinet",
|
353 |
+
"cd case",
|
354 |
+
"closet rod",
|
355 |
+
"coffee kettle",
|
356 |
+
"structure",
|
357 |
+
"shower head",
|
358 |
+
"keyboard piano",
|
359 |
+
"case of water bottles",
|
360 |
+
"coat rack",
|
361 |
+
"storage organizer",
|
362 |
+
"folded chair",
|
363 |
+
"power strip",
|
364 |
+
"calendar",
|
365 |
+
"poster",
|
366 |
+
"potted plant",
|
367 |
+
"luggage",
|
368 |
+
"mattress",
|
369 |
+
),
|
370 |
+
valid_index=(
|
371 |
+
(0, 1, 4, 5, 6, 7, 8, 10, 19, 29, 30, 31, 32),
|
372 |
+
(0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 25, 26, 33, 34, 35),
|
373 |
+
(
|
374 |
+
0,
|
375 |
+
4,
|
376 |
+
36,
|
377 |
+
2,
|
378 |
+
7,
|
379 |
+
1,
|
380 |
+
37,
|
381 |
+
6,
|
382 |
+
8,
|
383 |
+
9,
|
384 |
+
38,
|
385 |
+
39,
|
386 |
+
40,
|
387 |
+
11,
|
388 |
+
19,
|
389 |
+
41,
|
390 |
+
13,
|
391 |
+
42,
|
392 |
+
43,
|
393 |
+
5,
|
394 |
+
25,
|
395 |
+
44,
|
396 |
+
26,
|
397 |
+
45,
|
398 |
+
46,
|
399 |
+
47,
|
400 |
+
3,
|
401 |
+
15,
|
402 |
+
18,
|
403 |
+
48,
|
404 |
+
49,
|
405 |
+
50,
|
406 |
+
51,
|
407 |
+
52,
|
408 |
+
53,
|
409 |
+
54,
|
410 |
+
55,
|
411 |
+
24,
|
412 |
+
56,
|
413 |
+
57,
|
414 |
+
58,
|
415 |
+
59,
|
416 |
+
60,
|
417 |
+
61,
|
418 |
+
62,
|
419 |
+
63,
|
420 |
+
27,
|
421 |
+
22,
|
422 |
+
64,
|
423 |
+
65,
|
424 |
+
66,
|
425 |
+
67,
|
426 |
+
68,
|
427 |
+
69,
|
428 |
+
70,
|
429 |
+
71,
|
430 |
+
72,
|
431 |
+
73,
|
432 |
+
74,
|
433 |
+
75,
|
434 |
+
76,
|
435 |
+
77,
|
436 |
+
78,
|
437 |
+
79,
|
438 |
+
80,
|
439 |
+
81,
|
440 |
+
82,
|
441 |
+
83,
|
442 |
+
84,
|
443 |
+
85,
|
444 |
+
86,
|
445 |
+
87,
|
446 |
+
88,
|
447 |
+
89,
|
448 |
+
90,
|
449 |
+
91,
|
450 |
+
92,
|
451 |
+
93,
|
452 |
+
94,
|
453 |
+
95,
|
454 |
+
96,
|
455 |
+
97,
|
456 |
+
31,
|
457 |
+
98,
|
458 |
+
99,
|
459 |
+
100,
|
460 |
+
101,
|
461 |
+
102,
|
462 |
+
103,
|
463 |
+
104,
|
464 |
+
105,
|
465 |
+
106,
|
466 |
+
107,
|
467 |
+
108,
|
468 |
+
109,
|
469 |
+
110,
|
470 |
+
111,
|
471 |
+
52,
|
472 |
+
112,
|
473 |
+
113,
|
474 |
+
114,
|
475 |
+
115,
|
476 |
+
116,
|
477 |
+
117,
|
478 |
+
118,
|
479 |
+
119,
|
480 |
+
120,
|
481 |
+
121,
|
482 |
+
122,
|
483 |
+
123,
|
484 |
+
124,
|
485 |
+
125,
|
486 |
+
126,
|
487 |
+
127,
|
488 |
+
128,
|
489 |
+
129,
|
490 |
+
130,
|
491 |
+
131,
|
492 |
+
132,
|
493 |
+
133,
|
494 |
+
134,
|
495 |
+
135,
|
496 |
+
136,
|
497 |
+
137,
|
498 |
+
138,
|
499 |
+
139,
|
500 |
+
140,
|
501 |
+
141,
|
502 |
+
142,
|
503 |
+
143,
|
504 |
+
144,
|
505 |
+
145,
|
506 |
+
146,
|
507 |
+
147,
|
508 |
+
148,
|
509 |
+
149,
|
510 |
+
150,
|
511 |
+
151,
|
512 |
+
152,
|
513 |
+
153,
|
514 |
+
154,
|
515 |
+
155,
|
516 |
+
156,
|
517 |
+
157,
|
518 |
+
158,
|
519 |
+
159,
|
520 |
+
160,
|
521 |
+
161,
|
522 |
+
162,
|
523 |
+
163,
|
524 |
+
164,
|
525 |
+
165,
|
526 |
+
166,
|
527 |
+
167,
|
528 |
+
168,
|
529 |
+
169,
|
530 |
+
170,
|
531 |
+
171,
|
532 |
+
172,
|
533 |
+
173,
|
534 |
+
174,
|
535 |
+
175,
|
536 |
+
176,
|
537 |
+
177,
|
538 |
+
178,
|
539 |
+
179,
|
540 |
+
180,
|
541 |
+
181,
|
542 |
+
182,
|
543 |
+
183,
|
544 |
+
184,
|
545 |
+
185,
|
546 |
+
186,
|
547 |
+
187,
|
548 |
+
188,
|
549 |
+
189,
|
550 |
+
190,
|
551 |
+
191,
|
552 |
+
192,
|
553 |
+
193,
|
554 |
+
194,
|
555 |
+
195,
|
556 |
+
196,
|
557 |
+
197,
|
558 |
+
198,
|
559 |
+
),
|
560 |
+
(
|
561 |
+
0,
|
562 |
+
4,
|
563 |
+
1,
|
564 |
+
6,
|
565 |
+
7,
|
566 |
+
199,
|
567 |
+
2,
|
568 |
+
200,
|
569 |
+
13,
|
570 |
+
201,
|
571 |
+
3,
|
572 |
+
17,
|
573 |
+
25,
|
574 |
+
11,
|
575 |
+
8,
|
576 |
+
24,
|
577 |
+
9,
|
578 |
+
202,
|
579 |
+
15,
|
580 |
+
36,
|
581 |
+
47,
|
582 |
+
55,
|
583 |
+
40,
|
584 |
+
20,
|
585 |
+
26,
|
586 |
+
203,
|
587 |
+
43,
|
588 |
+
204,
|
589 |
+
205,
|
590 |
+
23,
|
591 |
+
12,
|
592 |
+
16,
|
593 |
+
58,
|
594 |
+
39,
|
595 |
+
48,
|
596 |
+
19,
|
597 |
+
27,
|
598 |
+
206,
|
599 |
+
207,
|
600 |
+
208,
|
601 |
+
52,
|
602 |
+
44,
|
603 |
+
209,
|
604 |
+
68,
|
605 |
+
210,
|
606 |
+
211,
|
607 |
+
77,
|
608 |
+
22,
|
609 |
+
212,
|
610 |
+
213,
|
611 |
+
214,
|
612 |
+
64,
|
613 |
+
71,
|
614 |
+
51,
|
615 |
+
215,
|
616 |
+
53,
|
617 |
+
216,
|
618 |
+
217,
|
619 |
+
75,
|
620 |
+
29,
|
621 |
+
218,
|
622 |
+
18,
|
623 |
+
219,
|
624 |
+
96,
|
625 |
+
220,
|
626 |
+
221,
|
627 |
+
72,
|
628 |
+
67,
|
629 |
+
222,
|
630 |
+
73,
|
631 |
+
94,
|
632 |
+
223,
|
633 |
+
131,
|
634 |
+
224,
|
635 |
+
114,
|
636 |
+
124,
|
637 |
+
86,
|
638 |
+
106,
|
639 |
+
225,
|
640 |
+
226,
|
641 |
+
49,
|
642 |
+
227,
|
643 |
+
92,
|
644 |
+
76,
|
645 |
+
70,
|
646 |
+
61,
|
647 |
+
98,
|
648 |
+
87,
|
649 |
+
74,
|
650 |
+
62,
|
651 |
+
228,
|
652 |
+
123,
|
653 |
+
229,
|
654 |
+
120,
|
655 |
+
230,
|
656 |
+
90,
|
657 |
+
231,
|
658 |
+
31,
|
659 |
+
112,
|
660 |
+
113,
|
661 |
+
232,
|
662 |
+
233,
|
663 |
+
234,
|
664 |
+
63,
|
665 |
+
235,
|
666 |
+
83,
|
667 |
+
101,
|
668 |
+
236,
|
669 |
+
140,
|
670 |
+
89,
|
671 |
+
99,
|
672 |
+
80,
|
673 |
+
116,
|
674 |
+
237,
|
675 |
+
138,
|
676 |
+
142,
|
677 |
+
81,
|
678 |
+
238,
|
679 |
+
41,
|
680 |
+
239,
|
681 |
+
240,
|
682 |
+
121,
|
683 |
+
241,
|
684 |
+
127,
|
685 |
+
242,
|
686 |
+
129,
|
687 |
+
117,
|
688 |
+
115,
|
689 |
+
243,
|
690 |
+
244,
|
691 |
+
245,
|
692 |
+
246,
|
693 |
+
93,
|
694 |
+
247,
|
695 |
+
143,
|
696 |
+
248,
|
697 |
+
249,
|
698 |
+
132,
|
699 |
+
250,
|
700 |
+
251,
|
701 |
+
147,
|
702 |
+
252,
|
703 |
+
84,
|
704 |
+
253,
|
705 |
+
151,
|
706 |
+
254,
|
707 |
+
255,
|
708 |
+
146,
|
709 |
+
118,
|
710 |
+
256,
|
711 |
+
257,
|
712 |
+
110,
|
713 |
+
133,
|
714 |
+
258,
|
715 |
+
85,
|
716 |
+
148,
|
717 |
+
259,
|
718 |
+
260,
|
719 |
+
261,
|
720 |
+
262,
|
721 |
+
145,
|
722 |
+
263,
|
723 |
+
264,
|
724 |
+
111,
|
725 |
+
126,
|
726 |
+
265,
|
727 |
+
137,
|
728 |
+
141,
|
729 |
+
266,
|
730 |
+
267,
|
731 |
+
268,
|
732 |
+
269,
|
733 |
+
270,
|
734 |
+
271,
|
735 |
+
272,
|
736 |
+
273,
|
737 |
+
274,
|
738 |
+
275,
|
739 |
+
276,
|
740 |
+
97,
|
741 |
+
277,
|
742 |
+
278,
|
743 |
+
279,
|
744 |
+
280,
|
745 |
+
281,
|
746 |
+
282,
|
747 |
+
283,
|
748 |
+
284,
|
749 |
+
285,
|
750 |
+
286,
|
751 |
+
287,
|
752 |
+
288,
|
753 |
+
289,
|
754 |
+
139,
|
755 |
+
290,
|
756 |
+
291,
|
757 |
+
292,
|
758 |
+
293,
|
759 |
+
294,
|
760 |
+
295,
|
761 |
+
),
|
762 |
+
),
|
763 |
+
backbone_mode=False,
|
764 |
+
)
|
765 |
+
|
766 |
+
# optimizer
|
767 |
+
epoch = 800
|
768 |
+
eval_epoch = 800
|
769 |
+
# epoch = 1600
|
770 |
+
# eval_epoch = 1600
|
771 |
+
optimizer = dict(type="AdamW", lr=0.005, weight_decay=0.05)
|
772 |
+
scheduler = dict(
|
773 |
+
type="OneCycleLR",
|
774 |
+
max_lr=[0.005, 0.0005],
|
775 |
+
pct_start=0.05,
|
776 |
+
anneal_strategy="cos",
|
777 |
+
div_factor=10.0,
|
778 |
+
final_div_factor=1000.0,
|
779 |
+
)
|
780 |
+
param_dicts = [dict(keyword="block", lr=0.0005)]
|
781 |
+
|
782 |
+
# datasets
|
783 |
+
data = dict(
|
784 |
+
num_classes=200,
|
785 |
+
ignore_index=-1,
|
786 |
+
names=CLASS_LABELS_200,
|
787 |
+
train=dict(
|
788 |
+
type="ConcatDataset",
|
789 |
+
datasets=[
|
790 |
+
# Structured3DDataset
|
791 |
+
dict(
|
792 |
+
type="Structured3DDataset",
|
793 |
+
split=["train", "val", "test"],
|
794 |
+
data_root="data/structured3d",
|
795 |
+
transform=[
|
796 |
+
dict(type="CenterShift", apply_z=True),
|
797 |
+
dict(type="RandomDropout", dropout_ratio=0.2, dropout_application_ratio=0.2),
|
798 |
+
dict(type="RandomRotate", angle=[-1, 1], axis="z", center=[0, 0, 0], p=0.5),
|
799 |
+
dict(type="RandomRotate", angle=[-0.015625, 0.015625], axis="x", p=0.5),
|
800 |
+
dict(type="RandomRotate", angle=[-0.015625, 0.015625], axis="y", p=0.5),
|
801 |
+
dict(type="RandomScale", scale=[0.9, 1.1]),
|
802 |
+
dict(type="RandomFlip", p=0.5),
|
803 |
+
dict(type="RandomJitter", sigma=0.005, clip=0.02),
|
804 |
+
dict(type="ElasticDistortion", distortion_params=[[0.2, 0.4], [0.8, 1.6]]),
|
805 |
+
dict(type="ChromaticAutoContrast", p=0.2, blend_factor=None),
|
806 |
+
dict(type="ChromaticTranslation", p=0.95, ratio=0.05),
|
807 |
+
dict(type="ChromaticJitter", p=0.95, std=0.05),
|
808 |
+
dict(type="GridSample", grid_size=0.02, hash_type="fnv", mode="train", return_grid_coord=True),
|
809 |
+
dict(type="SphereCrop", sample_rate=0.8, mode="random"),
|
810 |
+
dict(type="SphereCrop", point_max=102400, mode="random"),
|
811 |
+
dict(type="CenterShift", apply_z=False),
|
812 |
+
dict(type="NormalizeColor"),
|
813 |
+
dict(type="Add", keys_dict=dict(condition="Structured3D")),
|
814 |
+
dict(type="ToTensor"),
|
815 |
+
dict(type="Collect", keys=("coord", "grid_coord", "segment", "condition"), feat_keys=("color", "normal")),
|
816 |
+
],
|
817 |
+
test_mode=False,
|
818 |
+
loop=1,
|
819 |
+
),
|
820 |
+
# ScanNet200Dataset
|
821 |
+
dict(
|
822 |
+
type="ScanNet200Dataset",
|
823 |
+
split="train",
|
824 |
+
data_root="data/scannet",
|
825 |
+
transform=[
|
826 |
+
dict(type="CenterShift", apply_z=True),
|
827 |
+
dict(type="RandomDropout", dropout_ratio=0.2, dropout_application_ratio=0.2),
|
828 |
+
dict(type="RandomRotate", angle=[-1, 1], axis="z", center=[0, 0, 0], p=0.5),
|
829 |
+
dict(type="RandomRotate", angle=[-0.015625, 0.015625], axis="x", p=0.5),
|
830 |
+
dict(type="RandomRotate", angle=[-0.015625, 0.015625], axis="y", p=0.5),
|
831 |
+
dict(type="RandomScale", scale=[0.9, 1.1]),
|
832 |
+
dict(type="RandomFlip", p=0.5),
|
833 |
+
dict(type="RandomJitter", sigma=0.005, clip=0.02),
|
834 |
+
dict(type="ElasticDistortion", distortion_params=[[0.2, 0.4], [0.8, 1.6]]),
|
835 |
+
dict(type="ChromaticAutoContrast", p=0.2, blend_factor=None),
|
836 |
+
dict(type="ChromaticTranslation", p=0.95, ratio=0.05),
|
837 |
+
dict(type="ChromaticJitter", p=0.95, std=0.05),
|
838 |
+
dict(type="GridSample", grid_size=0.02, hash_type="fnv", mode="train", return_grid_coord=True),
|
839 |
+
dict(type="SphereCrop", point_max=102400, mode="random"),
|
840 |
+
dict(type="CenterShift", apply_z=False),
|
841 |
+
dict(type="NormalizeColor"),
|
842 |
+
dict(type="ShufflePoint"),
|
843 |
+
dict(type="Add", keys_dict=dict(condition="ScanNet200")),
|
844 |
+
dict(type="ToTensor"),
|
845 |
+
dict(type="Collect", keys=("coord", "grid_coord", "segment", "condition"), feat_keys=("color", "normal")),
|
846 |
+
],
|
847 |
+
test_mode=False,
|
848 |
+
loop=1,
|
849 |
+
),
|
850 |
+
# S3DISDataset
|
851 |
+
dict(
|
852 |
+
type="S3DISDataset",
|
853 |
+
split=("Area_1", "Area_2", "Area_3", "Area_4", "Area_6"),
|
854 |
+
data_root="data/s3dis",
|
855 |
+
transform=[
|
856 |
+
dict(type="CenterShift", apply_z=True),
|
857 |
+
dict(type="RandomDropout", dropout_ratio=0.2, dropout_application_ratio=0.2),
|
858 |
+
dict(type="RandomRotate", angle=[-1, 1], axis="z", center=[0, 0, 0], p=0.5),
|
859 |
+
dict(type="RandomRotate", angle=[-0.015625, 0.015625], axis="x", p=0.5),
|
860 |
+
dict(type="RandomRotate", angle=[-0.015625, 0.015625], axis="y", p=0.5),
|
861 |
+
dict(type="RandomScale", scale=[0.9, 1.1]),
|
862 |
+
dict(type="RandomFlip", p=0.5),
|
863 |
+
dict(type="RandomJitter", sigma=0.005, clip=0.02),
|
864 |
+
dict(type="ChromaticAutoContrast", p=0.2, blend_factor=None),
|
865 |
+
dict(type="ChromaticTranslation", p=0.95, ratio=0.05),
|
866 |
+
dict(type="ChromaticJitter", p=0.95, std=0.05),
|
867 |
+
dict(type="GridSample", grid_size=0.02, hash_type="fnv", mode="train", return_grid_coord=True),
|
868 |
+
dict(type="SphereCrop", sample_rate=0.6, mode="random"),
|
869 |
+
dict(type="SphereCrop", point_max=204800, mode="random"),
|
870 |
+
dict(type="CenterShift", apply_z=False),
|
871 |
+
dict(type="NormalizeColor"),
|
872 |
+
dict(type="Add", keys_dict=dict(condition="S3DIS")),
|
873 |
+
dict(type="ToTensor"),
|
874 |
+
dict(type="Collect", keys=("coord", "grid_coord", "segment", "condition"), feat_keys=("color", "normal")),
|
875 |
+
],
|
876 |
+
test_mode=False,
|
877 |
+
loop=1,
|
878 |
+
),
|
879 |
+
# ALC dataset
|
880 |
+
dict(
|
881 |
+
type="ARKitScenesLabelMakerConsensusDataset",
|
882 |
+
split=["train", "val"],
|
883 |
+
data_root="data/alc",
|
884 |
+
transform=[
|
885 |
+
dict(type="CenterShift", apply_z=True),
|
886 |
+
dict(type="RandomDropout", dropout_ratio=0.2, dropout_application_ratio=0.2),
|
887 |
+
# dict(type="RandomRotateTargetAngle", angle=(1/2, 1, 3/2), center=[0, 0, 0], axis="z", p=0.75),
|
888 |
+
dict(type="RandomRotate", angle=[-1, 1], axis="z", center=[0, 0, 0], p=0.5),
|
889 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="x", p=0.5),
|
890 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="y", p=0.5),
|
891 |
+
dict(type="RandomScale", scale=[0.9, 1.1]),
|
892 |
+
# dict(type="RandomShift", shift=[0.2, 0.2, 0.2]),
|
893 |
+
dict(type="RandomFlip", p=0.5),
|
894 |
+
dict(type="RandomJitter", sigma=0.005, clip=0.02),
|
895 |
+
dict(type="ElasticDistortion", distortion_params=[[0.2, 0.4], [0.8, 1.6]]),
|
896 |
+
dict(type="ChromaticAutoContrast", p=0.2, blend_factor=None),
|
897 |
+
dict(type="ChromaticTranslation", p=0.95, ratio=0.05),
|
898 |
+
dict(type="ChromaticJitter", p=0.95, std=0.05),
|
899 |
+
# dict(type="HueSaturationTranslation", hue_max=0.2, saturation_max=0.2),
|
900 |
+
# dict(type="RandomColorDrop", p=0.2, color_augment=0.0),
|
901 |
+
dict(
|
902 |
+
type="GridSample",
|
903 |
+
grid_size=0.02,
|
904 |
+
hash_type="fnv",
|
905 |
+
mode="train",
|
906 |
+
return_grid_coord=True,
|
907 |
+
),
|
908 |
+
dict(type="SphereCrop", point_max=102400, mode="random"),
|
909 |
+
dict(type="CenterShift", apply_z=False),
|
910 |
+
dict(type="NormalizeColor"),
|
911 |
+
# dict(type="ShufflePoint"),
|
912 |
+
dict(type="Add", keys_dict=dict(condition="ALC")),
|
913 |
+
dict(type="ToTensor"),
|
914 |
+
dict(
|
915 |
+
type="Collect",
|
916 |
+
keys=("coord", "grid_coord", "segment", "condition"),
|
917 |
+
feat_keys=("color", "normal"),
|
918 |
+
),
|
919 |
+
],
|
920 |
+
test_mode=False,
|
921 |
+
),
|
922 |
+
],
|
923 |
+
loop=1,
|
924 |
+
),
|
925 |
+
val=dict(
|
926 |
+
type="ScanNet200Dataset",
|
927 |
+
split="val",
|
928 |
+
data_root="data/scannet",
|
929 |
+
transform=[
|
930 |
+
dict(type="CenterShift", apply_z=True),
|
931 |
+
dict(type="GridSample", grid_size=0.02, hash_type="fnv", mode="train", return_grid_coord=True),
|
932 |
+
dict(type="CenterShift", apply_z=False),
|
933 |
+
dict(type="NormalizeColor"),
|
934 |
+
dict(type="ToTensor"),
|
935 |
+
dict(type="Add", keys_dict=dict(condition="ScanNet200")),
|
936 |
+
dict(type="Collect", keys=("coord", "grid_coord", "segment", "condition"), feat_keys=("color", "normal")),
|
937 |
+
],
|
938 |
+
test_mode=False,
|
939 |
+
),
|
940 |
+
test=dict(
|
941 |
+
type="ScanNet200Dataset",
|
942 |
+
split="val",
|
943 |
+
data_root="data/scannet",
|
944 |
+
transform=[dict(type="CenterShift", apply_z=True), dict(type="NormalizeColor")],
|
945 |
+
test_mode=True,
|
946 |
+
test_cfg=dict(
|
947 |
+
voxelize=dict(type="GridSample", grid_size=0.02, hash_type="fnv", mode="test", keys=("coord", "color", "normal"), return_grid_coord=True),
|
948 |
+
crop=None,
|
949 |
+
post_transform=[
|
950 |
+
dict(type="CenterShift", apply_z=False),
|
951 |
+
dict(type="Add", keys_dict=dict(condition="ScanNet200")),
|
952 |
+
dict(type="ToTensor"),
|
953 |
+
dict(type="Collect", keys=("coord", "grid_coord", "index", "condition"), feat_keys=("color", "normal")),
|
954 |
+
],
|
955 |
+
aug_transform=[
|
956 |
+
[{"type": "RandomRotateTargetAngle", "angle": [0], "axis": "z", "center": [0, 0, 0], "p": 1}],
|
957 |
+
[{"type": "RandomRotateTargetAngle", "angle": [0.5], "axis": "z", "center": [0, 0, 0], "p": 1}],
|
958 |
+
[{"type": "RandomRotateTargetAngle", "angle": [1], "axis": "z", "center": [0, 0, 0], "p": 1}],
|
959 |
+
[{"type": "RandomRotateTargetAngle", "angle": [1.5], "axis": "z", "center": [0, 0, 0], "p": 1}],
|
960 |
+
[{"type": "RandomRotateTargetAngle", "angle": [0], "axis": "z", "center": [0, 0, 0], "p": 1}, {"type": "RandomScale", "scale": [0.95, 0.95]}],
|
961 |
+
[{"type": "RandomRotateTargetAngle", "angle": [0.5], "axis": "z", "center": [0, 0, 0], "p": 1}, {"type": "RandomScale", "scale": [0.95, 0.95]}],
|
962 |
+
[{"type": "RandomRotateTargetAngle", "angle": [1], "axis": "z", "center": [0, 0, 0], "p": 1}, {"type": "RandomScale", "scale": [0.95, 0.95]}],
|
963 |
+
[{"type": "RandomRotateTargetAngle", "angle": [1.5], "axis": "z", "center": [0, 0, 0], "p": 1}, {"type": "RandomScale", "scale": [0.95, 0.95]}],
|
964 |
+
[{"type": "RandomRotateTargetAngle", "angle": [0], "axis": "z", "center": [0, 0, 0], "p": 1}, {"type": "RandomScale", "scale": [1.05, 1.05]}],
|
965 |
+
[{"type": "RandomRotateTargetAngle", "angle": [0.5], "axis": "z", "center": [0, 0, 0], "p": 1}, {"type": "RandomScale", "scale": [1.05, 1.05]}],
|
966 |
+
[{"type": "RandomRotateTargetAngle", "angle": [1], "axis": "z", "center": [0, 0, 0], "p": 1}, {"type": "RandomScale", "scale": [1.05, 1.05]}],
|
967 |
+
[{"type": "RandomRotateTargetAngle", "angle": [1.5], "axis": "z", "center": [0, 0, 0], "p": 1}, {"type": "RandomScale", "scale": [1.05, 1.05]}],
|
968 |
+
[{"type": "RandomFlip", "p": 1}],
|
969 |
+
],
|
970 |
+
),
|
971 |
+
),
|
972 |
+
)
|
configs/scannetpp/semseg-pt-v3m1-2-ppt-extreme-alc.py
ADDED
@@ -0,0 +1,445 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = [
|
2 |
+
"../_base_/default_runtime.py",
|
3 |
+
"../_base_/dataset/scannetpp.py",
|
4 |
+
]
|
5 |
+
|
6 |
+
# misc custom setting
|
7 |
+
batch_size = 24 # bs: total bs in all gpus
|
8 |
+
num_worker = 48
|
9 |
+
mix_prob = 0.8
|
10 |
+
empty_cache = False
|
11 |
+
enable_amp = True
|
12 |
+
find_unused_parameters = True
|
13 |
+
|
14 |
+
# trainer
|
15 |
+
train = dict(
|
16 |
+
type="MultiDatasetTrainer",
|
17 |
+
)
|
18 |
+
|
19 |
+
# model settings
|
20 |
+
model = dict(
|
21 |
+
type="PPT-v1m2",
|
22 |
+
backbone=dict(
|
23 |
+
type="PT-v3m1",
|
24 |
+
in_channels=6,
|
25 |
+
order=("z", "z-trans", "hilbert", "hilbert-trans"),
|
26 |
+
stride=(2, 2, 2, 2),
|
27 |
+
enc_depths=(3, 3, 3, 6, 3),
|
28 |
+
enc_channels=(48, 96, 192, 384, 512),
|
29 |
+
enc_num_head=(3, 6, 12, 24, 32),
|
30 |
+
enc_patch_size=(1024, 1024, 1024, 1024, 1024),
|
31 |
+
dec_depths=(3, 3, 3, 3),
|
32 |
+
dec_channels=(64, 96, 192, 384),
|
33 |
+
dec_num_head=(4, 6, 12, 24),
|
34 |
+
dec_patch_size=(1024, 1024, 1024, 1024),
|
35 |
+
mlp_ratio=4,
|
36 |
+
qkv_bias=True,
|
37 |
+
qk_scale=None,
|
38 |
+
attn_drop=0.0,
|
39 |
+
proj_drop=0.0,
|
40 |
+
drop_path=0.3,
|
41 |
+
shuffle_orders=True,
|
42 |
+
pre_norm=True,
|
43 |
+
enable_rpe=False,
|
44 |
+
enable_flash=True,
|
45 |
+
upcast_attention=False,
|
46 |
+
upcast_softmax=False,
|
47 |
+
cls_mode=False,
|
48 |
+
pdnorm_bn=True,
|
49 |
+
pdnorm_ln=True,
|
50 |
+
pdnorm_decouple=True,
|
51 |
+
pdnorm_adaptive=False,
|
52 |
+
pdnorm_affine=True,
|
53 |
+
pdnorm_conditions=("ScanNet", "ScanNet++", "S3DIS", "Structured3D", "ALC"),
|
54 |
+
),
|
55 |
+
criteria=[
|
56 |
+
dict(type="CrossEntropyLoss", loss_weight=1.0, ignore_index=-1),
|
57 |
+
dict(type="LovaszLoss", mode="multiclass", loss_weight=1.0, ignore_index=-1),
|
58 |
+
],
|
59 |
+
backbone_out_channels=64,
|
60 |
+
context_channels=256,
|
61 |
+
conditions=("ScanNet", "ScanNet++", "S3DIS", "Structured3D", "ALC"),
|
62 |
+
num_classes=(200, 100, 13, 25, 185),
|
63 |
+
)
|
64 |
+
|
65 |
+
# scheduler settings
|
66 |
+
epoch = 100
|
67 |
+
eval_epoch = 100
|
68 |
+
# epoch = 200
|
69 |
+
# eval_epoch = 200
|
70 |
+
optimizer = dict(type="AdamW", lr=0.005, weight_decay=0.05)
|
71 |
+
scheduler = dict(
|
72 |
+
type="OneCycleLR",
|
73 |
+
max_lr=[0.005, 0.0005],
|
74 |
+
pct_start=0.05,
|
75 |
+
anneal_strategy="cos",
|
76 |
+
div_factor=10.0,
|
77 |
+
final_div_factor=1000.0,
|
78 |
+
)
|
79 |
+
param_dicts = [dict(keyword="block", lr=0.0005)]
|
80 |
+
|
81 |
+
# dataset settings
|
82 |
+
data = dict(
|
83 |
+
num_classes=100,
|
84 |
+
ignore_index=-1,
|
85 |
+
train=dict(
|
86 |
+
type="ConcatDataset",
|
87 |
+
datasets=[
|
88 |
+
# ScanNet
|
89 |
+
dict(
|
90 |
+
type="ScanNet200Dataset",
|
91 |
+
split=["train", "val"],
|
92 |
+
data_root="data/scannet",
|
93 |
+
transform=[
|
94 |
+
dict(type="CenterShift", apply_z=True),
|
95 |
+
dict(
|
96 |
+
type="RandomDropout",
|
97 |
+
dropout_ratio=0.2,
|
98 |
+
dropout_application_ratio=0.2,
|
99 |
+
),
|
100 |
+
# dict(type="RandomRotateTargetAngle", angle=(1/2, 1, 3/2), center=[0, 0, 0], axis="z", p=0.75),
|
101 |
+
dict(
|
102 |
+
type="RandomRotate",
|
103 |
+
angle=[-1, 1],
|
104 |
+
axis="z",
|
105 |
+
center=[0, 0, 0],
|
106 |
+
p=0.5,
|
107 |
+
),
|
108 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="x", p=0.5),
|
109 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="y", p=0.5),
|
110 |
+
dict(type="RandomScale", scale=[0.9, 1.1]),
|
111 |
+
# dict(type="RandomShift", shift=[0.2, 0.2, 0.2]),
|
112 |
+
dict(type="RandomFlip", p=0.5),
|
113 |
+
dict(type="RandomJitter", sigma=0.005, clip=0.02),
|
114 |
+
dict(
|
115 |
+
type="ElasticDistortion",
|
116 |
+
distortion_params=[[0.2, 0.4], [0.8, 1.6]],
|
117 |
+
),
|
118 |
+
dict(type="ChromaticAutoContrast", p=0.2, blend_factor=None),
|
119 |
+
dict(type="ChromaticTranslation", p=0.95, ratio=0.05),
|
120 |
+
dict(type="ChromaticJitter", p=0.95, std=0.05),
|
121 |
+
# dict(type="HueSaturationTranslation", hue_max=0.2, saturation_max=0.2),
|
122 |
+
# dict(type="RandomColorDrop", p=0.2, color_augment=0.0),
|
123 |
+
dict(
|
124 |
+
type="GridSample",
|
125 |
+
grid_size=0.02,
|
126 |
+
hash_type="fnv",
|
127 |
+
mode="train",
|
128 |
+
return_grid_coord=True,
|
129 |
+
),
|
130 |
+
dict(type="SphereCrop", point_max=204800, mode="random"),
|
131 |
+
dict(type="CenterShift", apply_z=False),
|
132 |
+
dict(type="NormalizeColor"),
|
133 |
+
dict(type="ShufflePoint"),
|
134 |
+
dict(type="Add", keys_dict={"condition": "ScanNet"}),
|
135 |
+
dict(type="ToTensor"),
|
136 |
+
dict(
|
137 |
+
type="Collect",
|
138 |
+
keys=("coord", "grid_coord", "segment", "condition"),
|
139 |
+
feat_keys=("color", "normal"),
|
140 |
+
),
|
141 |
+
],
|
142 |
+
test_mode=False,
|
143 |
+
loop=1, # sampling weight
|
144 |
+
),
|
145 |
+
# ScanNetPPDataset
|
146 |
+
dict(
|
147 |
+
type="ScanNetPPDataset",
|
148 |
+
# split="train_grid1mm_chunk6x6_stride3x3",
|
149 |
+
split=[
|
150 |
+
"train_grid1mm_chunk6x6_stride3x3",
|
151 |
+
"val_grid1mm_chunk6x6_stride3x3",
|
152 |
+
],
|
153 |
+
data_root="data/scannetpp",
|
154 |
+
transform=[
|
155 |
+
dict(type="CenterShift", apply_z=True),
|
156 |
+
dict(
|
157 |
+
type="RandomDropout",
|
158 |
+
dropout_ratio=0.2,
|
159 |
+
dropout_application_ratio=0.2,
|
160 |
+
),
|
161 |
+
# dict(type="RandomRotateTargetAngle", angle=(1/2, 1, 3/2), center=[0, 0, 0], axis="z", p=0.75),
|
162 |
+
dict(
|
163 |
+
type="RandomRotate",
|
164 |
+
angle=[-1, 1],
|
165 |
+
axis="z",
|
166 |
+
center=[0, 0, 0],
|
167 |
+
p=0.5,
|
168 |
+
),
|
169 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="x", p=0.5),
|
170 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="y", p=0.5),
|
171 |
+
dict(type="RandomScale", scale=[0.9, 1.1]),
|
172 |
+
# dict(type="RandomShift", shift=[0.2, 0.2, 0.2]),
|
173 |
+
dict(type="RandomFlip", p=0.5),
|
174 |
+
dict(type="RandomJitter", sigma=0.005, clip=0.02),
|
175 |
+
dict(
|
176 |
+
type="ElasticDistortion",
|
177 |
+
distortion_params=[[0.2, 0.4], [0.8, 1.6]],
|
178 |
+
),
|
179 |
+
dict(type="ChromaticAutoContrast", p=0.2, blend_factor=None),
|
180 |
+
dict(type="ChromaticTranslation", p=0.95, ratio=0.05),
|
181 |
+
dict(type="ChromaticJitter", p=0.95, std=0.05),
|
182 |
+
# dict(type="HueSaturationTranslation", hue_max=0.2, saturation_max=0.2),
|
183 |
+
# dict(type="RandomColorDrop", p=0.2, color_augment=0.0),
|
184 |
+
dict(
|
185 |
+
type="GridSample",
|
186 |
+
grid_size=0.02,
|
187 |
+
hash_type="fnv",
|
188 |
+
mode="train",
|
189 |
+
return_grid_coord=True,
|
190 |
+
),
|
191 |
+
dict(type="SphereCrop", point_max=204800, mode="random"),
|
192 |
+
dict(type="CenterShift", apply_z=False),
|
193 |
+
dict(type="NormalizeColor"),
|
194 |
+
# dict(type="ShufflePoint"),
|
195 |
+
dict(type="Add", keys_dict={"condition": "ScanNet++"}),
|
196 |
+
dict(type="ToTensor"),
|
197 |
+
dict(
|
198 |
+
type="Collect",
|
199 |
+
keys=("coord", "grid_coord", "segment", "condition"),
|
200 |
+
feat_keys=("color", "normal"),
|
201 |
+
),
|
202 |
+
],
|
203 |
+
test_mode=False,
|
204 |
+
),
|
205 |
+
# ALC dataset
|
206 |
+
dict(
|
207 |
+
type="ARKitScenesLabelMakerConsensusDataset",
|
208 |
+
split=["train", "val"],
|
209 |
+
data_root="data/alc",
|
210 |
+
transform=[
|
211 |
+
dict(type="CenterShift", apply_z=True),
|
212 |
+
dict(type="RandomDropout", dropout_ratio=0.2, dropout_application_ratio=0.2),
|
213 |
+
# dict(type="RandomRotateTargetAngle", angle=(1/2, 1, 3/2), center=[0, 0, 0], axis="z", p=0.75),
|
214 |
+
dict(type="RandomRotate", angle=[-1, 1], axis="z", center=[0, 0, 0], p=0.5),
|
215 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="x", p=0.5),
|
216 |
+
dict(type="RandomRotate", angle=[-1 / 64, 1 / 64], axis="y", p=0.5),
|
217 |
+
dict(type="RandomScale", scale=[0.9, 1.1]),
|
218 |
+
# dict(type="RandomShift", shift=[0.2, 0.2, 0.2]),
|
219 |
+
dict(type="RandomFlip", p=0.5),
|
220 |
+
dict(type="RandomJitter", sigma=0.005, clip=0.02),
|
221 |
+
dict(type="ElasticDistortion", distortion_params=[[0.2, 0.4], [0.8, 1.6]]),
|
222 |
+
dict(type="ChromaticAutoContrast", p=0.2, blend_factor=None),
|
223 |
+
dict(type="ChromaticTranslation", p=0.95, ratio=0.05),
|
224 |
+
dict(type="ChromaticJitter", p=0.95, std=0.05),
|
225 |
+
# dict(type="HueSaturationTranslation", hue_max=0.2, saturation_max=0.2),
|
226 |
+
# dict(type="RandomColorDrop", p=0.2, color_augment=0.0),
|
227 |
+
dict(
|
228 |
+
type="GridSample",
|
229 |
+
grid_size=0.02,
|
230 |
+
hash_type="fnv",
|
231 |
+
mode="train",
|
232 |
+
return_grid_coord=True,
|
233 |
+
),
|
234 |
+
dict(type="SphereCrop", point_max=102400, mode="random"),
|
235 |
+
dict(type="CenterShift", apply_z=False),
|
236 |
+
dict(type="NormalizeColor"),
|
237 |
+
# dict(type="ShufflePoint"),
|
238 |
+
dict(type="Add", keys_dict=dict(condition="ALC")),
|
239 |
+
dict(type="ToTensor"),
|
240 |
+
dict(
|
241 |
+
type="Collect",
|
242 |
+
keys=("coord", "grid_coord", "segment", "condition"),
|
243 |
+
feat_keys=("color", "normal"),
|
244 |
+
),
|
245 |
+
],
|
246 |
+
test_mode=False,
|
247 |
+
loop=2,
|
248 |
+
),
|
249 |
+
],
|
250 |
+
),
|
251 |
+
val=dict(
|
252 |
+
type="ScanNetPPDataset",
|
253 |
+
split="val",
|
254 |
+
data_root="data/scannetpp",
|
255 |
+
transform=[
|
256 |
+
dict(type="CenterShift", apply_z=True),
|
257 |
+
dict(
|
258 |
+
type="GridSample",
|
259 |
+
grid_size=0.02,
|
260 |
+
hash_type="fnv",
|
261 |
+
mode="train",
|
262 |
+
return_grid_coord=True,
|
263 |
+
),
|
264 |
+
dict(type="CenterShift", apply_z=False),
|
265 |
+
dict(type="NormalizeColor"),
|
266 |
+
dict(type="ToTensor"),
|
267 |
+
dict(type="Add", keys_dict={"condition": "ScanNet++"}),
|
268 |
+
dict(
|
269 |
+
type="Collect",
|
270 |
+
keys=("coord", "grid_coord", "segment", "condition"),
|
271 |
+
feat_keys=("color", "normal"),
|
272 |
+
),
|
273 |
+
],
|
274 |
+
test_mode=False,
|
275 |
+
),
|
276 |
+
test=dict(
|
277 |
+
type="ScanNetPPDataset",
|
278 |
+
split="test",
|
279 |
+
data_root="data/scannetpp",
|
280 |
+
transform=[
|
281 |
+
dict(type="CenterShift", apply_z=True),
|
282 |
+
dict(type="NormalizeColor"),
|
283 |
+
dict(type="Copy", keys_dict={"segment": "origin_segment"}),
|
284 |
+
dict(
|
285 |
+
type="GridSample",
|
286 |
+
grid_size=0.01,
|
287 |
+
hash_type="fnv",
|
288 |
+
mode="train",
|
289 |
+
keys=("coord", "color", "normal", "segment"),
|
290 |
+
return_inverse=True,
|
291 |
+
),
|
292 |
+
],
|
293 |
+
test_mode=True,
|
294 |
+
test_cfg=dict(
|
295 |
+
voxelize=dict(
|
296 |
+
type="GridSample",
|
297 |
+
grid_size=0.02,
|
298 |
+
hash_type="fnv",
|
299 |
+
mode="test",
|
300 |
+
keys=("coord", "color", "normal"),
|
301 |
+
return_grid_coord=True,
|
302 |
+
),
|
303 |
+
crop=None,
|
304 |
+
post_transform=[
|
305 |
+
dict(type="CenterShift", apply_z=False),
|
306 |
+
dict(type="Add", keys_dict={"condition": "ScanNet++"}),
|
307 |
+
dict(type="ToTensor"),
|
308 |
+
dict(
|
309 |
+
type="Collect",
|
310 |
+
keys=("coord", "grid_coord", "index", "condition"),
|
311 |
+
feat_keys=("color", "normal"),
|
312 |
+
),
|
313 |
+
],
|
314 |
+
aug_transform=[
|
315 |
+
[
|
316 |
+
dict(
|
317 |
+
type="RandomRotateTargetAngle",
|
318 |
+
angle=[0],
|
319 |
+
axis="z",
|
320 |
+
center=[0, 0, 0],
|
321 |
+
p=1,
|
322 |
+
)
|
323 |
+
],
|
324 |
+
[
|
325 |
+
dict(
|
326 |
+
type="RandomRotateTargetAngle",
|
327 |
+
angle=[1 / 2],
|
328 |
+
axis="z",
|
329 |
+
center=[0, 0, 0],
|
330 |
+
p=1,
|
331 |
+
)
|
332 |
+
],
|
333 |
+
[
|
334 |
+
dict(
|
335 |
+
type="RandomRotateTargetAngle",
|
336 |
+
angle=[1],
|
337 |
+
axis="z",
|
338 |
+
center=[0, 0, 0],
|
339 |
+
p=1,
|
340 |
+
)
|
341 |
+
],
|
342 |
+
[
|
343 |
+
dict(
|
344 |
+
type="RandomRotateTargetAngle",
|
345 |
+
angle=[3 / 2],
|
346 |
+
axis="z",
|
347 |
+
center=[0, 0, 0],
|
348 |
+
p=1,
|
349 |
+
)
|
350 |
+
],
|
351 |
+
[
|
352 |
+
dict(
|
353 |
+
type="RandomRotateTargetAngle",
|
354 |
+
angle=[0],
|
355 |
+
axis="z",
|
356 |
+
center=[0, 0, 0],
|
357 |
+
p=1,
|
358 |
+
),
|
359 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
360 |
+
],
|
361 |
+
[
|
362 |
+
dict(
|
363 |
+
type="RandomRotateTargetAngle",
|
364 |
+
angle=[1 / 2],
|
365 |
+
axis="z",
|
366 |
+
center=[0, 0, 0],
|
367 |
+
p=1,
|
368 |
+
),
|
369 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
370 |
+
],
|
371 |
+
[
|
372 |
+
dict(
|
373 |
+
type="RandomRotateTargetAngle",
|
374 |
+
angle=[1],
|
375 |
+
axis="z",
|
376 |
+
center=[0, 0, 0],
|
377 |
+
p=1,
|
378 |
+
),
|
379 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
380 |
+
],
|
381 |
+
[
|
382 |
+
dict(
|
383 |
+
type="RandomRotateTargetAngle",
|
384 |
+
angle=[3 / 2],
|
385 |
+
axis="z",
|
386 |
+
center=[0, 0, 0],
|
387 |
+
p=1,
|
388 |
+
),
|
389 |
+
dict(type="RandomScale", scale=[0.95, 0.95]),
|
390 |
+
],
|
391 |
+
[
|
392 |
+
dict(
|
393 |
+
type="RandomRotateTargetAngle",
|
394 |
+
angle=[0],
|
395 |
+
axis="z",
|
396 |
+
center=[0, 0, 0],
|
397 |
+
p=1,
|
398 |
+
),
|
399 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
400 |
+
],
|
401 |
+
[
|
402 |
+
dict(
|
403 |
+
type="RandomRotateTargetAngle",
|
404 |
+
angle=[1 / 2],
|
405 |
+
axis="z",
|
406 |
+
center=[0, 0, 0],
|
407 |
+
p=1,
|
408 |
+
),
|
409 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
410 |
+
],
|
411 |
+
[
|
412 |
+
dict(
|
413 |
+
type="RandomRotateTargetAngle",
|
414 |
+
angle=[1],
|
415 |
+
axis="z",
|
416 |
+
center=[0, 0, 0],
|
417 |
+
p=1,
|
418 |
+
),
|
419 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
420 |
+
],
|
421 |
+
[
|
422 |
+
dict(
|
423 |
+
type="RandomRotateTargetAngle",
|
424 |
+
angle=[3 / 2],
|
425 |
+
axis="z",
|
426 |
+
center=[0, 0, 0],
|
427 |
+
p=1,
|
428 |
+
),
|
429 |
+
dict(type="RandomScale", scale=[1.05, 1.05]),
|
430 |
+
],
|
431 |
+
[dict(type="RandomFlip", p=1)],
|
432 |
+
],
|
433 |
+
),
|
434 |
+
),
|
435 |
+
)
|
436 |
+
|
437 |
+
# hook
|
438 |
+
hooks = [
|
439 |
+
dict(type="CheckpointLoader"),
|
440 |
+
dict(type="IterationTimer", warmup_iter=2),
|
441 |
+
dict(type="InformationWriter"),
|
442 |
+
dict(type="SemSegEvaluator"),
|
443 |
+
dict(type="CheckpointSaver", save_freq=None),
|
444 |
+
dict(type="PreciseEvaluator", test_last=True),
|
445 |
+
]
|
pointcept/datasets/alc.py
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import glob
|
2 |
+
import os
|
3 |
+
from collections.abc import Sequence
|
4 |
+
from copy import deepcopy
|
5 |
+
|
6 |
+
import numpy as np
|
7 |
+
import torch
|
8 |
+
from labelmaker.label_data import get_wordnet
|
9 |
+
from torch.utils.data import Dataset
|
10 |
+
|
11 |
+
from pointcept.utils.cache import shared_dict
|
12 |
+
from pointcept.utils.logger import get_root_logger
|
13 |
+
|
14 |
+
from .builder import DATASETS
|
15 |
+
from .preprocessing.alc.preprocess_arkitscenes_labelmaker_consensus import get_wordnet_compact_mapping
|
16 |
+
from .preprocessing.scannet.meta_data.scannet200_constants import VALID_CLASS_IDS_20, VALID_CLASS_IDS_200
|
17 |
+
from .transform import TRANSFORMS, Compose
|
18 |
+
|
19 |
+
|
20 |
+
@DATASETS.register_module()
|
21 |
+
class ARKitScenesLabelMakerConsensusDataset(Dataset):
|
22 |
+
|
23 |
+
label_key = "semantic_pseudo_gt_wn199"
|
24 |
+
|
25 |
+
def __init__(
|
26 |
+
self,
|
27 |
+
split="train",
|
28 |
+
data_root="data/alc",
|
29 |
+
transform=None,
|
30 |
+
ignore_index=-1,
|
31 |
+
test_mode=False,
|
32 |
+
test_cfg=None,
|
33 |
+
cache=False,
|
34 |
+
loop=1,
|
35 |
+
):
|
36 |
+
super(ARKitScenesLabelMakerConsensusDataset, self).__init__()
|
37 |
+
self.get_class_to_id()
|
38 |
+
|
39 |
+
self.data_root = data_root
|
40 |
+
self.split = split
|
41 |
+
self.transform = Compose(transform)
|
42 |
+
self.cache = cache
|
43 |
+
self.loop = loop if not test_mode else 1 # force make loop = 1 while in test mode
|
44 |
+
self.test_mode = test_mode
|
45 |
+
self.test_cfg = test_cfg if test_mode else None
|
46 |
+
|
47 |
+
if test_mode:
|
48 |
+
self.test_voxelize = TRANSFORMS.build(self.test_cfg.voxelize)
|
49 |
+
self.test_crop = TRANSFORMS.build(self.test_cfg.crop) if self.test_cfg.crop else None
|
50 |
+
self.post_transform = Compose(self.test_cfg.post_transform)
|
51 |
+
self.aug_transform = [Compose(aug) for aug in self.test_cfg.aug_transform]
|
52 |
+
|
53 |
+
self.data_list = self.get_data_list()
|
54 |
+
|
55 |
+
self.ignore_index = ignore_index
|
56 |
+
|
57 |
+
logger = get_root_logger()
|
58 |
+
logger.info(
|
59 |
+
"Totally {} x {} samples in {} set.".format(
|
60 |
+
len(self.data_list),
|
61 |
+
self.loop,
|
62 |
+
split,
|
63 |
+
)
|
64 |
+
)
|
65 |
+
|
66 |
+
def get_class_to_id(self):
|
67 |
+
self.class2id = get_wordnet_compact_mapping()[0]
|
68 |
+
|
69 |
+
def get_data_list(self):
|
70 |
+
if isinstance(self.split, str):
|
71 |
+
data_list = glob.glob(os.path.join(self.data_root, self.split, "*.pth"))
|
72 |
+
elif isinstance(self.split, Sequence):
|
73 |
+
data_list = []
|
74 |
+
for split in self.split:
|
75 |
+
data_list += glob.glob(os.path.join(self.data_root, split, "*.pth"))
|
76 |
+
else:
|
77 |
+
raise NotImplementedError
|
78 |
+
return data_list
|
79 |
+
|
80 |
+
def get_data(self, idx):
|
81 |
+
data_path = self.data_list[idx % len(self.data_list)]
|
82 |
+
|
83 |
+
if not self.cache:
|
84 |
+
data = torch.load(data_path)
|
85 |
+
else:
|
86 |
+
data_name = data_path.replace(os.path.dirname(self.data_root), "").split(".")[0]
|
87 |
+
cache_name = "pointcept" + data_name.replace(os.path.sep, "-")
|
88 |
+
data = shared_dict(cache_name)
|
89 |
+
|
90 |
+
coord = data["coord"]
|
91 |
+
color = data["color"]
|
92 |
+
normal = data["normal"]
|
93 |
+
scene_id = data["scene_id"]
|
94 |
+
segment = data[self.label_key].reshape(-1)
|
95 |
+
instance = np.ones(coord.shape[0]) * -1
|
96 |
+
|
97 |
+
data_dict = dict(
|
98 |
+
coord=coord,
|
99 |
+
normal=normal,
|
100 |
+
color=color,
|
101 |
+
segment=segment,
|
102 |
+
instance=instance,
|
103 |
+
scene_id=scene_id,
|
104 |
+
)
|
105 |
+
|
106 |
+
return data_dict
|
107 |
+
|
108 |
+
def get_data_name(self, idx):
|
109 |
+
return os.path.basename(self.data_list[idx % len(self.data_list)]).split(".")[0]
|
110 |
+
|
111 |
+
def prepare_train_data(self, idx):
|
112 |
+
# load data
|
113 |
+
data_dict = self.get_data(idx)
|
114 |
+
data_dict = self.transform(data_dict)
|
115 |
+
return data_dict
|
116 |
+
|
117 |
+
def prepare_test_data(self, idx):
|
118 |
+
# load data
|
119 |
+
data_dict = self.get_data(idx)
|
120 |
+
segment = data_dict.pop("segment")
|
121 |
+
data_dict = self.transform(data_dict)
|
122 |
+
data_dict_list = []
|
123 |
+
for aug in self.aug_transform:
|
124 |
+
data_dict_list.append(aug(deepcopy(data_dict)))
|
125 |
+
|
126 |
+
input_dict_list = []
|
127 |
+
for data in data_dict_list:
|
128 |
+
data_part_list = self.test_voxelize(data)
|
129 |
+
for data_part in data_part_list:
|
130 |
+
if self.test_crop:
|
131 |
+
data_part = self.test_crop(data_part)
|
132 |
+
else:
|
133 |
+
data_part = [data_part]
|
134 |
+
input_dict_list += data_part
|
135 |
+
|
136 |
+
for i in range(len(input_dict_list)):
|
137 |
+
input_dict_list[i] = self.post_transform(input_dict_list[i])
|
138 |
+
data_dict = dict(fragment_list=input_dict_list, segment=segment, name=self.get_data_name(idx))
|
139 |
+
return data_dict
|
140 |
+
|
141 |
+
def __getitem__(self, idx):
|
142 |
+
if self.test_mode:
|
143 |
+
return self.prepare_test_data(idx)
|
144 |
+
else:
|
145 |
+
return self.prepare_train_data(idx)
|
146 |
+
|
147 |
+
def __len__(self):
|
148 |
+
return len(self.data_list) * self.loop
|
149 |
+
|
150 |
+
|
151 |
+
@DATASETS.register_module()
|
152 |
+
class ARKitScenesLabelMakerScanNet200Dataset(ARKitScenesLabelMakerConsensusDataset):
|
153 |
+
label_key = "sem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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import warnings
|
2 |
+
|
3 |
+
import torch
|
4 |
+
|
5 |
+
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
6 |
+
|
7 |
+
import argparse
|
8 |
+
import glob
|
9 |
+
import json
|
10 |
+
import multiprocessing as mp
|
11 |
+
import os
|
12 |
+
from concurrent.futures import ProcessPoolExecutor
|
13 |
+
from itertools import repeat
|
14 |
+
from pathlib import Path
|
15 |
+
|
16 |
+
import numpy as np
|
17 |
+
import pandas as pd
|
18 |
+
import plyfile
|
19 |
+
from labelmaker import label_mappings
|
20 |
+
from labelmaker.label_data import get_wordnet
|
21 |
+
from labelmaker.scannet_200_labels import VALID_CLASS_IDS_200
|
22 |
+
from tqdm import tqdm
|
23 |
+
|
24 |
+
IGNORE_INDEX = -1
|
25 |
+
|
26 |
+
|
27 |
+
def get_wordnet_to_scannet200_mapping():
|
28 |
+
table = pd.read_csv(Path(os.path.dirname(os.path.realpath(label_mappings.__file__))) / "mappings" / "label_mapping.csv")
|
29 |
+
wordnet = get_wordnet()
|
30 |
+
wordnet_keys = [x["name"] for x in wordnet]
|
31 |
+
mapping = {}
|
32 |
+
for row in table.index:
|
33 |
+
if table["wnsynsetkey"][row] not in wordnet_keys:
|
34 |
+
continue
|
35 |
+
scannet_id = table.loc[row, "id"]
|
36 |
+
wordnet199_id = next(x for x in wordnet if x["name"] == table["wnsynsetkey"][row])["id"]
|
37 |
+
|
38 |
+
if scannet_id in VALID_CLASS_IDS_200:
|
39 |
+
mapping.setdefault(wordnet199_id, set()).add(scannet_id)
|
40 |
+
|
41 |
+
wn199_size = np.array([x["id"] for x in wordnet]).max() + 1
|
42 |
+
mapping_array = np.zeros(shape=(wn199_size,), dtype=np.uint16)
|
43 |
+
for wordnet199_id in mapping.keys():
|
44 |
+
mapping_array[wordnet199_id] = min(mapping[wordnet199_id])
|
45 |
+
|
46 |
+
return mapping_array
|
47 |
+
|
48 |
+
|
49 |
+
def get_wordnet_compact_mapping():
|
50 |
+
wordnet_info = get_wordnet()[1:]
|
51 |
+
wordnet_info = sorted(wordnet_info, key=lambda x: x["id"])
|
52 |
+
|
53 |
+
class2id = np.array([item["id"] for item in wordnet_info])
|
54 |
+
id2class = np.array([IGNORE_INDEX] * (class2id.max() + 1))
|
55 |
+
for class_, id_ in enumerate(class2id):
|
56 |
+
id2class[id_] = class_
|
57 |
+
|
58 |
+
return class2id, id2class
|
59 |
+
|
60 |
+
|
61 |
+
def get_scannet200_compact_mapping():
|
62 |
+
class2id = np.array(VALID_CLASS_IDS_200)
|
63 |
+
id2class = np.array([IGNORE_INDEX] * (class2id.max() + 1))
|
64 |
+
for class_, id_ in enumerate(VALID_CLASS_IDS_200):
|
65 |
+
id2class[id_] = class_
|
66 |
+
|
67 |
+
return class2id, id2class
|
68 |
+
|
69 |
+
|
70 |
+
def get_wordnet_names():
|
71 |
+
wordnet_info = get_wordnet()[1:]
|
72 |
+
wordnet_info = sorted(wordnet_info, key=lambda x: x["id"])
|
73 |
+
|
74 |
+
names = [item["name"].split(".")[0].replace("_", " ") for item in wordnet_info]
|
75 |
+
|
76 |
+
return names
|
77 |
+
|
78 |
+
|
79 |
+
def read_plypcd(filepath):
|
80 |
+
"""Read ply file and return it as numpy array. Returns None if emtpy."""
|
81 |
+
|
82 |
+
with open(filepath, "rb") as f:
|
83 |
+
plydata = plyfile.PlyData.read(f)
|
84 |
+
if plydata.elements:
|
85 |
+
data = plydata.elements[0].data
|
86 |
+
coords = np.array([data["x"], data["y"], data["z"]], dtype=np.float32).T
|
87 |
+
|
88 |
+
colors = None
|
89 |
+
if ({"red", "green", "blue"} - set(data.dtype.names)) == set():
|
90 |
+
colors = np.array([data["red"], data["green"], data["blue"]], dtype=np.uint8).T
|
91 |
+
|
92 |
+
normals = None
|
93 |
+
if ({"nx", "ny", "nz"} - set(data.dtype.names)) == set():
|
94 |
+
normals = np.array([data["nx"], data["ny"], data["nz"]], dtype=np.float32).T
|
95 |
+
|
96 |
+
return coords, colors, normals
|
97 |
+
|
98 |
+
|
99 |
+
def handle_process(
|
100 |
+
scene_dir: str,
|
101 |
+
output_path: str,
|
102 |
+
label_mapping,
|
103 |
+
wn199_id2class,
|
104 |
+
scannet200_id2class,
|
105 |
+
):
|
106 |
+
scene_dir = Path(scene_dir)
|
107 |
+
|
108 |
+
print(f"Processing: {scene_dir.name} in {scene_dir.parent.name}")
|
109 |
+
|
110 |
+
coords, colors, normals = read_plypcd(str(scene_dir / "pcd_downsampled.ply"))
|
111 |
+
save_dict = dict(
|
112 |
+
coord=coords,
|
113 |
+
color=colors,
|
114 |
+
scene_id=scene_dir.name,
|
115 |
+
normal=normals,
|
116 |
+
)
|
117 |
+
|
118 |
+
label_file = scene_dir / "labels_downsampled.txt"
|
119 |
+
wordnet_label = np.loadtxt(str(label_file), dtype=np.uint8).reshape(-1, 1)
|
120 |
+
scannet200_label = label_mapping[wordnet_label]
|
121 |
+
save_dict["semantic_pseudo_gt_wn199"] = wn199_id2class[wordnet_label]
|
122 |
+
save_dict["semantic_pseudo_gt_scannet200"] = scannet200_id2class[scannet200_label]
|
123 |
+
|
124 |
+
torch.save(save_dict, output_path)
|
125 |
+
|
126 |
+
|
127 |
+
if __name__ == "__main__":
|
128 |
+
parser = argparse.ArgumentParser()
|
129 |
+
parser.add_argument(
|
130 |
+
"--dataset_root",
|
131 |
+
required=True,
|
132 |
+
help="Path to the ScanNet dataset containing scene folders",
|
133 |
+
)
|
134 |
+
parser.add_argument(
|
135 |
+
"--output_root",
|
136 |
+
required=True,
|
137 |
+
help="Output path where train/val folders will be located",
|
138 |
+
)
|
139 |
+
config = parser.parse_args()
|
140 |
+
|
141 |
+
# Create output directories
|
142 |
+
train_output_dir = os.path.join(config.output_root, "train")
|
143 |
+
os.makedirs(train_output_dir, exist_ok=True)
|
144 |
+
val_output_dir = os.path.join(config.output_root, "val")
|
145 |
+
os.makedirs(val_output_dir, exist_ok=True)
|
146 |
+
|
147 |
+
# Load label map
|
148 |
+
wn_scannet200_label_mapping = get_wordnet_to_scannet200_mapping()
|
149 |
+
_, wn199_id2class = get_wordnet_compact_mapping()
|
150 |
+
_, scannet200_id2class = get_scannet200_compact_mapping()
|
151 |
+
|
152 |
+
scene_dirs = []
|
153 |
+
output_paths = []
|
154 |
+
|
155 |
+
# Load train/val splits
|
156 |
+
train_folder = Path(config.dataset_root) / "Training"
|
157 |
+
train_scene_names = os.listdir(str(train_folder))
|
158 |
+
for scene in tqdm(train_scene_names):
|
159 |
+
file_path = train_folder / scene / "pcd_downsampled.ply"
|
160 |
+
if file_path.exists() and os.path.getsize(str(file_path)) <= 50 * 1024 * 1024:
|
161 |
+
scene_dirs.append(str(train_folder / scene))
|
162 |
+
output_paths.append(str(Path(config.output_root) / "train" / f"{scene}.pth"))
|
163 |
+
|
164 |
+
val_folder = Path(config.dataset_root) / "Validation"
|
165 |
+
val_scene_names = os.listdir(str(val_folder))
|
166 |
+
for scene in tqdm(val_scene_names):
|
167 |
+
file_path = val_folder / scene / "pcd_downsampled.ply"
|
168 |
+
if file_path.exists() and os.path.getsize(str(file_path)) <= 50 * 1024 * 1024:
|
169 |
+
scene_dirs.append(str(val_folder / scene))
|
170 |
+
output_paths.append(str(Path(config.output_root) / "val" / f"{scene}.pth"))
|
171 |
+
|
172 |
+
# Preprocess data.
|
173 |
+
print("Processing scenes...")
|
174 |
+
pool = ProcessPoolExecutor(max_workers=mp.cpu_count())
|
175 |
+
print(f"Using {mp.cpu_count()} cores")
|
176 |
+
# pool = ProcessPoolExecutor(max_workers=1)
|
177 |
+
_ = list(
|
178 |
+
pool.map(
|
179 |
+
handle_process,
|
180 |
+
scene_dirs,
|
181 |
+
output_paths,
|
182 |
+
repeat(wn_scannet200_label_mapping),
|
183 |
+
repeat(wn199_id2class),
|
184 |
+
repeat(scannet200_id2class),
|
185 |
+
)
|
186 |
+
)
|
187 |
+
|
188 |
+
|
189 |
+
WORDNET_NAMES = (
|
190 |
+
"wall",
|
191 |
+
"chair",
|
192 |
+
"book",
|
193 |
+
"cabinet",
|
194 |
+
"door",
|
195 |
+
"floor",
|
196 |
+
"ashcan",
|
197 |
+
"table",
|
198 |
+
"window",
|
199 |
+
"bookshelf",
|
200 |
+
"display",
|
201 |
+
"cushion",
|
202 |
+
"box",
|
203 |
+
"picture",
|
204 |
+
"ceiling",
|
205 |
+
"doorframe",
|
206 |
+
"desk",
|
207 |
+
"swivel chair",
|
208 |
+
"towel",
|
209 |
+
"sofa",
|
210 |
+
"sink",
|
211 |
+
"backpack",
|
212 |
+
"lamp",
|
213 |
+
"chest of drawers",
|
214 |
+
"apparel",
|
215 |
+
"armchair",
|
216 |
+
"bed",
|
217 |
+
"curtain",
|
218 |
+
"mirror",
|
219 |
+
"plant",
|
220 |
+
"radiator",
|
221 |
+
"toilet tissue",
|
222 |
+
"shoe",
|
223 |
+
"bag",
|
224 |
+
"bottle",
|
225 |
+
"countertop",
|
226 |
+
"coffee table",
|
227 |
+
"toilet",
|
228 |
+
"computer keyboard",
|
229 |
+
"fridge",
|
230 |
+
"stool",
|
231 |
+
"computer",
|
232 |
+
"mug",
|
233 |
+
"telephone",
|
234 |
+
"light",
|
235 |
+
"jacket",
|
236 |
+
"bathtub",
|
237 |
+
"shower curtain",
|
238 |
+
"microwave",
|
239 |
+
"footstool",
|
240 |
+
"baggage",
|
241 |
+
"laptop",
|
242 |
+
"printer",
|
243 |
+
"shower stall",
|
244 |
+
"soap dispenser",
|
245 |
+
"stove",
|
246 |
+
"fan",
|
247 |
+
"paper",
|
248 |
+
"stand",
|
249 |
+
"bench",
|
250 |
+
"wardrobe",
|
251 |
+
"blanket",
|
252 |
+
"booth",
|
253 |
+
"duplicator",
|
254 |
+
"bar",
|
255 |
+
"soap dish",
|
256 |
+
"switch",
|
257 |
+
"coffee maker",
|
258 |
+
"decoration",
|
259 |
+
"range hood",
|
260 |
+
"blackboard",
|
261 |
+
"clock",
|
262 |
+
"railing",
|
263 |
+
"mat",
|
264 |
+
"seat",
|
265 |
+
"bannister",
|
266 |
+
"container",
|
267 |
+
"mouse",
|
268 |
+
"person",
|
269 |
+
"stairway",
|
270 |
+
"basket",
|
271 |
+
"dumbbell",
|
272 |
+
"column",
|
273 |
+
"bucket",
|
274 |
+
"windowsill",
|
275 |
+
"signboard",
|
276 |
+
"dishwasher",
|
277 |
+
"loudspeaker",
|
278 |
+
"washer",
|
279 |
+
"paper towel",
|
280 |
+
"clothes hamper",
|
281 |
+
"piano",
|
282 |
+
"sack",
|
283 |
+
"handcart",
|
284 |
+
"blind",
|
285 |
+
"dish rack",
|
286 |
+
"mailbox",
|
287 |
+
"bag",
|
288 |
+
"bicycle",
|
289 |
+
"ladder",
|
290 |
+
"rack",
|
291 |
+
"tray",
|
292 |
+
"toaster",
|
293 |
+
"paper cutter",
|
294 |
+
"plunger",
|
295 |
+
"dryer",
|
296 |
+
"guitar",
|
297 |
+
"fire extinguisher",
|
298 |
+
"pitcher",
|
299 |
+
"pipe",
|
300 |
+
"plate",
|
301 |
+
"vacuum",
|
302 |
+
"bowl",
|
303 |
+
"hat",
|
304 |
+
"rod",
|
305 |
+
"water cooler",
|
306 |
+
"kettle",
|
307 |
+
"oven",
|
308 |
+
"scale",
|
309 |
+
"broom",
|
310 |
+
"hand blower",
|
311 |
+
"coatrack",
|
312 |
+
"teddy",
|
313 |
+
"alarm clock",
|
314 |
+
"ironing board",
|
315 |
+
"fire alarm",
|
316 |
+
"machine",
|
317 |
+
"music stand",
|
318 |
+
"fireplace",
|
319 |
+
"furniture",
|
320 |
+
"vase",
|
321 |
+
"vent",
|
322 |
+
"candle",
|
323 |
+
"crate",
|
324 |
+
"dustpan",
|
325 |
+
"earphone",
|
326 |
+
"jar",
|
327 |
+
"projector",
|
328 |
+
"gat",
|
329 |
+
"step",
|
330 |
+
"step stool",
|
331 |
+
"vending machine",
|
332 |
+
"coat",
|
333 |
+
"coat hanger",
|
334 |
+
"drinking fountain",
|
335 |
+
"hamper",
|
336 |
+
"thermostat",
|
337 |
+
"banner",
|
338 |
+
"iron",
|
339 |
+
"soap",
|
340 |
+
"chopping board",
|
341 |
+
"kitchen island",
|
342 |
+
"shirt",
|
343 |
+
"sleeping bag",
|
344 |
+
"tire",
|
345 |
+
"toothbrush",
|
346 |
+
"bathrobe",
|
347 |
+
"faucet",
|
348 |
+
"slipper",
|
349 |
+
"thermos",
|
350 |
+
"tripod",
|
351 |
+
"dispenser",
|
352 |
+
"heater",
|
353 |
+
"pool table",
|
354 |
+
"remote control",
|
355 |
+
"stapler",
|
356 |
+
"treadmill",
|
357 |
+
"beanbag",
|
358 |
+
"dartboard",
|
359 |
+
"metronome",
|
360 |
+
"rope",
|
361 |
+
"sewing machine",
|
362 |
+
"shredder",
|
363 |
+
"toolbox",
|
364 |
+
"water heater",
|
365 |
+
"brush",
|
366 |
+
"control",
|
367 |
+
"dais",
|
368 |
+
"dollhouse",
|
369 |
+
"envelope",
|
370 |
+
"food",
|
371 |
+
"frying pan",
|
372 |
+
"helmet",
|
373 |
+
"tennis racket",
|
374 |
+
"umbrella",
|
375 |
+
)
|