aderylo commited on
Commit
f53680f
·
verified ·
1 Parent(s): 93e7c49

Upload folder using huggingface_hub

Browse files
s3dis-latent-inject-r-0.5/data.py.backup ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ @Author: Yue Wang
5
+ @Contact: yuewangx@mit.edu
6
+ @File: data.py
7
+ @Time: 2018/10/13 6:21 PM
8
+
9
+ Modified by
10
+ @Author: An Tao, Pengliang Ji, Ziyi Wu
11
+ @Contact: ta19@mails.tsinghua.edu.cn, jpl1723@buaa.edu.cn, dazitu616@gmail.com
12
+ @Time: 2022/7/30 7:49 PM
13
+ """
14
+
15
+
16
+ import os
17
+ import sys
18
+ import glob
19
+ import h5py
20
+ import numpy as np
21
+ import torch
22
+ import json
23
+
24
+ # import cv2
25
+ import pickle
26
+ from torch.utils.data import Dataset
27
+ import codecs
28
+ import pandas as pd
29
+ from tqdm import tqdm
30
+
31
+ import sys
32
+ from pathlib import Path
33
+ sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
34
+ from pointcept.datasets.precomputed_features import PrecomputedFeaturesDataset
35
+
36
+
37
+ class GeomFeatDataset(Dataset):
38
+ def __init__(
39
+ self,
40
+ data_root="data/gf_scannet_ss_0.05",
41
+ split="train",
42
+ coord_only=False,
43
+ feature_to_file_mapping={},
44
+ num_point=4096,
45
+ ):
46
+ self.file_list = [
47
+ os.path.join(data_root, f)
48
+ for f in os.listdir(data_root)
49
+ if f.endswith(".asc")
50
+ ]
51
+ self.num_point = num_point
52
+ features_to_collect = [k for k in feature_to_file_mapping if k != "segment"]
53
+ if coord_only:
54
+ features_to_collect = ["coord"]
55
+
56
+ pointcept_transforms = [
57
+ dict(
58
+ type="NanToNum",
59
+ nan=0.0,
60
+ posinf=1e6,
61
+ neginf=-1e6,
62
+ ),
63
+ dict(type="ToTensor"),
64
+ dict(
65
+ type="Collect",
66
+ keys=("coord", "segment"),
67
+ feat_keys=features_to_collect,
68
+ ),
69
+ ]
70
+
71
+ pointcept_style_dataset = PrecomputedFeaturesDataset(
72
+ split=split,
73
+ data_root=data_root,
74
+ transform=pointcept_transforms,
75
+ mapping=feature_to_file_mapping,
76
+ )
77
+
78
+ self.pointclouds = []
79
+ self.labels = []
80
+ self.names = []
81
+ self.blocks_per_scene = [] # Number of blocks per scene
82
+ self.samples = 0
83
+ self.num_features = None # Store feature dimension
84
+
85
+ for idx in tqdm(range(len(pointcept_style_dataset)), desc=f"Processing {split}set"):
86
+ sample = pointcept_style_dataset[idx]
87
+ name = pointcept_style_dataset.get_data_name(idx)
88
+ feats = sample["feat"] # shape (N, C), torch tensor
89
+ seg = sample["segment"] # shape (N,) or (N, 1), torch tensor
90
+ feats_np = feats.cpu().numpy() # (N, C)
91
+ seg_np = seg.cpu().numpy().reshape(-1, 1) # (N,) or (N, 1)
92
+
93
+ # Store feature dimension from first non-empty pointcloud
94
+ if self.num_features is None and feats_np.shape[0] > 0:
95
+ self.num_features = feats_np.shape[1]
96
+
97
+ # Skip empty pointclouds
98
+ if feats_np.shape[0] == 0:
99
+ continue
100
+
101
+ num_blocks = (feats_np.shape[0] + self.num_point - 1) // self.num_point # Ceiling division
102
+ self.blocks_per_scene.append(num_blocks)
103
+ self.samples += num_blocks
104
+
105
+ self.pointclouds.append(feats_np)
106
+ self.labels.append(seg_np)
107
+ self.names.append(name)
108
+
109
+ # Ensure we have a feature dimension
110
+ if self.num_features is None:
111
+ raise ValueError("No valid pointclouds found in dataset!")
112
+
113
+ def __len__(self):
114
+ return self.samples
115
+
116
+ def __getitem__(self, idx):
117
+ # Find which scene this block belongs to using cumulative block counts
118
+ cum_blocks = np.cumsum([0] + self.blocks_per_scene)
119
+ scene_idx = np.searchsorted(cum_blocks, idx + 1, side="right") - 1
120
+
121
+ # Ensure scene_idx is valid
122
+ scene_idx = max(0, min(scene_idx, len(self.pointclouds) - 1))
123
+
124
+ # Calculate which block within this scene
125
+ block_within_scene = idx - cum_blocks[scene_idx]
126
+
127
+ pointcloud = self.pointclouds[scene_idx]
128
+ labelcloud = self.labels[scene_idx]
129
+ name = self.names[scene_idx]
130
+
131
+ num_points = self.num_point
132
+ total_points = pointcloud.shape[0]
133
+ num_features = self.num_features
134
+
135
+ # Calculate the start and end indices for this block
136
+ block_start = block_within_scene * num_points
137
+ block_end = min(block_start + num_points, total_points)
138
+
139
+ # Always create tensors of the same size
140
+ block_features = np.zeros((num_points, num_features), dtype=np.float32)
141
+ block_labels = np.full((num_points,), -1, dtype=np.int64)
142
+
143
+ # Extract the block if we have valid data
144
+ if block_start < total_points and block_end > block_start:
145
+ actual_length = block_end - block_start
146
+ slc_feats = pointcloud[block_start:block_end]
147
+ slc_labels = labelcloud[block_start:block_end].reshape(-1)
148
+
149
+ # Ensure shapes match
150
+ if slc_feats.shape[0] > 0:
151
+ block_features[:actual_length, :] = slc_feats
152
+ block_labels[:actual_length] = slc_labels
153
+
154
+ return (
155
+ torch.tensor(block_features, dtype=torch.float32),
156
+ torch.tensor(block_labels, dtype=torch.long),
157
+ name,
158
+ )
159
+
160
+
161
+
162
+
163
+ if __name__ == "__main__":
164
+ FEATURE_TO_FILE_MAPPING = {
165
+ "coord": ["X_SS_SPATIAL_0.05", "Y_SS_SPATIAL_0.05", "Z_SS_SPATIAL_0.05"],
166
+ "segment": "segment_SS_SPATIAL_0.05",
167
+ "Anisotropy": "Anisotropy_(0.3)_SS_SPATIAL_0.05",
168
+ "Octree_normals" : ["Nx_SS_SPATIAL_0.05", "Ny_SS_SPATIAL_0.05", "Nz_SS_SPATIAL_0.05"],
169
+ "PCA1": "PCA1_(0.3)_SS_SPATIAL_0.05",
170
+ "PCA2": "PCA2_(0.3)_SS_SPATIAL_0.05",
171
+ "Roughness": "Roughness_(0.3)_SS_SPATIAL_0.05",
172
+ "Sphericity": "Sphericity_(0.3)_SS_SPATIAL_0.05",
173
+ "Verticality": "Verticality_(0.3)_SS_SPATIAL_0.05",
174
+ }
175
+ NUM_POINT = 4096
176
+
177
+ train_set = GeomFeatDataset(
178
+ data_root="../../data/gf_s3dis_ss_0.05",
179
+ split="train",
180
+ feature_to_file_mapping=FEATURE_TO_FILE_MAPPING,
181
+ num_point=NUM_POINT
182
+ )
s3dis-latent-inject-r-0.5/logs/events.out.tfevents.1762900875.eu-g4-010 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:302ec3b71305fa1f680e33e2f7162cacdc8af1e8e0d39ea5927fd8bb819a21b8
3
+ size 14780
s3dis-latent-inject-r-0.5/main_semseg_gf_s3dis.py ADDED
@@ -0,0 +1,896 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ @Author: Ziyi Wu, Yingqi Wang
5
+ @Contact: dazitu616@gmail.com, yingqi-w19@mails.tsinghua.edu.cn
6
+ @File: main_semseg_scannet.py
7
+ @Time: 2022/7/30 7:49 PM
8
+ """
9
+
10
+
11
+ import argparse
12
+ import os
13
+ import random
14
+ from tqdm import tqdm
15
+ import numpy as np
16
+ from pathlib import Path
17
+ import time
18
+ import pickle
19
+ import torch
20
+ import torch.nn as nn
21
+ from torch.optim import SGD, Adam
22
+ import torch.backends.cudnn as cudnn
23
+ from torch.utils.data import DataLoader
24
+ from torch.optim.lr_scheduler import CosineAnnealingLR, StepLR
25
+ from torch_scatter import scatter_sum
26
+ from tensorboardX import SummaryWriter
27
+ from plyfile import PlyData, PlyElement
28
+ import matplotlib.pyplot as plt
29
+ import imageio
30
+ from data import GeomFeatDataset
31
+ from model import DGCNN, DGCNN_JAB
32
+ from util import (
33
+ intersectionAndUnion,
34
+ IOStream,
35
+ str2bool,
36
+ get_lr,
37
+ adjust_lr,
38
+ weights_init,
39
+ bn_momentum_adjust,
40
+ cal_loss,
41
+ )
42
+ try:
43
+ from pointcept.utils.visualization import save_point_cloud, create_rotating_visualization
44
+ except ImportError:
45
+ save_point_cloud = None
46
+ create_rotating_visualization = None
47
+
48
+ def _init_(args):
49
+ if not os.path.exists("outputs"):
50
+ os.makedirs("outputs")
51
+ if not os.path.exists("outputs/" + args.exp_name):
52
+ os.makedirs("outputs/" + args.exp_name)
53
+ if not os.path.exists("outputs/" + args.exp_name + "/" + "models"):
54
+ os.makedirs("outputs/" + args.exp_name + "/" + "models")
55
+ os.system(
56
+ f"cp main_semseg_gf_s3dis.py outputs/{args.exp_name}/main_semseg_gf_s3dis.py"
57
+ )
58
+ os.system("cp model.py outputs" + "/" + args.exp_name + "/" + "model.py.backup")
59
+ os.system("cp util.py outputs" + "/" + args.exp_name + "/" + "util.py.backup")
60
+ os.system("cp data.py outputs" + "/" + args.exp_name + "/" + "data.py.backup")
61
+
62
+
63
+ def parse_args():
64
+ parser = argparse.ArgumentParser("Train point cloud semantic segmentation")
65
+ parser.add_argument(
66
+ "--exp_name",
67
+ type=str,
68
+ default="exp",
69
+ metavar="N",
70
+ help="Name of the experiment",
71
+ )
72
+ parser.add_argument(
73
+ "--data_root",
74
+ type=str,
75
+ default="../../data/gf_s3dis_ss_0.05",
76
+ help="path to data",
77
+ )
78
+ parser.add_argument(
79
+ "--model_path", type=str, default="", help="pretrained model weight"
80
+ )
81
+ parser.add_argument(
82
+ "--split",
83
+ type=str,
84
+ default="val",
85
+ help="Split of data to evaluate on [default: val]",
86
+ choices=["val", "test"],
87
+ )
88
+ parser.add_argument(
89
+ "--in_channels", type=int, default=12, help="Dimension of embeddings"
90
+ )
91
+
92
+ # Dataset settings
93
+ parser.add_argument("--num_classes", type=int, default=13, help="Number of classes")
94
+ parser.add_argument(
95
+ "--class_names",
96
+ default=[
97
+ "ceiling",
98
+ "floor",
99
+ "wall",
100
+ "beam",
101
+ "column",
102
+ "window",
103
+ "door",
104
+ "table",
105
+ "chair",
106
+ "sofa",
107
+ "bookcase",
108
+ "board",
109
+ "clutter",
110
+ ],
111
+ help="Names of classes",
112
+ )
113
+ parser.add_argument(
114
+ "--feature_to_file_mapping",
115
+ default={
116
+ "coord": ["X_SS_SPATIAL_0.05", "Y_SS_SPATIAL_0.05", "Z_SS_SPATIAL_0.05"],
117
+ "segment": "segment_SS_SPATIAL_0.05",
118
+ "Anisotropy": "Anisotropy_(0.5)_SS_SPATIAL_0.05",
119
+ "Octree_normals" : ["Nx_SS_SPATIAL_0.05", "Ny_SS_SPATIAL_0.05", "Nz_SS_SPATIAL_0.05"],
120
+ "PCA1": "PCA1_(0.5)_SS_SPATIAL_0.05",
121
+ "PCA2": "PCA2_(0.5)_SS_SPATIAL_0.05",
122
+ "Roughness": "Roughness_(0.5)_SS_SPATIAL_0.05",
123
+ "Sphericity": "Sphericity_(0.5)_SS_SPATIAL_0.05",
124
+ "Verticality": "Verticality_(0.5)_SS_SPATIAL_0.05",
125
+ },
126
+ help="Feature to file mapping",
127
+ )
128
+ parser.add_argument(
129
+ "--ignore_index",
130
+ type=int,
131
+ default=-1,
132
+ help="Ignore label index for loss computation",
133
+ )
134
+ parser.add_argument(
135
+ "--coord_only",
136
+ type=str2bool,
137
+ default=False,
138
+ )
139
+ parser.add_argument(
140
+ "--num_points",
141
+ type=int,
142
+ default=8192,
143
+ help="Ignore label index for loss computation",
144
+ )
145
+ parser.add_argument("--dropout", type=float, default=0.5, help="dropout rate")
146
+ parser.add_argument(
147
+ "--emb_dims",
148
+ type=int,
149
+ default=1024,
150
+ metavar="N",
151
+ help="Dimension of embeddings",
152
+ )
153
+ parser.add_argument(
154
+ "--k", type=int, default=20, metavar="N", help="Num of nearest neighbors to use"
155
+ )
156
+ parser.add_argument(
157
+ "--batch_size",
158
+ type=int,
159
+ default=-1,
160
+ help="Batch Size during training [default: 6]",
161
+ )
162
+ parser.add_argument(
163
+ "--epoch", default=100, type=int, help="Epoch to run [default: 100]"
164
+ )
165
+ parser.add_argument(
166
+ "--learning_rate",
167
+ default=0.001,
168
+ type=float,
169
+ help="Initial learning rate [default: 0.001]",
170
+ )
171
+ parser.add_argument(
172
+ "--optimizer", type=str, default="Adam", help="Adam or SGD [default: Adam]"
173
+ )
174
+ parser.add_argument(
175
+ "--decay_rate", type=float, default=1e-4, help="weight decay [default: 1e-4]"
176
+ )
177
+ parser.add_argument(
178
+ "--lr_scheduler",
179
+ type=str,
180
+ default="cosine",
181
+ help="Learning rate scheduler [default: cosine decay]",
182
+ )
183
+ parser.add_argument(
184
+ "--step_size",
185
+ type=int,
186
+ default=10,
187
+ help="Decay step for lr decay [default: every 10 epochs]",
188
+ )
189
+ parser.add_argument(
190
+ "--lr_decay",
191
+ type=float,
192
+ default=0.7,
193
+ help="Decay rate for lr decay [default: 0.7]",
194
+ )
195
+ parser.add_argument(
196
+ "--eval",
197
+ type=int,
198
+ default=0,
199
+ help="whether to evaluate pretrained weight [default: False]",
200
+ )
201
+ parser.add_argument(
202
+ "--save_model_freq",
203
+ type=int,
204
+ default=1,
205
+ help="frequency of saving model checkpoints [default: 1], i.e. every epoch",
206
+ )
207
+ parser.add_argument(
208
+ "--seed", type=int, default=1, metavar="S", help="random seed [default: 1]"
209
+ )
210
+ parser.add_argument("--visu", type=str, default="", help="visualize the model")
211
+ parser.add_argument(
212
+ "--visu_format",
213
+ type=str,
214
+ default="ply",
215
+ help="file format of visualization [default: ply]",
216
+ )
217
+ parser.add_argument(
218
+ "--train_val",
219
+ type=str2bool,
220
+ default=False,
221
+ help="whether to train on both train set and val set [default: False]",
222
+ )
223
+ parser.add_argument(
224
+ "--jab",
225
+ type=str2bool,
226
+ default=False,
227
+ help="whether to use JAB module [default: False]",
228
+ )
229
+ parser.add_argument(
230
+ "--jab_out_channels",
231
+ type=int,
232
+ default=9,
233
+ help="number of output channels for JAB module [default: 9]",
234
+ )
235
+
236
+
237
+ return parser.parse_args()
238
+
239
+
240
+ def train(args, io):
241
+ torch.cuda.empty_cache()
242
+ if args.batch_size == -1:
243
+ args.batch_size = 8
244
+ io.cprint(str(args))
245
+
246
+ root = args.data_root
247
+ NUM_CLASSES = args.num_classes # scannet has 20 classes
248
+ NUM_POINT = args.num_points
249
+ BATCH_SIZE = args.batch_size
250
+
251
+ """MODEL LOADING"""
252
+ if args.jab:
253
+ classifier = DGCNN_JAB(
254
+ in_channels=args.in_channels,
255
+ out_channels=args.num_classes,
256
+ jab_out_channels=args.jab_out_channels,
257
+ k=args.k,
258
+ emb_dims=args.emb_dims,
259
+ dropout=args.dropout,
260
+ )
261
+ else:
262
+ classifier = DGCNN(
263
+ in_channels=args.in_channels,
264
+ out_channels=args.num_classes,
265
+ k=args.k,
266
+ emb_dims=args.emb_dims,
267
+ dropout=args.dropout,
268
+ )
269
+ criterion = cal_loss
270
+ # io.cprint(str(classifier))
271
+
272
+ if args.sync_bn:
273
+ io.cprint("Using Sync BN!")
274
+ from util import convert_to_syncbn
275
+
276
+ convert_to_syncbn(classifier)
277
+
278
+ classifier = nn.DataParallel(classifier.cuda()).cuda()
279
+ if args.sync_bn:
280
+ from sync_bn import patch_replication_callback
281
+
282
+ patch_replication_callback(classifier)
283
+
284
+ if args.optimizer.lower() == "Adam".lower():
285
+ optimizer = Adam(
286
+ classifier.parameters(), lr=args.learning_rate, weight_decay=args.decay_rate
287
+ )
288
+ io.cprint("Using Adam optimizer")
289
+ else:
290
+ optimizer = SGD(
291
+ classifier.parameters(),
292
+ lr=args.learning_rate,
293
+ momentum=0.9,
294
+ weight_decay=args.decay_rate,
295
+ )
296
+ io.cprint("Using SGD optimizer")
297
+
298
+ if args.lr_scheduler == "cosine":
299
+ lr_scheduler = CosineAnnealingLR(optimizer, T_max=args.epoch, eta_min=1e-5)
300
+ io.cprint("Using Cosine LR decay")
301
+ else:
302
+ lr_scheduler = StepLR(optimizer, step_size=args.step_size, gamma=args.lr_decay)
303
+ io.cprint("Using Step LR decay")
304
+
305
+ if args.model_path:
306
+ io.cprint("Using pretrained model {}".format(args.model_path))
307
+ checkpoint = torch.load(args.model_path, map_location="cpu")
308
+ try:
309
+ start_epoch = checkpoint["epoch"]
310
+ classifier.load_state_dict(checkpoint["state_dict"])
311
+ optimizer.load_state_dict(checkpoint["opt"])
312
+ lr_scheduler.load_state_dict(checkpoint["lr_scheduler"])
313
+ except KeyError:
314
+ try:
315
+ classifier.load_state_dict(checkpoint)
316
+ except KeyError:
317
+ classifier.module.load_state_dict(checkpoint)
318
+ else:
319
+ start_epoch = 0
320
+ classifier = classifier.apply(weights_init)
321
+
322
+ """DATA LOADING"""
323
+ io.cprint("Loading data")
324
+ train_set = GeomFeatDataset(
325
+ data_root=args.data_root,
326
+ split="train",
327
+ feature_to_file_mapping=args.feature_to_file_mapping,
328
+ coord_only=args.coord_only,
329
+ num_point=NUM_POINT,
330
+ )
331
+
332
+ train_loader = torch.utils.data.DataLoader(
333
+ train_set,
334
+ batch_size=args.batch_size,
335
+ shuffle=True,
336
+ num_workers=min(12, args.batch_size),
337
+ pin_memory=True,
338
+ drop_last=True,
339
+ worker_init_fn=lambda x: np.random.seed(x + int(time.time())),
340
+ )
341
+ weights = None
342
+ io.cprint("The number of training data is: %d" % len(train_set))
343
+
344
+ """CREATE DIR"""
345
+ start_datetime = time.strftime("%Y-%m-%d_%H:%M:%S", time.localtime())
346
+ logs_dir = "outputs/{}/".format(args.exp_name)
347
+
348
+ if not os.path.exists(logs_dir):
349
+ os.makedirs(logs_dir)
350
+ log_writer = SummaryWriter(os.path.join(logs_dir, "logs"))
351
+
352
+ MOMENTUM_ORIGINAL = 0.1
353
+ MOMENTUM_DECCAY = 0.5
354
+ MOMENTUM_DECCAY_STEP = args.step_size
355
+
356
+ global_epoch = 0
357
+ best_iou = 0
358
+ best_iou_epoch = -1
359
+
360
+ for epoch in range(start_epoch, args.epoch + 1):
361
+ """Train on chopped scenes"""
362
+ io.cprint("\n\n**** Epoch %d (%d/%s) ****" % (global_epoch, epoch, args.epoch))
363
+
364
+ # BN momentum decay
365
+ momentum = MOMENTUM_ORIGINAL * (
366
+ MOMENTUM_DECCAY ** (epoch // MOMENTUM_DECCAY_STEP)
367
+ )
368
+ if momentum < 0.01:
369
+ momentum = 0.01
370
+ io.cprint("BN momentum updated to: %.4f" % momentum)
371
+ classifier = classifier.apply(lambda x: bn_momentum_adjust(x, momentum))
372
+ classifier = classifier.train()
373
+
374
+ num_batches = len(train_loader)
375
+ total_correct = 0.0
376
+ total_seen = 0.0
377
+ loss_sum = 0.0
378
+ save_model = epoch % args.save_model_freq == 0
379
+ for i, data in tqdm(
380
+ enumerate(train_loader), total=len(train_loader), smoothing=0.9
381
+ ):
382
+ points, target = data
383
+ # TODO: data augmentation?
384
+ # TODO: seems no rotation aug in original paper/code!
385
+ # points = points.data.numpy()
386
+ # points[:,:, :3] = provider.rotate_point_cloud_z(points[:,:, :3])
387
+ # points = torch.Tensor(points)
388
+ points, target = points.float().cuda(), target.long().cuda()
389
+ points = points.transpose(2, 1)
390
+ optimizer.zero_grad()
391
+ seg_pred, trans_feat = classifier(points)
392
+ seg_pred = seg_pred.contiguous().view(-1, args.num_classes)
393
+ target = target.view(-1)
394
+ # TODO: loss weighting?
395
+ # TODO: seems no loss weighting in original paper/code!
396
+ loss = criterion(seg_pred, target, ignore_index=args.ignore_index)
397
+ loss.backward()
398
+ optimizer.step()
399
+ with torch.no_grad():
400
+ label = target.detach()
401
+ keep_index = torch.where(label != args.ignore_index)[0]
402
+ preds = seg_pred.argmax(1)
403
+ correct = (label[keep_index] == preds[keep_index]).sum(0).item()
404
+ total_correct += correct
405
+ total_seen += keep_index.shape[0]
406
+ loss_sum += loss.item()
407
+ mean_loss = loss_sum / num_batches
408
+ mean_acc = total_correct / float(total_seen)
409
+ lr = get_lr(optimizer)
410
+ io.cprint("Training mean loss: %.4f" % (mean_loss))
411
+ io.cprint("Training accuracy: %.4f" % (mean_acc))
412
+ io.cprint("Learning rate: %.6f" % (lr))
413
+ log_writer.add_scalar("train/loss", mean_loss, epoch)
414
+ log_writer.add_scalar("train/accuracy", mean_acc, epoch)
415
+ log_writer.add_scalar("train/lr", lr, epoch)
416
+
417
+ if save_model:
418
+ model_name = "model_{}.pth".format(epoch)
419
+ savepath = os.path.join(logs_dir, "models", model_name)
420
+ io.cprint("Saving at %s" % savepath)
421
+ state = {
422
+ "epoch": epoch,
423
+ # 'class_avg_iou': mIoU,
424
+ "state_dict": classifier.state_dict(),
425
+ "opt": optimizer.state_dict(),
426
+ "lr_scheduler": lr_scheduler.state_dict(),
427
+ }
428
+ torch.save(state, savepath)
429
+
430
+ global_epoch += 1
431
+ lr_scheduler.step()
432
+ torch.cuda.empty_cache()
433
+
434
+
435
+ def test(args, io):
436
+ torch.cuda.empty_cache()
437
+
438
+ """LOG"""
439
+ if args.batch_size == -1:
440
+ args.batch_size = 8
441
+ io.cprint(str(args))
442
+
443
+ root = args.data_root
444
+ NUM_CLASSES = args.num_classes
445
+ NUM_POINT = args.num_points
446
+ if NUM_POINT != 4096:
447
+ io.cprint("Please check ZAHA num_points setting!")
448
+ BATCH_SIZE = args.batch_size
449
+
450
+ """MODEL LOADING"""
451
+ if args.jab:
452
+ classifier = DGCNN_JAB(
453
+ in_channels=args.in_channels,
454
+ out_channels=args.num_classes,
455
+ jab_out_channels=args.jab_out_channels,
456
+ k=args.k,
457
+ emb_dims=args.emb_dims,
458
+ dropout=args.dropout,
459
+ )
460
+ else:
461
+ classifier = DGCNN(
462
+ in_channels=args.in_channels,
463
+ out_channels=args.num_classes,
464
+ k=args.k,
465
+ emb_dims=args.emb_dims,
466
+ dropout=args.dropout,
467
+ )
468
+ classifier = nn.DataParallel(classifier.cuda()).cuda()
469
+ criterion = cal_loss
470
+
471
+ if args.model_path:
472
+ io.cprint("Loading pretrained model {}".format(args.model_path))
473
+ checkpoint = torch.load(args.model_path, map_location="cpu")
474
+ try:
475
+ classifier.load_state_dict(checkpoint["state_dict"])
476
+ except KeyError:
477
+ try:
478
+ classifier.load_state_dict(checkpoint)
479
+ except KeyError:
480
+ classifier.module.load_state_dict(checkpoint)
481
+ else:
482
+ io.cprint("No model_path specified, exiting.")
483
+ return
484
+
485
+ """DATA LOADING"""
486
+ io.cprint("Loading data")
487
+ test_set = GeomFeatDataset(
488
+ data_root=args.data_root,
489
+ split="val",
490
+ feature_to_file_mapping=args.feature_to_file_mapping,
491
+ coord_only=args.coord_only,
492
+ num_point=NUM_POINT,
493
+ )
494
+ test_loader = torch.utils.data.DataLoader(
495
+ test_set,
496
+ batch_size=BATCH_SIZE,
497
+ shuffle=False,
498
+ num_workers=min(12, BATCH_SIZE),
499
+ pin_memory=True,
500
+ drop_last=True,
501
+ worker_init_fn=lambda x: np.random.seed(x + int(time.time())),
502
+ )
503
+
504
+ io.cprint("The number of training data is: %d" % len(test_set))
505
+
506
+ classifier.eval()
507
+ total_correct = 0
508
+ total_seen = 0
509
+ loss_sum = 0.0
510
+
511
+ total_TP = np.zeros(NUM_CLASSES, dtype=np.float64)
512
+ total_FP = np.zeros(NUM_CLASSES, dtype=np.float64)
513
+ total_FN = np.zeros(NUM_CLASSES, dtype=np.float64)
514
+
515
+ # Visualization setup
516
+ vis_output_dir = os.path.join("outputs", args.exp_name, "visuals")
517
+ os.makedirs(vis_output_dir, exist_ok=True)
518
+
519
+ # Scene collection for visualization
520
+ scene_coords = []
521
+ scene_preds = []
522
+ scene_targets = []
523
+ current_scene_name = None
524
+ scene_idx = 0
525
+
526
+ def save_scene_visualization(scene_name, coords, preds, targets, output_dir, class_names, num_classes):
527
+ """Save visualization for a complete scene"""
528
+ if len(coords) == 0:
529
+ return
530
+
531
+ # Concatenate all blocks for this scene
532
+ coords_all = np.concatenate(coords, axis=0) # (N, 3)
533
+ preds_all = np.concatenate(preds, axis=0) # (N,)
534
+ targets_all = np.concatenate(targets, axis=0) # (N,)
535
+
536
+ # Filter out points with label -1
537
+ valid_mask = targets_all != -1
538
+ coords_all = coords_all[valid_mask]
539
+ preds_all = preds_all[valid_mask]
540
+ targets_all = targets_all[valid_mask]
541
+
542
+ if len(coords_all) == 0:
543
+ return
544
+
545
+ # Create colormap
546
+ cmap = plt.get_cmap("tab20", num_classes)
547
+
548
+ # Save prediction visualization
549
+ pred_colors = np.array([cmap(pred)[:3] for pred in preds_all])
550
+ if save_point_cloud is not None:
551
+ save_point_cloud(
552
+ coords_all,
553
+ pred_colors,
554
+ file_path=os.path.join(output_dir, f"{scene_name}_pred.ply"),
555
+ logger=None
556
+ )
557
+ if create_rotating_visualization is not None:
558
+ try:
559
+ frames = create_rotating_visualization(coords_all, pred_colors, n_frames=60, width=1920, height=1080)
560
+ imageio.mimsave(os.path.join(output_dir, f"{scene_name}_pred.mp4"), frames, fps=15)
561
+ except Exception as e:
562
+ io.cprint(f"Warning: Could not create video for {scene_name}_pred: {e}")
563
+
564
+ # Save ground truth visualization
565
+ gt_colors = np.array([cmap(target)[:3] for target in targets_all])
566
+ if save_point_cloud is not None:
567
+ save_point_cloud(
568
+ coords_all,
569
+ gt_colors,
570
+ file_path=os.path.join(output_dir, f"{scene_name}_gt.ply"),
571
+ logger=None
572
+ )
573
+ if create_rotating_visualization is not None:
574
+ try:
575
+ frames = create_rotating_visualization(coords_all, gt_colors, n_frames=60, width=1920, height=1080)
576
+ imageio.mimsave(os.path.join(output_dir, f"{scene_name}_gt.mp4"), frames, fps=15)
577
+ except Exception as e:
578
+ io.cprint(f"Warning: Could not create video for {scene_name}_gt: {e}")
579
+
580
+ with torch.no_grad():
581
+ for batch_idx, (points, target, name) in enumerate(tqdm(test_loader, total=len(test_loader), smoothing=0.9)):
582
+ # Extract scene names from batch (DataLoader returns list of strings)
583
+ if isinstance(name, (list, tuple)):
584
+ batch_scene_names = name
585
+ else:
586
+ batch_scene_names = [name]
587
+
588
+ points, target = points.float().cuda(), target.long().cuda()
589
+ points_transposed = points.transpose(2, 1)
590
+
591
+ seg_pred, _ = classifier(points_transposed)
592
+ seg_pred = seg_pred.contiguous().view(-1, NUM_CLASSES)
593
+ target_flat = target.view(-1)
594
+
595
+ loss = criterion(seg_pred, target_flat, ignore_index=args.ignore_index)
596
+ loss_sum += loss.item()
597
+
598
+ keep_index = torch.where(target_flat != -1)[0]
599
+ preds = seg_pred.argmax(1)
600
+
601
+ correct = (target_flat[keep_index] == preds[keep_index]).sum().item()
602
+ total_correct += correct
603
+ total_seen += keep_index.shape[0]
604
+
605
+ for cls in range(NUM_CLASSES):
606
+ cls_mask = target_flat[keep_index] == cls
607
+ pred_mask = preds[keep_index] == cls
608
+
609
+ TP = (cls_mask & pred_mask).sum().item()
610
+ FP = ((~cls_mask) & pred_mask).sum().item()
611
+ FN = (cls_mask & (~pred_mask)).sum().item()
612
+
613
+ total_TP[cls] += TP
614
+ total_FP[cls] += FP
615
+ total_FN[cls] += FN
616
+
617
+ # Collect points for visualization (extract coordinates from first 3 channels)
618
+ points_cpu = points.cpu().numpy() # (B, N, C)
619
+ coords_batch = points_cpu[:, :, :3] # (B, N, 3) - extract xyz coordinates
620
+ preds_batch = preds.cpu().numpy() # (B*N,)
621
+ targets_batch = target_flat.cpu().numpy() # (B*N,)
622
+
623
+ # Reshape predictions and targets to match batch structure
624
+ B, N = points_cpu.shape[0], points_cpu.shape[1]
625
+ preds_batch = preds_batch.reshape(B, N) # (B, N)
626
+ targets_batch = targets_batch.reshape(B, N) # (B, N)
627
+
628
+ # Process each sample in the batch separately, grouping by scene name
629
+ for b in range(B):
630
+ sample_scene_name = batch_scene_names[b] if b < len(batch_scene_names) else batch_scene_names[0]
631
+
632
+ # Handle scene change - save previous scene if name changed
633
+ if current_scene_name is not None and sample_scene_name != current_scene_name:
634
+ # Save previous scene
635
+ if len(scene_coords) > 0:
636
+ save_scene_visualization(
637
+ current_scene_name,
638
+ scene_coords,
639
+ scene_preds,
640
+ scene_targets,
641
+ vis_output_dir,
642
+ args.class_names,
643
+ NUM_CLASSES
644
+ )
645
+ io.cprint(f"Saved visualization for scene: {current_scene_name}")
646
+ # Reset for new scene
647
+ scene_coords = []
648
+ scene_preds = []
649
+ scene_targets = []
650
+
651
+ # Update current scene name
652
+ current_scene_name = sample_scene_name
653
+
654
+ # Collect this sample
655
+ scene_coords.append(coords_batch[b]) # (N, 3)
656
+ scene_preds.append(preds_batch[b]) # (N,)
657
+ scene_targets.append(targets_batch[b]) # (N,)
658
+
659
+ # Save last scene
660
+ if len(scene_coords) > 0:
661
+ save_scene_visualization(
662
+ current_scene_name,
663
+ scene_coords,
664
+ scene_preds,
665
+ scene_targets,
666
+ vis_output_dir,
667
+ args.class_names,
668
+ NUM_CLASSES
669
+ )
670
+ io.cprint(f"Saved visualization for scene: {current_scene_name}")
671
+
672
+ mean_loss = loss_sum / len(test_loader)
673
+
674
+ # OA
675
+ OA = total_correct / float(total_seen)
676
+
677
+ # Per-class metrics
678
+ precision_per_class = total_TP / np.maximum(total_TP + total_FP, 1)
679
+ recall_per_class = total_TP / np.maximum(total_TP + total_FN, 1)
680
+ iou_per_class = total_TP / np.maximum(total_TP + total_FP + total_FN, 1)
681
+ f1_per_class = (2 * precision_per_class * recall_per_class) / np.maximum(
682
+ precision_per_class + recall_per_class, 1e-8
683
+ )
684
+
685
+ # Means
686
+ μP = np.mean(precision_per_class)
687
+ μR = np.mean(recall_per_class)
688
+ μIoU = np.mean(iou_per_class)
689
+ μF1 = np.mean(f1_per_class)
690
+
691
+ # 输出
692
+ io.cprint("==== Evaluation Results ====")
693
+ io.cprint("Mean loss: %.4f" % mean_loss)
694
+ io.cprint("OA : %.4f" % OA)
695
+ io.cprint("μP : %.4f" % μP)
696
+ io.cprint("μIoU : %.4f" % μIoU)
697
+ io.cprint("μR : %.4f" % μR)
698
+ io.cprint("μF1 : %.4f" % μF1)
699
+ io.cprint("============================")
700
+ for cls_name, p, r, iou, f1 in zip(
701
+ args.class_names,
702
+ precision_per_class,
703
+ recall_per_class,
704
+ iou_per_class,
705
+ f1_per_class,
706
+ ):
707
+ io.cprint(
708
+ "%-15s | P: %.4f | R: %.4f | IoU: %.4f | F1: %.4f"
709
+ % (cls_name, p, r, iou, f1)
710
+ )
711
+
712
+
713
+ def set_seed(seed=42):
714
+ random.seed(seed)
715
+ np.random.seed(seed)
716
+ torch.manual_seed(seed)
717
+ torch.cuda.manual_seed(seed)
718
+ torch.cuda.manual_seed_all(seed) # if multiple GPUs
719
+
720
+ torch.backends.cudnn.deterministic = True
721
+ torch.backends.cudnn.benchmark = False
722
+
723
+
724
+ def validate(args, io):
725
+ torch.cuda.empty_cache()
726
+
727
+ """LOG"""
728
+ if args.batch_size == -1:
729
+ args.batch_size = 8
730
+ io.cprint(str(args))
731
+
732
+ root = args.data_root
733
+ NUM_CLASSES = args.num_classes
734
+ NUM_POINT = args.num_points
735
+ if NUM_POINT != 4096:
736
+ io.cprint("Please check ZAHA num_points setting!")
737
+ BATCH_SIZE = args.batch_size
738
+
739
+ io.cprint("Loading data...")
740
+ test_set = GeomFeatDataset(
741
+ data_root=args.data_root,
742
+ split="val",
743
+ feature_to_file_mapping=args.feature_to_file_mapping,
744
+ coord_only=args.coord_only,
745
+ num_point=NUM_POINT,
746
+ )
747
+ test_loader = torch.utils.data.DataLoader(
748
+ test_set,
749
+ batch_size=BATCH_SIZE,
750
+ shuffle=False,
751
+ num_workers=min(12, BATCH_SIZE),
752
+ pin_memory=True,
753
+ drop_last=True,
754
+ worker_init_fn=lambda x: np.random.seed(x + int(time.time())),
755
+ )
756
+
757
+ io.cprint("The number of validation data is: %d" % len(test_set))
758
+
759
+ best_miou = -1
760
+ best_model = None
761
+
762
+ model_dir = Path(args.model_path)
763
+ for model_path in sorted(model_dir.glob("model_*.pth")):
764
+ model_path = str(model_path)
765
+ if not os.path.exists(model_path):
766
+ io.cprint(f"[Skip] {model_path} not found.")
767
+ continue
768
+
769
+ io.cprint(f"\nLoading pretrained model {model_path}")
770
+ if args.jab:
771
+ classifier = DGCNN_JAB(
772
+ in_channels=args.in_channels,
773
+ out_channels=args.num_classes,
774
+ jab_out_channels=args.jab_out_channels,
775
+ k=args.k,
776
+ emb_dims=args.emb_dims,
777
+ dropout=args.dropout,
778
+ )
779
+ else:
780
+ classifier = DGCNN(
781
+ in_channels=args.in_channels,
782
+ out_channels=args.num_classes,
783
+ k=args.k,
784
+ emb_dims=args.emb_dims,
785
+ dropout=args.dropout,
786
+ )
787
+
788
+ classifier = nn.DataParallel(classifier.cuda()).cuda()
789
+ criterion = cal_loss
790
+
791
+ checkpoint = torch.load(model_path, map_location="cpu")
792
+ try:
793
+ classifier.load_state_dict(checkpoint["state_dict"])
794
+ except KeyError:
795
+ try:
796
+ classifier.load_state_dict(checkpoint)
797
+ except KeyError:
798
+ classifier.module.load_state_dict(checkpoint)
799
+
800
+ classifier.eval()
801
+ total_correct = 0
802
+ total_seen = 0
803
+ loss_sum = 0.0
804
+
805
+ total_TP = np.zeros(NUM_CLASSES, dtype=np.float64)
806
+ total_FP = np.zeros(NUM_CLASSES, dtype=np.float64)
807
+ total_FN = np.zeros(NUM_CLASSES, dtype=np.float64)
808
+
809
+ with torch.no_grad():
810
+ for points, target, name in tqdm(
811
+ test_loader,
812
+ total=len(test_loader),
813
+ desc=f"Validating {model_path}",
814
+ smoothing=0.9,
815
+ ):
816
+ points, target = points.float().cuda(), target.long().cuda()
817
+ points = points.transpose(2, 1)
818
+
819
+ seg_pred, _ = classifier(points)
820
+ seg_pred = seg_pred.contiguous().view(-1, NUM_CLASSES)
821
+ target = target.view(-1)
822
+
823
+ loss = criterion(seg_pred, target)
824
+ loss_sum += loss.item()
825
+
826
+ keep_index = torch.where(target != 255)[0]
827
+ preds = seg_pred.argmax(1)
828
+
829
+ correct = (target[keep_index] == preds[keep_index]).sum().item()
830
+ total_correct += correct
831
+ total_seen += keep_index.shape[0]
832
+
833
+ for cls in range(NUM_CLASSES):
834
+ cls_mask = target[keep_index] == cls
835
+ pred_mask = preds[keep_index] == cls
836
+
837
+ TP = (cls_mask & pred_mask).sum().item()
838
+ FP = ((~cls_mask) & pred_mask).sum().item()
839
+ FN = (cls_mask & (~pred_mask)).sum().item()
840
+
841
+ total_TP[cls] += TP
842
+ total_FP[cls] += FP
843
+ total_FN[cls] += FN
844
+
845
+ # 计算指标
846
+ mean_loss = loss_sum / len(test_loader)
847
+ OA = total_correct / float(total_seen)
848
+
849
+ precision_per_class = total_TP / np.maximum(total_TP + total_FP, 1)
850
+ recall_per_class = total_TP / np.maximum(total_TP + total_FN, 1)
851
+ iou_per_class = total_TP / np.maximum(total_TP + total_FP + total_FN, 1)
852
+ f1_per_class = (2 * precision_per_class * recall_per_class) / np.maximum(
853
+ precision_per_class + recall_per_class, 1e-8
854
+ )
855
+
856
+ μIoU = np.mean(iou_per_class)
857
+
858
+ io.cprint(
859
+ f"{Path(model_path).stem} | μIoU: {μIoU:.4f} | OA: {OA:.4f} | Loss: {mean_loss:.4f}"
860
+ )
861
+
862
+ if μIoU > best_miou:
863
+ best_miou = μIoU
864
+ best_model = model_path
865
+
866
+ del classifier
867
+ torch.cuda.empty_cache()
868
+
869
+ io.cprint("\n==== Summary ====")
870
+ io.cprint(f"Best model: {best_model}")
871
+ io.cprint(f"Best μIoU : {best_miou:.4f}")
872
+ io.cprint("=================")
873
+
874
+
875
+ if __name__ == "__main__":
876
+ args = parse_args()
877
+
878
+ # Setup logging and weights saving
879
+ _init_(args)
880
+ io = IOStream("outputs/" + args.exp_name + "/run.log")
881
+
882
+ set_seed(args.seed)
883
+ cudnn.benchmark = True
884
+ args.sync_bn = torch.cuda.device_count() > 1
885
+
886
+ # Dataset specific settings
887
+ io.cprint("Experiment on S3DIS dataset!")
888
+ assert args.num_classes == len(args.class_names)
889
+
890
+
891
+ if not args.eval:
892
+ train(args, io)
893
+ elif args.eval == 1:
894
+ validate(args, io)
895
+ else:
896
+ test(args, io)
s3dis-latent-inject-r-0.5/model.py.backup ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ @Author: Yue Wang
5
+ @Contact: yuewangx@mit.edu
6
+ @File: model.py
7
+ @Time: 2018/10/13 6:35 PM
8
+
9
+ Modified by
10
+ @Author: An Tao, Ziyi Wu
11
+ @Contact: ta19@mails.tsinghua.edu.cn, dazitu616@gmail.com
12
+ @Time: 2022/7/30 7:49 PM
13
+ """
14
+
15
+
16
+ import os
17
+ import sys
18
+ import copy
19
+ import math
20
+ import numpy as np
21
+ import torch
22
+ import torch.nn as nn
23
+ import torch.nn.init as init
24
+ import torch.nn.functional as F
25
+
26
+
27
+ def knn(x, k):
28
+ inner = -2*torch.matmul(x.transpose(2, 1), x)
29
+ xx = torch.sum(x**2, dim=1, keepdim=True)
30
+ pairwise_distance = -xx - inner - xx.transpose(2, 1)
31
+
32
+ idx = pairwise_distance.topk(k=k, dim=-1)[1] # (batch_size, num_points, k)
33
+ return idx
34
+
35
+
36
+ def get_graph_feature(x, k=20, idx=None, dim9=False):
37
+ batch_size = x.size(0)
38
+ num_points = x.size(2)
39
+ x = x.view(batch_size, -1, num_points)
40
+ if idx is None:
41
+ if dim9 == False:
42
+ idx = knn(x, k=k) # (batch_size, num_points, k)
43
+ else:
44
+ idx = knn(x[:, 6:], k=k)
45
+ device = torch.device('cuda')
46
+
47
+ idx_base = torch.arange(0, batch_size, device=device).view(-1, 1, 1)*num_points
48
+
49
+ idx = idx + idx_base
50
+
51
+ idx = idx.view(-1)
52
+
53
+ _, num_dims, _ = x.size()
54
+
55
+ x = x.transpose(2, 1).contiguous() # (batch_size, num_points, num_dims) -> (batch_size*num_points, num_dims) # batch_size * num_points * k + range(0, batch_size*num_points)
56
+ feature = x.view(batch_size*num_points, -1)[idx, :]
57
+ feature = feature.view(batch_size, num_points, k, num_dims)
58
+ x = x.view(batch_size, num_points, 1, num_dims).repeat(1, 1, k, 1)
59
+
60
+ feature = torch.cat((feature-x, x), dim=3).permute(0, 3, 1, 2).contiguous()
61
+
62
+ return feature # (batch_size, 2*num_dims, num_points, k)
63
+
64
+
65
+ class DGCNN(nn.Module):
66
+ def __init__(self, in_channels, out_channels, k=20, emb_dims=1024, dropout=0.5):
67
+ super(DGCNN, self).__init__()
68
+
69
+ self.k = k
70
+
71
+ self.bn1 = nn.BatchNorm2d(64)
72
+ self.bn2 = nn.BatchNorm2d(64)
73
+ self.bn3 = nn.BatchNorm2d(64)
74
+ self.bn4 = nn.BatchNorm2d(64)
75
+ self.bn5 = nn.BatchNorm2d(64)
76
+ self.bn6 = nn.BatchNorm1d(emb_dims)
77
+ self.bn7 = nn.BatchNorm1d(512)
78
+ self.bn8 = nn.BatchNorm1d(256)
79
+
80
+ self.conv1 = nn.Sequential(
81
+ nn.Conv2d(in_channels * 2, 64, kernel_size=1, bias=False),
82
+ self.bn1,
83
+ nn.LeakyReLU(negative_slope=0.2),
84
+ )
85
+ self.conv2 = nn.Sequential(
86
+ nn.Conv2d(64, 64, kernel_size=1, bias=False),
87
+ self.bn2,
88
+ nn.LeakyReLU(negative_slope=0.2),
89
+ )
90
+ self.conv3 = nn.Sequential(
91
+ nn.Conv2d(64 * 2, 64, kernel_size=1, bias=False),
92
+ self.bn3,
93
+ nn.LeakyReLU(negative_slope=0.2),
94
+ )
95
+ self.conv4 = nn.Sequential(
96
+ nn.Conv2d(64, 64, kernel_size=1, bias=False),
97
+ self.bn4,
98
+ nn.LeakyReLU(negative_slope=0.2),
99
+ )
100
+ self.conv5 = nn.Sequential(
101
+ nn.Conv2d(64 * 2, 64, kernel_size=1, bias=False),
102
+ self.bn5,
103
+ nn.LeakyReLU(negative_slope=0.2),
104
+ )
105
+ self.conv6 = nn.Sequential(
106
+ nn.Conv1d(192, emb_dims, kernel_size=1, bias=False),
107
+ self.bn6,
108
+ nn.LeakyReLU(negative_slope=0.2),
109
+ )
110
+ self.conv7 = nn.Sequential(
111
+ nn.Conv1d(1216, 512, kernel_size=1, bias=False),
112
+ self.bn7,
113
+ nn.LeakyReLU(negative_slope=0.2),
114
+ )
115
+ self.conv8 = nn.Sequential(
116
+ nn.Conv1d(512, 256, kernel_size=1, bias=False),
117
+ self.bn8,
118
+ nn.LeakyReLU(negative_slope=0.2),
119
+ )
120
+ self.dp1 = nn.Dropout(p=dropout)
121
+ self.conv9 = nn.Conv1d(256, out_channels, kernel_size=1, bias=False)
122
+
123
+
124
+ def forward(self, x):
125
+ bs = x.size(0)
126
+ npoint = x.size(2)
127
+
128
+ # (bs, 9, npoint) -> (bs, 9*2, npoint, k)
129
+ x = get_graph_feature(x, k=self.k, dim9=True)
130
+ # (bs, 9*2, npoint, k) -> (bs, 64, npoint, k)
131
+ x = self.conv1(x)
132
+ # (bs, 64, npoint, k) -> (bs, 64, npoint, k)
133
+ x = self.conv2(x)
134
+ # (bs, 64, npoint, k) -> (bs, 64, npoint)
135
+ x1 = x.max(dim=-1, keepdim=False)[0]
136
+
137
+ # (bs, 64, npoint) -> (bs, 64*2, npoint, k)
138
+ x = get_graph_feature(x1, k=self.k)
139
+ # (bs, 64*2, npoint, k) -> (bs, 64, npoint, k)
140
+ x = self.conv3(x)
141
+ # (bs, 64, npoint, k) -> (bs, 64, npoint, k)
142
+ x = self.conv4(x)
143
+ # (bs, 64, npoint, k) -> (bs, 64, npoint)
144
+ x2 = x.max(dim=-1, keepdim=False)[0]
145
+
146
+ # (bs, 64, npoint) -> (bs, 64*2, npoint, k)
147
+ x = get_graph_feature(x2, k=self.k)
148
+ # (bs, 64*2, npoint, k) -> (bs, 64, npoint, k)
149
+ x = self.conv5(x)
150
+ # (bs, 64, npoint, k) -> (bs, 64, npoint)
151
+ x3 = x.max(dim=-1, keepdim=False)[0]
152
+
153
+ x = torch.cat((x1, x2, x3), dim=1) # (bs, 64*3, npoint)
154
+
155
+ # (bs, 64*3, npoint) -> (bs, emb_dims, npoint)
156
+ x = self.conv6(x)
157
+ # (bs, emb_dims, npoint) -> (bs, emb_dims, 1)
158
+ x = x.max(dim=-1, keepdim=True)[0]
159
+
160
+ x = x.repeat(1, 1, npoint) # (bs, 1024, npoint)
161
+ x = torch.cat((x, x1, x2, x3), dim=1) # (bs, 1024+64*3, npoint)
162
+
163
+ # (bs, 1024+64*3, npoint) -> (bs, 512, npoint)
164
+ x = self.conv7(x)
165
+ # (bs, 512, npoint) -> (bs, 256, npoint)
166
+ x = self.conv8(x)
167
+ x = self.dp1(x)
168
+ # (bs, 256, npoint) -> (bs, 13, npoint)
169
+ x = self.conv9(x)
170
+ # (bs, 13, npoint) -> (bs, npoint, 13)
171
+ x = x.transpose(2, 1).contiguous()
172
+
173
+ return x, None
174
+
175
+
176
+ class JABModule(nn.Module):
177
+ # projects raw geometric features into a compact representation
178
+ def __init__(self, in_dim=9, out_dim=16):
179
+ super().__init__()
180
+ self.fc1 = nn.Linear(in_dim, out_dim)
181
+ self.bn1 = nn.BatchNorm1d(out_dim)
182
+
183
+
184
+ def forward(self, features):
185
+ # features: (B, F, N) with F = number of GFs per point
186
+ x = features.transpose(1, 2) # (B, N, F)
187
+ x = self.fc1(x) # (B, N, out_dim) # if some features are spatial we maybe need to transform them
188
+ x = x.transpose(1, 2) # (B, out_dim, N)
189
+ x = F.relu(self.bn1(x)) # batch norm over feature dimension
190
+ return x # (B, out_dim, N)
191
+
192
+ class DGCNN_JAB(nn.Module):
193
+ def __init__(self, in_channels, out_channels, jab_out_channels=9, k=20, emb_dims=1024, dropout=0.5):
194
+ super(DGCNN_JAB, self).__init__()
195
+
196
+ self.coord_channels = 3
197
+ self.k = k
198
+ self.jab_module = JABModule(in_dim=in_channels-self.coord_channels, out_dim=jab_out_channels)
199
+
200
+
201
+ self.bn1 = nn.BatchNorm2d(64)
202
+ self.bn2 = nn.BatchNorm2d(64)
203
+ self.bn3 = nn.BatchNorm2d(64)
204
+ self.bn4 = nn.BatchNorm2d(64)
205
+ self.bn5 = nn.BatchNorm2d(64)
206
+ self.bn6 = nn.BatchNorm1d(emb_dims)
207
+ self.bn7 = nn.BatchNorm1d(512)
208
+ self.bn8 = nn.BatchNorm1d(256)
209
+
210
+ self.conv1 = nn.Sequential(
211
+ nn.Conv2d(self.coord_channels * 2, 64, kernel_size=1, bias=False),
212
+ self.bn1,
213
+ nn.LeakyReLU(negative_slope=0.2),
214
+ )
215
+ self.conv2 = nn.Sequential(
216
+ nn.Conv2d(64, 64, kernel_size=1, bias=False),
217
+ self.bn2,
218
+ nn.LeakyReLU(negative_slope=0.2),
219
+ )
220
+ self.conv3 = nn.Sequential(
221
+ nn.Conv2d((64 + jab_out_channels) * 2, 64, kernel_size=1, bias=False),
222
+ self.bn3,
223
+ nn.LeakyReLU(negative_slope=0.2),
224
+ )
225
+ self.conv4 = nn.Sequential(
226
+ nn.Conv2d(64, 64, kernel_size=1, bias=False),
227
+ self.bn4,
228
+ nn.LeakyReLU(negative_slope=0.2),
229
+ )
230
+ self.conv5 = nn.Sequential(
231
+ nn.Conv2d(64 * 2, 64, kernel_size=1, bias=False),
232
+ self.bn5,
233
+ nn.LeakyReLU(negative_slope=0.2),
234
+ )
235
+ self.conv6 = nn.Sequential(
236
+ nn.Conv1d(192 + jab_out_channels, emb_dims, kernel_size=1, bias=False),
237
+ self.bn6,
238
+ nn.LeakyReLU(negative_slope=0.2),
239
+ )
240
+ self.conv7 = nn.Sequential(
241
+ nn.Conv1d(1216 + jab_out_channels, 512, kernel_size=1, bias=False),
242
+ self.bn7,
243
+ nn.LeakyReLU(negative_slope=0.2),
244
+ )
245
+ self.conv8 = nn.Sequential(
246
+ nn.Conv1d(512, 256, kernel_size=1, bias=False),
247
+ self.bn8,
248
+ nn.LeakyReLU(negative_slope=0.2),
249
+ )
250
+ self.dp1 = nn.Dropout(p=dropout)
251
+ self.conv9 = nn.Conv1d(256, out_channels, kernel_size=1, bias=False)
252
+
253
+
254
+ def forward(self, x):
255
+ bs = x.size(0)
256
+ npoint = x.size(2)
257
+ gf = x[:,3:12,:]
258
+ x = x [:,0:3,:]
259
+
260
+ # (bs, 9, npoint) -> (bs, 9*2, npoint, k)
261
+ x = get_graph_feature(x, k=self.k, dim9=True)
262
+ # (bs, 9*2, npoint, k) -> (bs, 64, npoint, k)
263
+ x = self.conv1(x)
264
+ # (bs, 64, npoint, k) -> (bs, 64, npoint, k)
265
+ x = self.conv2(x)
266
+ # (bs, 64, npoint, k) -> (bs, 64, npoint)
267
+ x1 = x.max(dim=-1, keepdim=False)[0]
268
+
269
+ latent_gf = self.jab_module(gf) # (n, 16)
270
+ x1 = torch.cat([x1, latent_gf], dim=1) # (n, 64 + 16)
271
+
272
+ # (bs, 64, npoint) -> (bs, 64*2, npoint, k)
273
+ x = get_graph_feature(x1, k=self.k)
274
+ # (bs, 64*2, npoint, k) -> (bs, 64, npoint, k)
275
+ x = self.conv3(x)
276
+ # (bs, 64, npoint, k) -> (bs, 64, npoint, k)
277
+ x = self.conv4(x)
278
+ # (bs, 64, npoint, k) -> (bs, 64, npoint)
279
+ x2 = x.max(dim=-1, keepdim=False)[0]
280
+
281
+ # (bs, 64, npoint) -> (bs, 64*2, npoint, k)
282
+ x = get_graph_feature(x2, k=self.k)
283
+ # (bs, 64*2, npoint, k) -> (bs, 64, npoint, k)
284
+ x = self.conv5(x)
285
+ # (bs, 64, npoint, k) -> (bs, 64, npoint)
286
+ x3 = x.max(dim=-1, keepdim=False)[0]
287
+
288
+ x = torch.cat((x1, x2, x3), dim=1) # (bs, 64*3, npoint)
289
+
290
+ # (bs, 64*3, npoint) -> (bs, emb_dims, npoint)
291
+ x = self.conv6(x)
292
+ # (bs, emb_dims, npoint) -> (bs, emb_dims, 1)
293
+ x = x.max(dim=-1, keepdim=True)[0]
294
+
295
+ x = x.repeat(1, 1, npoint) # (bs, 1024, npoint)
296
+ x = torch.cat((x, x1, x2, x3), dim=1) # (bs, 1024+64*3, npoint)
297
+
298
+ # (bs, 1024+64*3, npoint) -> (bs, 512, npoint)
299
+ x = self.conv7(x)
300
+ # (bs, 512, npoint) -> (bs, 256, npoint)
301
+ x = self.conv8(x)
302
+ x = self.dp1(x)
303
+ # (bs, 256, npoint) -> (bs, 13, npoint)
304
+ x = self.conv9(x)
305
+ # (bs, 13, npoint) -> (bs, npoint, 13)
306
+ x = x.transpose(2, 1).contiguous()
307
+
308
+ return x, None
s3dis-latent-inject-r-0.5/models/best.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:36c39479ab2f2e37f5ace438f1019444b435c65a7dc358700105a233d30addff
3
+ size 12039591
s3dis-latent-inject-r-0.5/models/last.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b580868ea38be75b729f161a36d51097509a60a5255bb63c4f1bc210e7489a0
3
+ size 12039738
s3dis-latent-inject-r-0.5/run.log ADDED
@@ -0,0 +1,1279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Experiment on S3DIS dataset!
2
+ Namespace(exp_name='s3dis-latent-inject-r-0.5', data_root='../../data/gf_s3dis_ss_0.05', model_path='', split='val', in_channels=12, num_classes=13, class_names=['ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door', 'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter'], feature_to_file_mapping={'coord': ['X_SS_SPATIAL_0.05', 'Y_SS_SPATIAL_0.05', 'Z_SS_SPATIAL_0.05'], 'segment': 'segment_SS_SPATIAL_0.05', 'Anisotropy': 'Anisotropy_(0.5)_SS_SPATIAL_0.05', 'Octree_normals': ['Nx_SS_SPATIAL_0.05', 'Ny_SS_SPATIAL_0.05', 'Nz_SS_SPATIAL_0.05'], 'PCA1': 'PCA1_(0.5)_SS_SPATIAL_0.05', 'PCA2': 'PCA2_(0.5)_SS_SPATIAL_0.05', 'Roughness': 'Roughness_(0.5)_SS_SPATIAL_0.05', 'Sphericity': 'Sphericity_(0.5)_SS_SPATIAL_0.05', 'Verticality': 'Verticality_(0.5)_SS_SPATIAL_0.05'}, ignore_index=-1, coord_only=False, num_points=8192, dropout=0.5, emb_dims=1024, k=20, batch_size=8, epoch=100, learning_rate=0.001, optimizer='Adam', decay_rate=0.0001, lr_scheduler='cosine', step_size=10, lr_decay=0.7, eval=0, save_model_freq=1, seed=1, visu='', visu_format='ply', train_val=False, jab=True, jab_out_channels=9, sync_bn=False)
3
+ Using Adam optimizer
4
+ Using Cosine LR decay
5
+ Loading data
6
+ The number of training data is: 611
7
+
8
+
9
+ **** Epoch 0 (0/100) ****
10
+ BN momentum updated to: 0.1000
11
+ Training mean loss: 1.7984
12
+ Training accuracy: 0.4598
13
+ Learning rate: 0.001000
14
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_0.pth
15
+
16
+
17
+ **** Epoch 1 (1/100) ****
18
+ BN momentum updated to: 0.1000
19
+ Training mean loss: 1.2316
20
+ Training accuracy: 0.6211
21
+ Learning rate: 0.001000
22
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_1.pth
23
+
24
+
25
+ **** Epoch 2 (2/100) ****
26
+ BN momentum updated to: 0.1000
27
+ Training mean loss: 1.1211
28
+ Training accuracy: 0.6416
29
+ Learning rate: 0.000999
30
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_2.pth
31
+
32
+
33
+ **** Epoch 3 (3/100) ****
34
+ BN momentum updated to: 0.1000
35
+ Training mean loss: 0.9831
36
+ Training accuracy: 0.6806
37
+ Learning rate: 0.000998
38
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_3.pth
39
+
40
+
41
+ **** Epoch 4 (4/100) ****
42
+ BN momentum updated to: 0.1000
43
+ Training mean loss: 0.8977
44
+ Training accuracy: 0.6991
45
+ Learning rate: 0.000996
46
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_4.pth
47
+
48
+
49
+ **** Epoch 5 (5/100) ****
50
+ BN momentum updated to: 0.1000
51
+ Training mean loss: 0.8364
52
+ Training accuracy: 0.7165
53
+ Learning rate: 0.000994
54
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_5.pth
55
+
56
+
57
+ **** Epoch 6 (6/100) ****
58
+ BN momentum updated to: 0.1000
59
+ Training mean loss: 0.8162
60
+ Training accuracy: 0.7236
61
+ Learning rate: 0.000991
62
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_6.pth
63
+
64
+
65
+ **** Epoch 7 (7/100) ****
66
+ BN momentum updated to: 0.1000
67
+ Training mean loss: 0.7753
68
+ Training accuracy: 0.7373
69
+ Learning rate: 0.000988
70
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_7.pth
71
+
72
+
73
+ **** Epoch 8 (8/100) ****
74
+ BN momentum updated to: 0.1000
75
+ Training mean loss: 0.7624
76
+ Training accuracy: 0.7395
77
+ Learning rate: 0.000984
78
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_8.pth
79
+
80
+
81
+ **** Epoch 9 (9/100) ****
82
+ BN momentum updated to: 0.1000
83
+ Training mean loss: 0.7155
84
+ Training accuracy: 0.7605
85
+ Learning rate: 0.000980
86
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_9.pth
87
+
88
+
89
+ **** Epoch 10 (10/100) ****
90
+ BN momentum updated to: 0.0500
91
+ Training mean loss: 0.6746
92
+ Training accuracy: 0.7718
93
+ Learning rate: 0.000976
94
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_10.pth
95
+
96
+
97
+ **** Epoch 11 (11/100) ****
98
+ BN momentum updated to: 0.0500
99
+ Training mean loss: 0.6223
100
+ Training accuracy: 0.7862
101
+ Learning rate: 0.000971
102
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_11.pth
103
+
104
+
105
+ **** Epoch 12 (12/100) ****
106
+ BN momentum updated to: 0.0500
107
+ Training mean loss: 0.5937
108
+ Training accuracy: 0.7983
109
+ Learning rate: 0.000965
110
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_12.pth
111
+
112
+
113
+ **** Epoch 13 (13/100) ****
114
+ BN momentum updated to: 0.0500
115
+ Training mean loss: 0.5775
116
+ Training accuracy: 0.7959
117
+ Learning rate: 0.000959
118
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_13.pth
119
+
120
+
121
+ **** Epoch 14 (14/100) ****
122
+ BN momentum updated to: 0.0500
123
+ Training mean loss: 0.5840
124
+ Training accuracy: 0.8004
125
+ Learning rate: 0.000953
126
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_14.pth
127
+
128
+
129
+ **** Epoch 15 (15/100) ****
130
+ BN momentum updated to: 0.0500
131
+ Training mean loss: 0.5525
132
+ Training accuracy: 0.8105
133
+ Learning rate: 0.000946
134
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_15.pth
135
+
136
+
137
+ **** Epoch 16 (16/100) ****
138
+ BN momentum updated to: 0.0500
139
+ Training mean loss: 0.5601
140
+ Training accuracy: 0.8031
141
+ Learning rate: 0.000939
142
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_16.pth
143
+
144
+
145
+ **** Epoch 17 (17/100) ****
146
+ BN momentum updated to: 0.0500
147
+ Training mean loss: 0.5025
148
+ Training accuracy: 0.8266
149
+ Learning rate: 0.000931
150
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_17.pth
151
+
152
+
153
+ **** Epoch 18 (18/100) ****
154
+ BN momentum updated to: 0.0500
155
+ Training mean loss: 0.4880
156
+ Training accuracy: 0.8321
157
+ Learning rate: 0.000923
158
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_18.pth
159
+
160
+
161
+ **** Epoch 19 (19/100) ****
162
+ BN momentum updated to: 0.0500
163
+ Training mean loss: 0.4657
164
+ Training accuracy: 0.8380
165
+ Learning rate: 0.000914
166
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_19.pth
167
+
168
+
169
+ **** Epoch 20 (20/100) ****
170
+ BN momentum updated to: 0.0250
171
+ Training mean loss: 0.4654
172
+ Training accuracy: 0.8392
173
+ Learning rate: 0.000905
174
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_20.pth
175
+
176
+
177
+ **** Epoch 21 (21/100) ****
178
+ BN momentum updated to: 0.0250
179
+ Training mean loss: 0.4649
180
+ Training accuracy: 0.8393
181
+ Learning rate: 0.000896
182
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_21.pth
183
+
184
+
185
+ **** Epoch 22 (22/100) ****
186
+ BN momentum updated to: 0.0250
187
+ Training mean loss: 0.4531
188
+ Training accuracy: 0.8441
189
+ Learning rate: 0.000886
190
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_22.pth
191
+
192
+
193
+ **** Epoch 23 (23/100) ****
194
+ BN momentum updated to: 0.0250
195
+ Training mean loss: 0.4202
196
+ Training accuracy: 0.8530
197
+ Learning rate: 0.000876
198
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_23.pth
199
+
200
+
201
+ **** Epoch 24 (24/100) ****
202
+ BN momentum updated to: 0.0250
203
+ Training mean loss: 0.4107
204
+ Training accuracy: 0.8580
205
+ Learning rate: 0.000866
206
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_24.pth
207
+
208
+
209
+ **** Epoch 25 (25/100) ****
210
+ BN momentum updated to: 0.0250
211
+ Training mean loss: 0.4030
212
+ Training accuracy: 0.8607
213
+ Learning rate: 0.000855
214
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_25.pth
215
+
216
+
217
+ **** Epoch 26 (26/100) ****
218
+ BN momentum updated to: 0.0250
219
+ Training mean loss: 0.4294
220
+ Training accuracy: 0.8524
221
+ Learning rate: 0.000844
222
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_26.pth
223
+
224
+
225
+ **** Epoch 27 (27/100) ****
226
+ BN momentum updated to: 0.0250
227
+ Training mean loss: 0.4036
228
+ Training accuracy: 0.8615
229
+ Learning rate: 0.000832
230
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_27.pth
231
+
232
+
233
+ **** Epoch 28 (28/100) ****
234
+ BN momentum updated to: 0.0250
235
+ Training mean loss: 0.3866
236
+ Training accuracy: 0.8672
237
+ Learning rate: 0.000821
238
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_28.pth
239
+
240
+
241
+ **** Epoch 29 (29/100) ****
242
+ BN momentum updated to: 0.0250
243
+ Training mean loss: 0.3632
244
+ Training accuracy: 0.8738
245
+ Learning rate: 0.000808
246
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_29.pth
247
+
248
+
249
+ **** Epoch 30 (30/100) ****
250
+ BN momentum updated to: 0.0125
251
+ Training mean loss: 0.3905
252
+ Training accuracy: 0.8646
253
+ Learning rate: 0.000796
254
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_30.pth
255
+
256
+
257
+ **** Epoch 31 (31/100) ****
258
+ BN momentum updated to: 0.0125
259
+ Training mean loss: 0.3666
260
+ Training accuracy: 0.8716
261
+ Learning rate: 0.000783
262
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_31.pth
263
+
264
+
265
+ **** Epoch 32 (32/100) ****
266
+ BN momentum updated to: 0.0125
267
+ Training mean loss: 0.3413
268
+ Training accuracy: 0.8815
269
+ Learning rate: 0.000770
270
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_32.pth
271
+
272
+
273
+ **** Epoch 33 (33/100) ****
274
+ BN momentum updated to: 0.0125
275
+ Training mean loss: 0.3337
276
+ Training accuracy: 0.8833
277
+ Learning rate: 0.000757
278
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_33.pth
279
+
280
+
281
+ **** Epoch 34 (34/100) ****
282
+ BN momentum updated to: 0.0125
283
+ Training mean loss: 0.3292
284
+ Training accuracy: 0.8856
285
+ Learning rate: 0.000743
286
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_34.pth
287
+
288
+
289
+ **** Epoch 35 (35/100) ****
290
+ BN momentum updated to: 0.0125
291
+ Training mean loss: 0.3208
292
+ Training accuracy: 0.8849
293
+ Learning rate: 0.000730
294
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_35.pth
295
+
296
+
297
+ **** Epoch 36 (36/100) ****
298
+ BN momentum updated to: 0.0125
299
+ Training mean loss: 0.3161
300
+ Training accuracy: 0.8901
301
+ Learning rate: 0.000716
302
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_36.pth
303
+
304
+
305
+ **** Epoch 37 (37/100) ****
306
+ BN momentum updated to: 0.0125
307
+ Training mean loss: 0.2960
308
+ Training accuracy: 0.8937
309
+ Learning rate: 0.000702
310
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_37.pth
311
+
312
+
313
+ **** Epoch 38 (38/100) ****
314
+ BN momentum updated to: 0.0125
315
+ Training mean loss: 0.3290
316
+ Training accuracy: 0.8824
317
+ Learning rate: 0.000687
318
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_38.pth
319
+
320
+
321
+ **** Epoch 39 (39/100) ****
322
+ BN momentum updated to: 0.0125
323
+ Training mean loss: 0.3200
324
+ Training accuracy: 0.8881
325
+ Learning rate: 0.000673
326
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_39.pth
327
+
328
+
329
+ **** Epoch 40 (40/100) ****
330
+ BN momentum updated to: 0.0100
331
+ Training mean loss: 0.3091
332
+ Training accuracy: 0.8897
333
+ Learning rate: 0.000658
334
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_40.pth
335
+
336
+
337
+ **** Epoch 41 (41/100) ****
338
+ BN momentum updated to: 0.0100
339
+ Training mean loss: 0.3135
340
+ Training accuracy: 0.8903
341
+ Learning rate: 0.000643
342
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_41.pth
343
+
344
+
345
+ **** Epoch 42 (42/100) ****
346
+ BN momentum updated to: 0.0100
347
+ Training mean loss: 0.2907
348
+ Training accuracy: 0.8973
349
+ Learning rate: 0.000628
350
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_42.pth
351
+
352
+
353
+ **** Epoch 43 (43/100) ****
354
+ BN momentum updated to: 0.0100
355
+ Training mean loss: 0.2872
356
+ Training accuracy: 0.8964
357
+ Learning rate: 0.000613
358
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_43.pth
359
+
360
+
361
+ **** Epoch 44 (44/100) ****
362
+ BN momentum updated to: 0.0100
363
+ Training mean loss: 0.2941
364
+ Training accuracy: 0.8965
365
+ Learning rate: 0.000598
366
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_44.pth
367
+
368
+
369
+ **** Epoch 45 (45/100) ****
370
+ BN momentum updated to: 0.0100
371
+ Training mean loss: 0.3249
372
+ Training accuracy: 0.8855
373
+ Learning rate: 0.000582
374
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_45.pth
375
+
376
+
377
+ **** Epoch 46 (46/100) ****
378
+ BN momentum updated to: 0.0100
379
+ Training mean loss: 0.3135
380
+ Training accuracy: 0.8916
381
+ Learning rate: 0.000567
382
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_46.pth
383
+
384
+
385
+ **** Epoch 47 (47/100) ****
386
+ BN momentum updated to: 0.0100
387
+ Training mean loss: 0.2825
388
+ Training accuracy: 0.9007
389
+ Learning rate: 0.000552
390
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_47.pth
391
+
392
+
393
+ **** Epoch 48 (48/100) ****
394
+ BN momentum updated to: 0.0100
395
+ Training mean loss: 0.3059
396
+ Training accuracy: 0.8957
397
+ Learning rate: 0.000536
398
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_48.pth
399
+
400
+
401
+ **** Epoch 49 (49/100) ****
402
+ BN momentum updated to: 0.0100
403
+ Training mean loss: 0.2929
404
+ Training accuracy: 0.8961
405
+ Learning rate: 0.000521
406
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_49.pth
407
+
408
+
409
+ **** Epoch 50 (50/100) ****
410
+ BN momentum updated to: 0.0100
411
+ Training mean loss: 0.2684
412
+ Training accuracy: 0.9041
413
+ Learning rate: 0.000505
414
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_50.pth
415
+
416
+
417
+ **** Epoch 51 (51/100) ****
418
+ BN momentum updated to: 0.0100
419
+ Training mean loss: 0.2574
420
+ Training accuracy: 0.9091
421
+ Learning rate: 0.000489
422
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_51.pth
423
+
424
+
425
+ **** Epoch 52 (52/100) ****
426
+ BN momentum updated to: 0.0100
427
+ Training mean loss: 0.2461
428
+ Training accuracy: 0.9109
429
+ Learning rate: 0.000474
430
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_52.pth
431
+
432
+
433
+ **** Epoch 53 (53/100) ****
434
+ BN momentum updated to: 0.0100
435
+ Training mean loss: 0.2368
436
+ Training accuracy: 0.9150
437
+ Learning rate: 0.000458
438
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_53.pth
439
+
440
+
441
+ **** Epoch 54 (54/100) ****
442
+ BN momentum updated to: 0.0100
443
+ Training mean loss: 0.2301
444
+ Training accuracy: 0.9170
445
+ Learning rate: 0.000443
446
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_54.pth
447
+
448
+
449
+ **** Epoch 55 (55/100) ****
450
+ BN momentum updated to: 0.0100
451
+ Training mean loss: 0.2274
452
+ Training accuracy: 0.9185
453
+ Learning rate: 0.000428
454
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_55.pth
455
+
456
+
457
+ **** Epoch 56 (56/100) ****
458
+ BN momentum updated to: 0.0100
459
+ Training mean loss: 0.2235
460
+ Training accuracy: 0.9193
461
+ Learning rate: 0.000412
462
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_56.pth
463
+
464
+
465
+ **** Epoch 57 (57/100) ****
466
+ BN momentum updated to: 0.0100
467
+ Training mean loss: 0.2193
468
+ Training accuracy: 0.9199
469
+ Learning rate: 0.000397
470
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_57.pth
471
+
472
+
473
+ **** Epoch 58 (58/100) ****
474
+ BN momentum updated to: 0.0100
475
+ Training mean loss: 0.2112
476
+ Training accuracy: 0.9234
477
+ Learning rate: 0.000382
478
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_58.pth
479
+
480
+
481
+ **** Epoch 59 (59/100) ****
482
+ BN momentum updated to: 0.0100
483
+ Training mean loss: 0.2162
484
+ Training accuracy: 0.9213
485
+ Learning rate: 0.000367
486
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_59.pth
487
+
488
+
489
+ **** Epoch 60 (60/100) ****
490
+ BN momentum updated to: 0.0100
491
+ Training mean loss: 0.2183
492
+ Training accuracy: 0.9207
493
+ Learning rate: 0.000352
494
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_60.pth
495
+
496
+
497
+ **** Epoch 61 (61/100) ****
498
+ BN momentum updated to: 0.0100
499
+ Training mean loss: 0.2134
500
+ Training accuracy: 0.9229
501
+ Learning rate: 0.000337
502
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_61.pth
503
+
504
+
505
+ **** Epoch 62 (62/100) ****
506
+ BN momentum updated to: 0.0100
507
+ Training mean loss: 0.2067
508
+ Training accuracy: 0.9261
509
+ Learning rate: 0.000323
510
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_62.pth
511
+
512
+
513
+ **** Epoch 63 (63/100) ****
514
+ BN momentum updated to: 0.0100
515
+ Training mean loss: 0.2015
516
+ Training accuracy: 0.9265
517
+ Learning rate: 0.000308
518
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_63.pth
519
+
520
+
521
+ **** Epoch 64 (64/100) ****
522
+ BN momentum updated to: 0.0100
523
+ Training mean loss: 0.2150
524
+ Training accuracy: 0.9228
525
+ Learning rate: 0.000294
526
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_64.pth
527
+
528
+
529
+ **** Epoch 65 (65/100) ****
530
+ BN momentum updated to: 0.0100
531
+ Training mean loss: 0.1995
532
+ Training accuracy: 0.9273
533
+ Learning rate: 0.000280
534
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_65.pth
535
+
536
+
537
+ **** Epoch 66 (66/100) ****
538
+ BN momentum updated to: 0.0100
539
+ Training mean loss: 0.1987
540
+ Training accuracy: 0.9281
541
+ Learning rate: 0.000267
542
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_66.pth
543
+
544
+
545
+ **** Epoch 67 (67/100) ****
546
+ BN momentum updated to: 0.0100
547
+ Training mean loss: 0.1989
548
+ Training accuracy: 0.9271
549
+ Learning rate: 0.000253
550
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_67.pth
551
+
552
+
553
+ **** Epoch 68 (68/100) ****
554
+ BN momentum updated to: 0.0100
555
+ Training mean loss: 0.1955
556
+ Training accuracy: 0.9288
557
+ Learning rate: 0.000240
558
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_68.pth
559
+
560
+
561
+ **** Epoch 69 (69/100) ****
562
+ BN momentum updated to: 0.0100
563
+ Training mean loss: 0.1919
564
+ Training accuracy: 0.9302
565
+ Learning rate: 0.000227
566
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_69.pth
567
+
568
+
569
+ **** Epoch 70 (70/100) ****
570
+ BN momentum updated to: 0.0100
571
+ Training mean loss: 0.1887
572
+ Training accuracy: 0.9313
573
+ Learning rate: 0.000214
574
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_70.pth
575
+
576
+
577
+ **** Epoch 71 (71/100) ****
578
+ BN momentum updated to: 0.0100
579
+ Training mean loss: 0.1882
580
+ Training accuracy: 0.9312
581
+ Learning rate: 0.000202
582
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_71.pth
583
+
584
+
585
+ **** Epoch 72 (72/100) ****
586
+ BN momentum updated to: 0.0100
587
+ Training mean loss: 0.1845
588
+ Training accuracy: 0.9324
589
+ Learning rate: 0.000189
590
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_72.pth
591
+
592
+
593
+ **** Epoch 73 (73/100) ****
594
+ BN momentum updated to: 0.0100
595
+ Training mean loss: 0.1866
596
+ Training accuracy: 0.9320
597
+ Learning rate: 0.000178
598
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_73.pth
599
+
600
+
601
+ **** Epoch 74 (74/100) ****
602
+ BN momentum updated to: 0.0100
603
+ Training mean loss: 0.1856
604
+ Training accuracy: 0.9322
605
+ Learning rate: 0.000166
606
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_74.pth
607
+
608
+
609
+ **** Epoch 75 (75/100) ****
610
+ BN momentum updated to: 0.0100
611
+ Training mean loss: 0.1737
612
+ Training accuracy: 0.9362
613
+ Learning rate: 0.000155
614
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_75.pth
615
+
616
+
617
+ **** Epoch 76 (76/100) ****
618
+ BN momentum updated to: 0.0100
619
+ Training mean loss: 0.1722
620
+ Training accuracy: 0.9366
621
+ Learning rate: 0.000144
622
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_76.pth
623
+
624
+
625
+ **** Epoch 77 (77/100) ****
626
+ BN momentum updated to: 0.0100
627
+ Training mean loss: 0.1752
628
+ Training accuracy: 0.9357
629
+ Learning rate: 0.000134
630
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_77.pth
631
+
632
+
633
+ **** Epoch 78 (78/100) ****
634
+ BN momentum updated to: 0.0100
635
+ Training mean loss: 0.1722
636
+ Training accuracy: 0.9366
637
+ Learning rate: 0.000124
638
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_78.pth
639
+
640
+
641
+ **** Epoch 79 (79/100) ****
642
+ BN momentum updated to: 0.0100
643
+ Training mean loss: 0.1679
644
+ Training accuracy: 0.9385
645
+ Learning rate: 0.000114
646
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_79.pth
647
+
648
+
649
+ **** Epoch 80 (80/100) ****
650
+ BN momentum updated to: 0.0100
651
+ Training mean loss: 0.1692
652
+ Training accuracy: 0.9378
653
+ Learning rate: 0.000105
654
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_80.pth
655
+
656
+
657
+ **** Epoch 81 (81/100) ****
658
+ BN momentum updated to: 0.0100
659
+ Training mean loss: 0.1652
660
+ Training accuracy: 0.9396
661
+ Learning rate: 0.000096
662
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_81.pth
663
+
664
+
665
+ **** Epoch 82 (82/100) ****
666
+ BN momentum updated to: 0.0100
667
+ Training mean loss: 0.1680
668
+ Training accuracy: 0.9383
669
+ Learning rate: 0.000087
670
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_82.pth
671
+
672
+
673
+ **** Epoch 83 (83/100) ****
674
+ BN momentum updated to: 0.0100
675
+ Training mean loss: 0.1619
676
+ Training accuracy: 0.9407
677
+ Learning rate: 0.000079
678
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_83.pth
679
+
680
+
681
+ **** Epoch 84 (84/100) ****
682
+ BN momentum updated to: 0.0100
683
+ Training mean loss: 0.1646
684
+ Training accuracy: 0.9391
685
+ Learning rate: 0.000071
686
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_84.pth
687
+
688
+
689
+ **** Epoch 85 (85/100) ****
690
+ BN momentum updated to: 0.0100
691
+ Training mean loss: 0.1564
692
+ Training accuracy: 0.9425
693
+ Learning rate: 0.000064
694
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_85.pth
695
+
696
+
697
+ **** Epoch 86 (86/100) ****
698
+ BN momentum updated to: 0.0100
699
+ Training mean loss: 0.1591
700
+ Training accuracy: 0.9415
701
+ Learning rate: 0.000057
702
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_86.pth
703
+
704
+
705
+ **** Epoch 87 (87/100) ****
706
+ BN momentum updated to: 0.0100
707
+ Training mean loss: 0.1604
708
+ Training accuracy: 0.9412
709
+ Learning rate: 0.000051
710
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_87.pth
711
+
712
+
713
+ **** Epoch 88 (88/100) ****
714
+ BN momentum updated to: 0.0100
715
+ Training mean loss: 0.1603
716
+ Training accuracy: 0.9413
717
+ Learning rate: 0.000045
718
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_88.pth
719
+
720
+
721
+ **** Epoch 89 (89/100) ****
722
+ BN momentum updated to: 0.0100
723
+ Training mean loss: 0.1559
724
+ Training accuracy: 0.9420
725
+ Learning rate: 0.000039
726
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_89.pth
727
+
728
+
729
+ **** Epoch 90 (90/100) ****
730
+ BN momentum updated to: 0.0100
731
+ Training mean loss: 0.1538
732
+ Training accuracy: 0.9433
733
+ Learning rate: 0.000034
734
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_90.pth
735
+
736
+
737
+ **** Epoch 91 (91/100) ****
738
+ BN momentum updated to: 0.0100
739
+ Training mean loss: 0.1561
740
+ Training accuracy: 0.9428
741
+ Learning rate: 0.000030
742
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_91.pth
743
+
744
+
745
+ **** Epoch 92 (92/100) ****
746
+ BN momentum updated to: 0.0100
747
+ Training mean loss: 0.1509
748
+ Training accuracy: 0.9442
749
+ Learning rate: 0.000026
750
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_92.pth
751
+
752
+
753
+ **** Epoch 93 (93/100) ****
754
+ BN momentum updated to: 0.0100
755
+ Training mean loss: 0.1526
756
+ Training accuracy: 0.9440
757
+ Learning rate: 0.000022
758
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_93.pth
759
+
760
+
761
+ **** Epoch 94 (94/100) ****
762
+ BN momentum updated to: 0.0100
763
+ Training mean loss: 0.1537
764
+ Training accuracy: 0.9435
765
+ Learning rate: 0.000019
766
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_94.pth
767
+
768
+
769
+ **** Epoch 95 (95/100) ****
770
+ BN momentum updated to: 0.0100
771
+ Training mean loss: 0.1546
772
+ Training accuracy: 0.9433
773
+ Learning rate: 0.000016
774
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_95.pth
775
+
776
+
777
+ **** Epoch 96 (96/100) ****
778
+ BN momentum updated to: 0.0100
779
+ Training mean loss: 0.1542
780
+ Training accuracy: 0.9435
781
+ Learning rate: 0.000014
782
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_96.pth
783
+
784
+
785
+ **** Epoch 97 (97/100) ****
786
+ BN momentum updated to: 0.0100
787
+ Training mean loss: 0.1550
788
+ Training accuracy: 0.9434
789
+ Learning rate: 0.000012
790
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_97.pth
791
+
792
+
793
+ **** Epoch 98 (98/100) ****
794
+ BN momentum updated to: 0.0100
795
+ Training mean loss: 0.1519
796
+ Training accuracy: 0.9439
797
+ Learning rate: 0.000011
798
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_98.pth
799
+
800
+
801
+ **** Epoch 99 (99/100) ****
802
+ BN momentum updated to: 0.0100
803
+ Training mean loss: 0.1536
804
+ Training accuracy: 0.9433
805
+ Learning rate: 0.000010
806
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_99.pth
807
+
808
+
809
+ **** Epoch 100 (100/100) ****
810
+ BN momentum updated to: 0.0100
811
+ Training mean loss: 0.1586
812
+ Training accuracy: 0.9421
813
+ Learning rate: 0.000010
814
+ Saving at outputs/s3dis-latent-inject-r-0.5/models/model_100.pth
815
+ Experiment on S3DIS dataset!
816
+ Namespace(exp_name='s3dis-latent-inject-r-0.5', data_root='../../data/gf_s3dis_ss_0.05', model_path='', split='val', in_channels=12, num_classes=13, class_names=['ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door', 'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter'], feature_to_file_mapping={'coord': ['X_SS_SPATIAL_0.05', 'Y_SS_SPATIAL_0.05', 'Z_SS_SPATIAL_0.05'], 'segment': 'segment_SS_SPATIAL_0.05', 'Anisotropy': 'Anisotropy_(0.5)_SS_SPATIAL_0.05', 'Octree_normals': ['Nx_SS_SPATIAL_0.05', 'Ny_SS_SPATIAL_0.05', 'Nz_SS_SPATIAL_0.05'], 'PCA1': 'PCA1_(0.5)_SS_SPATIAL_0.05', 'PCA2': 'PCA2_(0.5)_SS_SPATIAL_0.05', 'Roughness': 'Roughness_(0.5)_SS_SPATIAL_0.05', 'Sphericity': 'Sphericity_(0.5)_SS_SPATIAL_0.05', 'Verticality': 'Verticality_(0.5)_SS_SPATIAL_0.05'}, ignore_index=-1, coord_only=False, num_points=8192, dropout=0.5, emb_dims=1024, k=20, batch_size=8, epoch=100, learning_rate=0.001, optimizer='Adam', decay_rate=0.0001, lr_scheduler='cosine', step_size=10, lr_decay=0.7, eval=0, save_model_freq=1, seed=1, visu='', visu_format='ply', train_val=False, jab=True, jab_out_channels=9, sync_bn=False)
817
+ Using Adam optimizer
818
+ Using Cosine LR decay
819
+ Loading data
820
+ Experiment on S3DIS dataset!
821
+ Namespace(exp_name='s3dis-latent-inject-r-0.5', data_root='../../data/gf_s3dis_ss_0.05', model_path='outputs/s3dis-latent-inject-r-0.5/models/model_99.pth', split='val', in_channels=12, num_classes=13, class_names=['ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door', 'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter'], feature_to_file_mapping={'coord': ['X_SS_SPATIAL_0.05', 'Y_SS_SPATIAL_0.05', 'Z_SS_SPATIAL_0.05'], 'segment': 'segment_SS_SPATIAL_0.05', 'Anisotropy': 'Anisotropy_(0.5)_SS_SPATIAL_0.05', 'Octree_normals': ['Nx_SS_SPATIAL_0.05', 'Ny_SS_SPATIAL_0.05', 'Nz_SS_SPATIAL_0.05'], 'PCA1': 'PCA1_(0.5)_SS_SPATIAL_0.05', 'PCA2': 'PCA2_(0.5)_SS_SPATIAL_0.05', 'Roughness': 'Roughness_(0.5)_SS_SPATIAL_0.05', 'Sphericity': 'Sphericity_(0.5)_SS_SPATIAL_0.05', 'Verticality': 'Verticality_(0.5)_SS_SPATIAL_0.05'}, ignore_index=-1, coord_only=False, num_points=8192, dropout=0.5, emb_dims=1024, k=20, batch_size=8, epoch=100, learning_rate=0.001, optimizer='Adam', decay_rate=0.0001, lr_scheduler='cosine', step_size=10, lr_decay=0.7, eval=2, save_model_freq=1, seed=1, visu='', visu_format='ply', train_val=False, jab=True, jab_out_channels=9, visualize=True, sync_bn=True)
822
+ Please check ZAHA num_points setting!
823
+ Loading pretrained model outputs/s3dis-latent-inject-r-0.5/models/model_99.pth
824
+ Loading data
825
+ The number of training data is: 245
826
+ Visualization enabled. Output directory: outputs/s3dis-latent-inject-r-0.5/visuals
827
+ ==== Evaluation Results ====
828
+ Mean loss: 0.7145
829
+ OA : 0.8266
830
+ μP : 0.6663
831
+ μIoU : 0.4827
832
+ μR : 0.5861
833
+ μF1 : 0.5937
834
+ ============================
835
+ ceiling | P: 0.9351 | R: 0.9646 | IoU: 0.9041 | F1: 0.9496
836
+ floor | P: 0.9857 | R: 0.9956 | IoU: 0.9814 | F1: 0.9906
837
+ wall | P: 0.8106 | R: 0.9318 | IoU: 0.7652 | F1: 0.8670
838
+ beam | P: 0.0028 | R: 0.0572 | IoU: 0.0027 | F1: 0.0053
839
+ column | P: 0.5625 | R: 0.3013 | IoU: 0.2441 | F1: 0.3924
840
+ window | P: 0.6722 | R: 0.1817 | IoU: 0.1669 | F1: 0.2861
841
+ door | P: 0.4760 | R: 0.7908 | IoU: 0.4228 | F1: 0.5943
842
+ table | P: 0.8628 | R: 0.8810 | IoU: 0.7728 | F1: 0.8718
843
+ chair | P: 0.6736 | R: 0.7175 | IoU: 0.5324 | F1: 0.6948
844
+ sofa | P: 0.6257 | R: 0.1436 | IoU: 0.1322 | F1: 0.2336
845
+ bookcase | P: 0.8736 | R: 0.6851 | IoU: 0.6233 | F1: 0.7680
846
+ board | P: 0.5347 | R: 0.4477 | IoU: 0.3222 | F1: 0.4873
847
+ clutter | P: 0.6469 | R: 0.5209 | IoU: 0.4056 | F1: 0.5771
848
+
849
+ Generating visualizations for 10 samples...
850
+ Saved visualizations for sample 0: outputs/s3dis-latent-inject-r-0.5/visuals/sample_000_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_000_pred.mp4
851
+ Saved visualizations for sample 1: outputs/s3dis-latent-inject-r-0.5/visuals/sample_001_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_001_pred.mp4
852
+ Saved visualizations for sample 2: outputs/s3dis-latent-inject-r-0.5/visuals/sample_002_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_002_pred.mp4
853
+ Saved visualizations for sample 3: outputs/s3dis-latent-inject-r-0.5/visuals/sample_003_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_003_pred.mp4
854
+ Saved visualizations for sample 4: outputs/s3dis-latent-inject-r-0.5/visuals/sample_004_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_004_pred.mp4
855
+ Saved visualizations for sample 5: outputs/s3dis-latent-inject-r-0.5/visuals/sample_005_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_005_pred.mp4
856
+ Saved visualizations for sample 6: outputs/s3dis-latent-inject-r-0.5/visuals/sample_006_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_006_pred.mp4
857
+ Saved visualizations for sample 7: outputs/s3dis-latent-inject-r-0.5/visuals/sample_007_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_007_pred.mp4
858
+ Saved visualizations for sample 8: outputs/s3dis-latent-inject-r-0.5/visuals/sample_008_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_008_pred.mp4
859
+ Saved visualizations for sample 9: outputs/s3dis-latent-inject-r-0.5/visuals/sample_009_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_009_pred.mp4
860
+ Visualization complete! Files saved to: outputs/s3dis-latent-inject-r-0.5/visuals
861
+ Experiment on S3DIS dataset!
862
+ Namespace(exp_name='s3dis-latent-inject-r-0.5', data_root='../../data/gf_s3dis_ss_0.05', model_path='outputs/s3dis-latent-inject-r-0.5/models/model_99.pth', split='val', in_channels=12, num_classes=13, class_names=['ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door', 'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter'], feature_to_file_mapping={'coord': ['X_SS_SPATIAL_0.05', 'Y_SS_SPATIAL_0.05', 'Z_SS_SPATIAL_0.05'], 'segment': 'segment_SS_SPATIAL_0.05', 'Anisotropy': 'Anisotropy_(0.5)_SS_SPATIAL_0.05', 'Octree_normals': ['Nx_SS_SPATIAL_0.05', 'Ny_SS_SPATIAL_0.05', 'Nz_SS_SPATIAL_0.05'], 'PCA1': 'PCA1_(0.5)_SS_SPATIAL_0.05', 'PCA2': 'PCA2_(0.5)_SS_SPATIAL_0.05', 'Roughness': 'Roughness_(0.5)_SS_SPATIAL_0.05', 'Sphericity': 'Sphericity_(0.5)_SS_SPATIAL_0.05', 'Verticality': 'Verticality_(0.5)_SS_SPATIAL_0.05'}, ignore_index=-1, coord_only=False, num_points=8192, dropout=0.5, emb_dims=1024, k=20, batch_size=8, epoch=100, learning_rate=0.001, optimizer='Adam', decay_rate=0.0001, lr_scheduler='cosine', step_size=10, lr_decay=0.7, eval=2, save_model_freq=1, seed=1, visu='', visu_format='ply', train_val=False, jab=True, jab_out_channels=9, visualize=True, sync_bn=True)
863
+ Please check ZAHA num_points setting!
864
+ Loading pretrained model outputs/s3dis-latent-inject-r-0.5/models/model_99.pth
865
+ Loading data
866
+ The number of training data is: 245
867
+ Visualization enabled. Output directory: outputs/s3dis-latent-inject-r-0.5/visuals
868
+ ==== Evaluation Results ====
869
+ Mean loss: 0.7145
870
+ OA : 0.8266
871
+ μP : 0.6663
872
+ μIoU : 0.4827
873
+ μR : 0.5861
874
+ μF1 : 0.5937
875
+ ============================
876
+ ceiling | P: 0.9351 | R: 0.9646 | IoU: 0.9041 | F1: 0.9496
877
+ floor | P: 0.9857 | R: 0.9956 | IoU: 0.9814 | F1: 0.9906
878
+ wall | P: 0.8106 | R: 0.9318 | IoU: 0.7652 | F1: 0.8670
879
+ beam | P: 0.0028 | R: 0.0572 | IoU: 0.0027 | F1: 0.0053
880
+ column | P: 0.5625 | R: 0.3013 | IoU: 0.2441 | F1: 0.3924
881
+ window | P: 0.6722 | R: 0.1817 | IoU: 0.1669 | F1: 0.2861
882
+ door | P: 0.4760 | R: 0.7908 | IoU: 0.4228 | F1: 0.5943
883
+ table | P: 0.8628 | R: 0.8810 | IoU: 0.7728 | F1: 0.8718
884
+ chair | P: 0.6736 | R: 0.7175 | IoU: 0.5324 | F1: 0.6948
885
+ sofa | P: 0.6257 | R: 0.1436 | IoU: 0.1322 | F1: 0.2336
886
+ bookcase | P: 0.8736 | R: 0.6851 | IoU: 0.6233 | F1: 0.7680
887
+ board | P: 0.5347 | R: 0.4477 | IoU: 0.3222 | F1: 0.4873
888
+ clutter | P: 0.6469 | R: 0.5209 | IoU: 0.4056 | F1: 0.5771
889
+
890
+ Generating visualizations for 10 scenes...
891
+ Scene 1/10: sample_14 (12 points)
892
+ Saved visualizations for sample_14: outputs/s3dis-latent-inject-r-0.5/visuals/sample_14_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_14_pred.mp4
893
+ Scene 2/10: sample_24 (48 points)
894
+ Saved visualizations for sample_24: outputs/s3dis-latent-inject-r-0.5/visuals/sample_24_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_24_pred.mp4
895
+ Scene 3/10: sample_8 (12 points)
896
+ Saved visualizations for sample_8: outputs/s3dis-latent-inject-r-0.5/visuals/sample_8_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_8_pred.mp4
897
+ Scene 4/10: sample_19 (24 points)
898
+ Saved visualizations for sample_19: outputs/s3dis-latent-inject-r-0.5/visuals/sample_19_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_19_pred.mp4
899
+ Scene 5/10: sample_39 (12 points)
900
+ Saved visualizations for sample_39: outputs/s3dis-latent-inject-r-0.5/visuals/sample_39_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_39_pred.mp4
901
+ Scene 6/10: sample_53 (12 points)
902
+ Saved visualizations for sample_53: outputs/s3dis-latent-inject-r-0.5/visuals/sample_53_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_53_pred.mp4
903
+ Scene 7/10: sample_12 (12 points)
904
+ Saved visualizations for sample_12: outputs/s3dis-latent-inject-r-0.5/visuals/sample_12_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_12_pred.mp4
905
+ Scene 8/10: sample_5 (24 points)
906
+ Saved visualizations for sample_5: outputs/s3dis-latent-inject-r-0.5/visuals/sample_5_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_5_pred.mp4
907
+ Scene 9/10: sample_54 (12 points)
908
+ Saved visualizations for sample_54: outputs/s3dis-latent-inject-r-0.5/visuals/sample_54_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_54_pred.mp4
909
+ Scene 10/10: sample_41 (12 points)
910
+ Saved visualizations for sample_41: outputs/s3dis-latent-inject-r-0.5/visuals/sample_41_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_41_pred.mp4
911
+ Visualization complete! Files saved to: outputs/s3dis-latent-inject-r-0.5/visuals
912
+ Experiment on S3DIS dataset!
913
+ Namespace(exp_name='s3dis-latent-inject-r-0.5', data_root='../../data/gf_s3dis_ss_0.05', model_path='outputs/s3dis-latent-inject-r-0.5/models/model_99.pth', split='val', in_channels=12, num_classes=13, class_names=['ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door', 'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter'], feature_to_file_mapping={'coord': ['X_SS_SPATIAL_0.05', 'Y_SS_SPATIAL_0.05', 'Z_SS_SPATIAL_0.05'], 'segment': 'segment_SS_SPATIAL_0.05', 'Anisotropy': 'Anisotropy_(0.5)_SS_SPATIAL_0.05', 'Octree_normals': ['Nx_SS_SPATIAL_0.05', 'Ny_SS_SPATIAL_0.05', 'Nz_SS_SPATIAL_0.05'], 'PCA1': 'PCA1_(0.5)_SS_SPATIAL_0.05', 'PCA2': 'PCA2_(0.5)_SS_SPATIAL_0.05', 'Roughness': 'Roughness_(0.5)_SS_SPATIAL_0.05', 'Sphericity': 'Sphericity_(0.5)_SS_SPATIAL_0.05', 'Verticality': 'Verticality_(0.5)_SS_SPATIAL_0.05'}, ignore_index=-1, coord_only=False, num_points=8192, dropout=0.5, emb_dims=1024, k=20, batch_size=8, epoch=100, learning_rate=0.001, optimizer='Adam', decay_rate=0.0001, lr_scheduler='cosine', step_size=10, lr_decay=0.7, eval=2, save_model_freq=1, seed=1, visu='', visu_format='ply', train_val=False, jab=True, jab_out_channels=9, visualize=True, sync_bn=True)
914
+ Please check ZAHA num_points setting!
915
+ Loading pretrained model outputs/s3dis-latent-inject-r-0.5/models/model_99.pth
916
+ Loading data
917
+ The number of training data is: 245
918
+ Visualization enabled. Output directory: outputs/s3dis-latent-inject-r-0.5/visuals
919
+ ==== Evaluation Results ====
920
+ Mean loss: 0.7175
921
+ OA : 0.8260
922
+ μP : 0.6643
923
+ μIoU : 0.4823
924
+ μR : 0.5854
925
+ μF1 : 0.5927
926
+ ============================
927
+ ceiling | P: 0.9364 | R: 0.9652 | IoU: 0.9058 | F1: 0.9506
928
+ floor | P: 0.9857 | R: 0.9954 | IoU: 0.9813 | F1: 0.9905
929
+ wall | P: 0.8067 | R: 0.9301 | IoU: 0.7606 | F1: 0.8640
930
+ beam | P: 0.0028 | R: 0.0572 | IoU: 0.0027 | F1: 0.0053
931
+ column | P: 0.5595 | R: 0.3013 | IoU: 0.2435 | F1: 0.3916
932
+ window | P: 0.6720 | R: 0.1817 | IoU: 0.1669 | F1: 0.2861
933
+ door | P: 0.4774 | R: 0.7915 | IoU: 0.4241 | F1: 0.5956
934
+ table | P: 0.8652 | R: 0.8779 | IoU: 0.7723 | F1: 0.8715
935
+ chair | P: 0.6736 | R: 0.7175 | IoU: 0.5324 | F1: 0.6948
936
+ sofa | P: 0.5830 | R: 0.1268 | IoU: 0.1163 | F1: 0.2083
937
+ bookcase | P: 0.8736 | R: 0.6852 | IoU: 0.6234 | F1: 0.7680
938
+ board | P: 0.5530 | R: 0.4595 | IoU: 0.3350 | F1: 0.5019
939
+ clutter | P: 0.6470 | R: 0.5209 | IoU: 0.4056 | F1: 0.5771
940
+
941
+ Generating visualizations for 10 scenes...
942
+ Scene 1/10: sample_0 (12 points)
943
+ Saved visualizations for sample_0: outputs/s3dis-latent-inject-r-0.5/visuals/sample_0_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_0_pred.mp4
944
+ Scene 2/10: sample_1 (60 points)
945
+ Saved visualizations for sample_1: outputs/s3dis-latent-inject-r-0.5/visuals/sample_1_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_1_pred.mp4
946
+ Scene 3/10: sample_2 (48 points)
947
+ Saved visualizations for sample_2: outputs/s3dis-latent-inject-r-0.5/visuals/sample_2_pred.ply, outputs/s3dis-latent-inject-r-0.5/visuals/sample_2_pred.mp4
948
+ Scene 4/10: sample_3 (24 points)
949
+ Experiment on S3DIS dataset!
950
+ Namespace(exp_name='s3dis-latent-inject-r-0.5', data_root='../../data/gf_s3dis_ss_0.05', model_path='outputs/s3dis-latent-inject-r-0.5/models/model_99.pth', split='val', in_channels=12, num_classes=13, class_names=['ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door', 'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter'], feature_to_file_mapping={'coord': ['X_SS_SPATIAL_0.05', 'Y_SS_SPATIAL_0.05', 'Z_SS_SPATIAL_0.05'], 'segment': 'segment_SS_SPATIAL_0.05', 'Anisotropy': 'Anisotropy_(0.5)_SS_SPATIAL_0.05', 'Octree_normals': ['Nx_SS_SPATIAL_0.05', 'Ny_SS_SPATIAL_0.05', 'Nz_SS_SPATIAL_0.05'], 'PCA1': 'PCA1_(0.5)_SS_SPATIAL_0.05', 'PCA2': 'PCA2_(0.5)_SS_SPATIAL_0.05', 'Roughness': 'Roughness_(0.5)_SS_SPATIAL_0.05', 'Sphericity': 'Sphericity_(0.5)_SS_SPATIAL_0.05', 'Verticality': 'Verticality_(0.5)_SS_SPATIAL_0.05'}, ignore_index=-1, coord_only=False, num_points=8192, dropout=0.5, emb_dims=1024, k=20, batch_size=8, epoch=100, learning_rate=0.001, optimizer='Adam', decay_rate=0.0001, lr_scheduler='cosine', step_size=10, lr_decay=0.7, eval=2, save_model_freq=1, seed=1, visu='', visu_format='ply', train_val=False, jab=True, jab_out_channels=9, sync_bn=True)
951
+ Please check ZAHA num_points setting!
952
+ Loading pretrained model outputs/s3dis-latent-inject-r-0.5/models/model_99.pth
953
+ Loading data
954
+ The number of training data is: 245
955
+ ==== Evaluation Results ====
956
+ Mean loss: 0.7145
957
+ OA : 0.8266
958
+ μP : 0.6663
959
+ μIoU : 0.4827
960
+ μR : 0.5861
961
+ μF1 : 0.5937
962
+ ============================
963
+ ceiling | P: 0.9351 | R: 0.9646 | IoU: 0.9041 | F1: 0.9496
964
+ floor | P: 0.9857 | R: 0.9956 | IoU: 0.9814 | F1: 0.9906
965
+ wall | P: 0.8106 | R: 0.9318 | IoU: 0.7652 | F1: 0.8670
966
+ beam | P: 0.0028 | R: 0.0572 | IoU: 0.0027 | F1: 0.0053
967
+ column | P: 0.5625 | R: 0.3013 | IoU: 0.2441 | F1: 0.3924
968
+ window | P: 0.6722 | R: 0.1817 | IoU: 0.1669 | F1: 0.2861
969
+ door | P: 0.4760 | R: 0.7908 | IoU: 0.4228 | F1: 0.5943
970
+ table | P: 0.8628 | R: 0.8810 | IoU: 0.7728 | F1: 0.8718
971
+ chair | P: 0.6736 | R: 0.7175 | IoU: 0.5324 | F1: 0.6948
972
+ sofa | P: 0.6257 | R: 0.1436 | IoU: 0.1322 | F1: 0.2336
973
+ bookcase | P: 0.8736 | R: 0.6852 | IoU: 0.6234 | F1: 0.7680
974
+ board | P: 0.5347 | R: 0.4477 | IoU: 0.3222 | F1: 0.4873
975
+ clutter | P: 0.6470 | R: 0.5209 | IoU: 0.4056 | F1: 0.5771
976
+ Experiment on S3DIS dataset!
977
+ Namespace(exp_name='s3dis-latent-inject-r-0.5', data_root='../../data/gf_s3dis_ss_0.05', model_path='outputs/s3dis-latent-inject-r-0.5/models/model_99.pth', split='val', in_channels=12, num_classes=13, class_names=['ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door', 'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter'], feature_to_file_mapping={'coord': ['X_SS_SPATIAL_0.05', 'Y_SS_SPATIAL_0.05', 'Z_SS_SPATIAL_0.05'], 'segment': 'segment_SS_SPATIAL_0.05', 'Anisotropy': 'Anisotropy_(0.5)_SS_SPATIAL_0.05', 'Octree_normals': ['Nx_SS_SPATIAL_0.05', 'Ny_SS_SPATIAL_0.05', 'Nz_SS_SPATIAL_0.05'], 'PCA1': 'PCA1_(0.5)_SS_SPATIAL_0.05', 'PCA2': 'PCA2_(0.5)_SS_SPATIAL_0.05', 'Roughness': 'Roughness_(0.5)_SS_SPATIAL_0.05', 'Sphericity': 'Sphericity_(0.5)_SS_SPATIAL_0.05', 'Verticality': 'Verticality_(0.5)_SS_SPATIAL_0.05'}, ignore_index=-1, coord_only=False, num_points=8192, dropout=0.5, emb_dims=1024, k=20, batch_size=8, epoch=100, learning_rate=0.001, optimizer='Adam', decay_rate=0.0001, lr_scheduler='cosine', step_size=10, lr_decay=0.7, eval=2, save_model_freq=1, seed=1, visu='', visu_format='ply', train_val=False, jab=True, jab_out_channels=9, sync_bn=True)
978
+ Please check ZAHA num_points setting!
979
+ Loading pretrained model outputs/s3dis-latent-inject-r-0.5/models/model_99.pth
980
+ Loading data
981
+ The number of training data is: 245
982
+ Experiment on S3DIS dataset!
983
+ Namespace(exp_name='s3dis-latent-inject-r-0.5', data_root='../../data/gf_s3dis_ss_0.05', model_path='outputs/s3dis-latent-inject-r-0.5/models/model_99.pth', split='val', in_channels=12, num_classes=13, class_names=['ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door', 'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter'], feature_to_file_mapping={'coord': ['X_SS_SPATIAL_0.05', 'Y_SS_SPATIAL_0.05', 'Z_SS_SPATIAL_0.05'], 'segment': 'segment_SS_SPATIAL_0.05', 'Anisotropy': 'Anisotropy_(0.5)_SS_SPATIAL_0.05', 'Octree_normals': ['Nx_SS_SPATIAL_0.05', 'Ny_SS_SPATIAL_0.05', 'Nz_SS_SPATIAL_0.05'], 'PCA1': 'PCA1_(0.5)_SS_SPATIAL_0.05', 'PCA2': 'PCA2_(0.5)_SS_SPATIAL_0.05', 'Roughness': 'Roughness_(0.5)_SS_SPATIAL_0.05', 'Sphericity': 'Sphericity_(0.5)_SS_SPATIAL_0.05', 'Verticality': 'Verticality_(0.5)_SS_SPATIAL_0.05'}, ignore_index=-1, coord_only=False, num_points=8192, dropout=0.5, emb_dims=1024, k=20, batch_size=8, epoch=100, learning_rate=0.001, optimizer='Adam', decay_rate=0.0001, lr_scheduler='cosine', step_size=10, lr_decay=0.7, eval=2, save_model_freq=1, seed=1, visu='', visu_format='ply', train_val=False, jab=True, jab_out_channels=9, sync_bn=True)
984
+ Please check ZAHA num_points setting!
985
+ Loading pretrained model outputs/s3dis-latent-inject-r-0.5/models/model_99.pth
986
+ Loading data
987
+ Experiment on S3DIS dataset!
988
+ Namespace(exp_name='s3dis-latent-inject-r-0.5', data_root='../../data/gf_s3dis_ss_0.05', model_path='outputs/s3dis-latent-inject-r-0.5/models/model_99.pth', split='val', in_channels=12, num_classes=13, class_names=['ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door', 'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter'], feature_to_file_mapping={'coord': ['X_SS_SPATIAL_0.05', 'Y_SS_SPATIAL_0.05', 'Z_SS_SPATIAL_0.05'], 'segment': 'segment_SS_SPATIAL_0.05', 'Anisotropy': 'Anisotropy_(0.5)_SS_SPATIAL_0.05', 'Octree_normals': ['Nx_SS_SPATIAL_0.05', 'Ny_SS_SPATIAL_0.05', 'Nz_SS_SPATIAL_0.05'], 'PCA1': 'PCA1_(0.5)_SS_SPATIAL_0.05', 'PCA2': 'PCA2_(0.5)_SS_SPATIAL_0.05', 'Roughness': 'Roughness_(0.5)_SS_SPATIAL_0.05', 'Sphericity': 'Sphericity_(0.5)_SS_SPATIAL_0.05', 'Verticality': 'Verticality_(0.5)_SS_SPATIAL_0.05'}, ignore_index=-1, coord_only=False, num_points=8192, dropout=0.5, emb_dims=1024, k=20, batch_size=8, epoch=100, learning_rate=0.001, optimizer='Adam', decay_rate=0.0001, lr_scheduler='cosine', step_size=10, lr_decay=0.7, eval=2, save_model_freq=1, seed=1, visu='', visu_format='ply', train_val=False, jab=True, jab_out_channels=9, sync_bn=True)
989
+ Please check ZAHA num_points setting!
990
+ Loading pretrained model outputs/s3dis-latent-inject-r-0.5/models/model_99.pth
991
+ Loading data
992
+ Experiment on S3DIS dataset!
993
+ Namespace(exp_name='s3dis-latent-inject-r-0.5', data_root='../../data/gf_s3dis_ss_0.05', model_path='outputs/s3dis-latent-inject-r-0.5/models/model_99.pth', split='val', in_channels=12, num_classes=13, class_names=['ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door', 'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter'], feature_to_file_mapping={'coord': ['X_SS_SPATIAL_0.05', 'Y_SS_SPATIAL_0.05', 'Z_SS_SPATIAL_0.05'], 'segment': 'segment_SS_SPATIAL_0.05', 'Anisotropy': 'Anisotropy_(0.5)_SS_SPATIAL_0.05', 'Octree_normals': ['Nx_SS_SPATIAL_0.05', 'Ny_SS_SPATIAL_0.05', 'Nz_SS_SPATIAL_0.05'], 'PCA1': 'PCA1_(0.5)_SS_SPATIAL_0.05', 'PCA2': 'PCA2_(0.5)_SS_SPATIAL_0.05', 'Roughness': 'Roughness_(0.5)_SS_SPATIAL_0.05', 'Sphericity': 'Sphericity_(0.5)_SS_SPATIAL_0.05', 'Verticality': 'Verticality_(0.5)_SS_SPATIAL_0.05'}, ignore_index=-1, coord_only=False, num_points=8192, dropout=0.5, emb_dims=1024, k=20, batch_size=8, epoch=100, learning_rate=0.001, optimizer='Adam', decay_rate=0.0001, lr_scheduler='cosine', step_size=10, lr_decay=0.7, eval=2, save_model_freq=1, seed=1, visu='', visu_format='ply', train_val=False, jab=True, jab_out_channels=9, sync_bn=True)
994
+ Please check ZAHA num_points setting!
995
+ Loading pretrained model outputs/s3dis-latent-inject-r-0.5/models/model_99.pth
996
+ Loading data
997
+ The number of training data is: 68
998
+ Experiment on S3DIS dataset!
999
+ Namespace(exp_name='s3dis-latent-inject-r-0.5', data_root='../../data/gf_s3dis_ss_0.05', model_path='outputs/s3dis-latent-inject-r-0.5/models/model_99.pth', split='val', in_channels=12, num_classes=13, class_names=['ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door', 'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter'], feature_to_file_mapping={'coord': ['X_SS_SPATIAL_0.05', 'Y_SS_SPATIAL_0.05', 'Z_SS_SPATIAL_0.05'], 'segment': 'segment_SS_SPATIAL_0.05', 'Anisotropy': 'Anisotropy_(0.5)_SS_SPATIAL_0.05', 'Octree_normals': ['Nx_SS_SPATIAL_0.05', 'Ny_SS_SPATIAL_0.05', 'Nz_SS_SPATIAL_0.05'], 'PCA1': 'PCA1_(0.5)_SS_SPATIAL_0.05', 'PCA2': 'PCA2_(0.5)_SS_SPATIAL_0.05', 'Roughness': 'Roughness_(0.5)_SS_SPATIAL_0.05', 'Sphericity': 'Sphericity_(0.5)_SS_SPATIAL_0.05', 'Verticality': 'Verticality_(0.5)_SS_SPATIAL_0.05'}, ignore_index=-1, coord_only=False, num_points=8192, dropout=0.5, emb_dims=1024, k=20, batch_size=8, epoch=100, learning_rate=0.001, optimizer='Adam', decay_rate=0.0001, lr_scheduler='cosine', step_size=10, lr_decay=0.7, eval=2, save_model_freq=1, seed=1, visu='', visu_format='ply', train_val=False, jab=True, jab_out_channels=9, sync_bn=True)
1000
+ Please check ZAHA num_points setting!
1001
+ Loading pretrained model outputs/s3dis-latent-inject-r-0.5/models/model_99.pth
1002
+ Loading data
1003
+ The number of training data is: 280
1004
+ Experiment on S3DIS dataset!
1005
+ Namespace(exp_name='s3dis-latent-inject-r-0.5', data_root='../../data/gf_s3dis_ss_0.05', model_path='outputs/s3dis-latent-inject-r-0.5/models/model_99.pth', split='val', in_channels=12, num_classes=13, class_names=['ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door', 'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter'], feature_to_file_mapping={'coord': ['X_SS_SPATIAL_0.05', 'Y_SS_SPATIAL_0.05', 'Z_SS_SPATIAL_0.05'], 'segment': 'segment_SS_SPATIAL_0.05', 'Anisotropy': 'Anisotropy_(0.5)_SS_SPATIAL_0.05', 'Octree_normals': ['Nx_SS_SPATIAL_0.05', 'Ny_SS_SPATIAL_0.05', 'Nz_SS_SPATIAL_0.05'], 'PCA1': 'PCA1_(0.5)_SS_SPATIAL_0.05', 'PCA2': 'PCA2_(0.5)_SS_SPATIAL_0.05', 'Roughness': 'Roughness_(0.5)_SS_SPATIAL_0.05', 'Sphericity': 'Sphericity_(0.5)_SS_SPATIAL_0.05', 'Verticality': 'Verticality_(0.5)_SS_SPATIAL_0.05'}, ignore_index=-1, coord_only=False, num_points=8192, dropout=0.5, emb_dims=1024, k=20, batch_size=8, epoch=100, learning_rate=0.001, optimizer='Adam', decay_rate=0.0001, lr_scheduler='cosine', step_size=10, lr_decay=0.7, eval=2, save_model_freq=1, seed=1, visu='', visu_format='ply', train_val=False, jab=True, jab_out_channels=9, sync_bn=True)
1006
+ Please check ZAHA num_points setting!
1007
+ Loading pretrained model outputs/s3dis-latent-inject-r-0.5/models/model_99.pth
1008
+ Loading data
1009
+ The number of training data is: 280
1010
+ Experiment on S3DIS dataset!
1011
+ Namespace(exp_name='s3dis-latent-inject-r-0.5', data_root='../../data/gf_s3dis_ss_0.05', model_path='outputs/s3dis-latent-inject-r-0.5/models/model_99.pth', split='val', in_channels=12, num_classes=13, class_names=['ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door', 'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter'], feature_to_file_mapping={'coord': ['X_SS_SPATIAL_0.05', 'Y_SS_SPATIAL_0.05', 'Z_SS_SPATIAL_0.05'], 'segment': 'segment_SS_SPATIAL_0.05', 'Anisotropy': 'Anisotropy_(0.5)_SS_SPATIAL_0.05', 'Octree_normals': ['Nx_SS_SPATIAL_0.05', 'Ny_SS_SPATIAL_0.05', 'Nz_SS_SPATIAL_0.05'], 'PCA1': 'PCA1_(0.5)_SS_SPATIAL_0.05', 'PCA2': 'PCA2_(0.5)_SS_SPATIAL_0.05', 'Roughness': 'Roughness_(0.5)_SS_SPATIAL_0.05', 'Sphericity': 'Sphericity_(0.5)_SS_SPATIAL_0.05', 'Verticality': 'Verticality_(0.5)_SS_SPATIAL_0.05'}, ignore_index=-1, coord_only=False, num_points=8192, dropout=0.5, emb_dims=1024, k=20, batch_size=8, epoch=100, learning_rate=0.001, optimizer='Adam', decay_rate=0.0001, lr_scheduler='cosine', step_size=10, lr_decay=0.7, eval=2, save_model_freq=1, seed=1, visu='', visu_format='ply', train_val=False, jab=True, jab_out_channels=9, sync_bn=True)
1012
+ Please check ZAHA num_points setting!
1013
+ Loading pretrained model outputs/s3dis-latent-inject-r-0.5/models/model_99.pth
1014
+ Loading data
1015
+ The number of training data is: 280
1016
+ ==== Evaluation Results ====
1017
+ Mean loss: 0.7040
1018
+ OA : 0.6221
1019
+ μP : 0.5337
1020
+ μIoU : 0.4054
1021
+ μR : 0.5451
1022
+ μF1 : 0.5154
1023
+ ============================
1024
+ ceiling | P: 0.3978 | R: 0.9681 | IoU: 0.3927 | F1: 0.5639
1025
+ floor | P: 0.9879 | R: 0.9952 | IoU: 0.9832 | F1: 0.9915
1026
+ wall | P: 0.8084 | R: 0.8543 | IoU: 0.7105 | F1: 0.8307
1027
+ beam | P: 0.0000 | R: 0.0000 | IoU: 0.0000 | F1: 0.0000
1028
+ column | P: 0.5004 | R: 0.2549 | IoU: 0.2032 | F1: 0.3377
1029
+ window | P: 0.0000 | R: 0.0000 | IoU: 0.0000 | F1: 0.0000
1030
+ door | P: 0.4379 | R: 0.8058 | IoU: 0.3961 | F1: 0.5674
1031
+ table | P: 0.8697 | R: 0.7983 | IoU: 0.7130 | F1: 0.8325
1032
+ chair | P: 0.6403 | R: 0.7280 | IoU: 0.5166 | F1: 0.6813
1033
+ sofa | P: 0.4287 | R: 0.2051 | IoU: 0.1611 | F1: 0.2774
1034
+ bookcase | P: 0.8390 | R: 0.7293 | IoU: 0.6397 | F1: 0.7803
1035
+ board | P: 0.4407 | R: 0.1879 | IoU: 0.1517 | F1: 0.2635
1036
+ clutter | P: 0.5879 | R: 0.5597 | IoU: 0.4020 | F1: 0.5734
1037
+ Experiment on S3DIS dataset!
1038
+ Namespace(exp_name='s3dis-latent-inject-r-0.5', data_root='../../data/gf_s3dis_ss_0.05', model_path='outputs/s3dis-latent-inject-r-0.5/models/model_99.pth', split='val', in_channels=12, num_classes=13, class_names=['ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door', 'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter'], feature_to_file_mapping={'coord': ['X_SS_SPATIAL_0.05', 'Y_SS_SPATIAL_0.05', 'Z_SS_SPATIAL_0.05'], 'segment': 'segment_SS_SPATIAL_0.05', 'Anisotropy': 'Anisotropy_(0.5)_SS_SPATIAL_0.05', 'Octree_normals': ['Nx_SS_SPATIAL_0.05', 'Ny_SS_SPATIAL_0.05', 'Nz_SS_SPATIAL_0.05'], 'PCA1': 'PCA1_(0.5)_SS_SPATIAL_0.05', 'PCA2': 'PCA2_(0.5)_SS_SPATIAL_0.05', 'Roughness': 'Roughness_(0.5)_SS_SPATIAL_0.05', 'Sphericity': 'Sphericity_(0.5)_SS_SPATIAL_0.05', 'Verticality': 'Verticality_(0.5)_SS_SPATIAL_0.05'}, ignore_index=-1, coord_only=False, num_points=8192, dropout=0.5, emb_dims=1024, k=20, batch_size=8, epoch=100, learning_rate=0.001, optimizer='Adam', decay_rate=0.0001, lr_scheduler='cosine', step_size=10, lr_decay=0.7, eval=2, save_model_freq=1, seed=1, visu='', visu_format='ply', train_val=False, jab=True, jab_out_channels=9, sync_bn=True)
1039
+ Please check ZAHA num_points setting!
1040
+ Loading pretrained model outputs/s3dis-latent-inject-r-0.5/models/model_99.pth
1041
+ Loading data
1042
+ The number of training data is: 280
1043
+ ==== Evaluation Results ====
1044
+ Mean loss: 0.7040
1045
+ OA : 0.8205
1046
+ μP : 0.5768
1047
+ μIoU : 0.4458
1048
+ μR : 0.5451
1049
+ μF1 : 0.5460
1050
+ ============================
1051
+ ceiling | P: 0.9372 | R: 0.9681 | IoU: 0.9092 | F1: 0.9524
1052
+ floor | P: 0.9879 | R: 0.9952 | IoU: 0.9832 | F1: 0.9915
1053
+ wall | P: 0.8084 | R: 0.8543 | IoU: 0.7105 | F1: 0.8307
1054
+ beam | P: 0.0000 | R: 0.0000 | IoU: 0.0000 | F1: 0.0000
1055
+ column | P: 0.5004 | R: 0.2549 | IoU: 0.2032 | F1: 0.3377
1056
+ window | P: 0.0000 | R: 0.0000 | IoU: 0.0000 | F1: 0.0000
1057
+ door | P: 0.4379 | R: 0.8058 | IoU: 0.3961 | F1: 0.5674
1058
+ table | P: 0.8697 | R: 0.7983 | IoU: 0.7130 | F1: 0.8325
1059
+ chair | P: 0.6403 | R: 0.7280 | IoU: 0.5166 | F1: 0.6813
1060
+ sofa | P: 0.4287 | R: 0.2051 | IoU: 0.1611 | F1: 0.2774
1061
+ bookcase | P: 0.8390 | R: 0.7293 | IoU: 0.6397 | F1: 0.7803
1062
+ board | P: 0.4407 | R: 0.1879 | IoU: 0.1517 | F1: 0.2635
1063
+ clutter | P: 0.6081 | R: 0.5597 | IoU: 0.4113 | F1: 0.5829
1064
+ Experiment on S3DIS dataset!
1065
+ Namespace(exp_name='s3dis-latent-inject-r-0.5', data_root='../../data/gf_s3dis_ss_0.05', model_path='outputs/s3dis-latent-inject-r-0.5/models/model_99.pth', split='val', in_channels=12, num_classes=13, class_names=['ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door', 'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter'], feature_to_file_mapping={'coord': ['X_SS_SPATIAL_0.05', 'Y_SS_SPATIAL_0.05', 'Z_SS_SPATIAL_0.05'], 'segment': 'segment_SS_SPATIAL_0.05', 'Anisotropy': 'Anisotropy_(0.5)_SS_SPATIAL_0.05', 'Octree_normals': ['Nx_SS_SPATIAL_0.05', 'Ny_SS_SPATIAL_0.05', 'Nz_SS_SPATIAL_0.05'], 'PCA1': 'PCA1_(0.5)_SS_SPATIAL_0.05', 'PCA2': 'PCA2_(0.5)_SS_SPATIAL_0.05', 'Roughness': 'Roughness_(0.5)_SS_SPATIAL_0.05', 'Sphericity': 'Sphericity_(0.5)_SS_SPATIAL_0.05', 'Verticality': 'Verticality_(0.5)_SS_SPATIAL_0.05'}, ignore_index=-1, coord_only=False, num_points=8192, dropout=0.5, emb_dims=1024, k=20, batch_size=8, epoch=100, learning_rate=0.001, optimizer='Adam', decay_rate=0.0001, lr_scheduler='cosine', step_size=10, lr_decay=0.7, eval=2, save_model_freq=1, seed=1, visu='', visu_format='ply', train_val=False, jab=True, jab_out_channels=9, sync_bn=True)
1066
+ Please check ZAHA num_points setting!
1067
+ Loading pretrained model outputs/s3dis-latent-inject-r-0.5/models/model_99.pth
1068
+ Loading data
1069
+ The number of training data is: 280
1070
+ Saved visualization for scene: Area_5-office_18
1071
+ Saved visualization for scene: Area_5-office_30
1072
+ Saved visualization for scene: Area_5-office_7
1073
+ Saved visualization for scene: Area_5-office_15
1074
+ Saved visualization for scene: Area_5-storage_1
1075
+ Saved visualization for scene: Area_5-hallway_3
1076
+ Saved visualization for scene: Area_5-office_25
1077
+ Saved visualization for scene: Area_5-lobby_1
1078
+ Saved visualization for scene: Area_5-office_31
1079
+ Saved visualization for scene: Area_5-conferenceRoom_3
1080
+ Saved visualization for scene: Area_5-conferenceRoom_2
1081
+ Saved visualization for scene: Area_5-office_37
1082
+ Saved visualization for scene: Area_5-office_22
1083
+ Saved visualization for scene: Area_5-hallway_4
1084
+ Saved visualization for scene: Area_5-office_40
1085
+ Saved visualization for scene: Area_5-hallway_15
1086
+ Saved visualization for scene: Area_5-office_32
1087
+ Saved visualization for scene: Area_5-hallway_13
1088
+ Saved visualization for scene: Area_5-office_38
1089
+ Saved visualization for scene: Area_5-conferenceRoom_1
1090
+ Saved visualization for scene: Area_5-office_21
1091
+ Saved visualization for scene: Area_5-WC_1
1092
+ Saved visualization for scene: Area_5-office_24
1093
+ Saved visualization for scene: Area_5-office_4
1094
+ Saved visualization for scene: Area_5-office_27
1095
+ Saved visualization for scene: Area_5-hallway_7
1096
+ Saved visualization for scene: Area_5-office_41
1097
+ Saved visualization for scene: Area_5-storage_2
1098
+ Saved visualization for scene: Area_5-office_1
1099
+ Saved visualization for scene: Area_5-hallway_1
1100
+ Saved visualization for scene: Area_5-hallway_10
1101
+ Saved visualization for scene: Area_5-hallway_8
1102
+ Saved visualization for scene: Area_5-hallway_2
1103
+ Saved visualization for scene: Area_5-hallway_5
1104
+ ==== Evaluation Results ====
1105
+ Mean loss: 0.7042
1106
+ OA : 0.8205
1107
+ μP : 0.5768
1108
+ μIoU : 0.4458
1109
+ μR : 0.5451
1110
+ μF1 : 0.5459
1111
+ ============================
1112
+ ceiling | P: 0.9372 | R: 0.9681 | IoU: 0.9092 | F1: 0.9524
1113
+ floor | P: 0.9879 | R: 0.9952 | IoU: 0.9832 | F1: 0.9915
1114
+ wall | P: 0.8084 | R: 0.8543 | IoU: 0.7105 | F1: 0.8307
1115
+ beam | P: 0.0000 | R: 0.0000 | IoU: 0.0000 | F1: 0.0000
1116
+ column | P: 0.5004 | R: 0.2542 | IoU: 0.2027 | F1: 0.3371
1117
+ window | P: 0.0000 | R: 0.0000 | IoU: 0.0000 | F1: 0.0000
1118
+ door | P: 0.4377 | R: 0.8058 | IoU: 0.3959 | F1: 0.5672
1119
+ table | P: 0.8698 | R: 0.7981 | IoU: 0.7129 | F1: 0.8324
1120
+ chair | P: 0.6402 | R: 0.7279 | IoU: 0.5166 | F1: 0.6813
1121
+ sofa | P: 0.4285 | R: 0.2049 | IoU: 0.1609 | F1: 0.2772
1122
+ bookcase | P: 0.8390 | R: 0.7293 | IoU: 0.6397 | F1: 0.7803
1123
+ board | P: 0.4410 | R: 0.1881 | IoU: 0.1519 | F1: 0.2637
1124
+ clutter | P: 0.6081 | R: 0.5598 | IoU: 0.4114 | F1: 0.5830
1125
+ Experiment on S3DIS dataset!
1126
+ Namespace(exp_name='s3dis-latent-inject-r-0.5', data_root='../../data/gf_s3dis_ss_0.05', model_path='outputs/s3dis-latent-inject-r-0.5/models/model_99.pth', split='val', in_channels=12, num_classes=13, class_names=['ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door', 'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter'], feature_to_file_mapping={'coord': ['X_SS_SPATIAL_0.05', 'Y_SS_SPATIAL_0.05', 'Z_SS_SPATIAL_0.05'], 'segment': 'segment_SS_SPATIAL_0.05', 'Anisotropy': 'Anisotropy_(0.5)_SS_SPATIAL_0.05', 'Octree_normals': ['Nx_SS_SPATIAL_0.05', 'Ny_SS_SPATIAL_0.05', 'Nz_SS_SPATIAL_0.05'], 'PCA1': 'PCA1_(0.5)_SS_SPATIAL_0.05', 'PCA2': 'PCA2_(0.5)_SS_SPATIAL_0.05', 'Roughness': 'Roughness_(0.5)_SS_SPATIAL_0.05', 'Sphericity': 'Sphericity_(0.5)_SS_SPATIAL_0.05', 'Verticality': 'Verticality_(0.5)_SS_SPATIAL_0.05'}, ignore_index=-1, coord_only=False, num_points=8192, dropout=0.5, emb_dims=1024, k=20, batch_size=8, epoch=100, learning_rate=0.001, optimizer='Adam', decay_rate=0.0001, lr_scheduler='cosine', step_size=10, lr_decay=0.7, eval=2, save_model_freq=1, seed=1, visu='', visu_format='ply', train_val=False, jab=True, jab_out_channels=9, sync_bn=True)
1127
+ Please check ZAHA num_points setting!
1128
+ Loading pretrained model outputs/s3dis-latent-inject-r-0.5/models/model_99.pth
1129
+ Loading data
1130
+ The number of training data is: 280
1131
+ Saved visualization for scene: Area_5-office_18
1132
+ Saved visualization for scene: Area_5-office_30
1133
+ Saved visualization for scene: Area_5-office_7
1134
+ Saved visualization for scene: Area_5-office_15
1135
+ Saved visualization for scene: Area_5-storage_1
1136
+ Saved visualization for scene: Area_5-hallway_3
1137
+ Saved visualization for scene: Area_5-office_25
1138
+ Saved visualization for scene: Area_5-lobby_1
1139
+ Saved visualization for scene: Area_5-office_31
1140
+ Saved visualization for scene: Area_5-conferenceRoom_3
1141
+ Saved visualization for scene: Area_5-conferenceRoom_2
1142
+ Saved visualization for scene: Area_5-office_37
1143
+ Saved visualization for scene: Area_5-office_22
1144
+ Saved visualization for scene: Area_5-hallway_4
1145
+ Saved visualization for scene: Area_5-office_40
1146
+ Saved visualization for scene: Area_5-hallway_15
1147
+ Saved visualization for scene: Area_5-office_32
1148
+ Saved visualization for scene: Area_5-hallway_13
1149
+ Saved visualization for scene: Area_5-office_38
1150
+ Saved visualization for scene: Area_5-conferenceRoom_1
1151
+ Saved visualization for scene: Area_5-office_21
1152
+ Saved visualization for scene: Area_5-WC_1
1153
+ Saved visualization for scene: Area_5-office_24
1154
+ Saved visualization for scene: Area_5-office_4
1155
+ Saved visualization for scene: Area_5-office_27
1156
+ Saved visualization for scene: Area_5-hallway_7
1157
+ Saved visualization for scene: Area_5-office_41
1158
+ Saved visualization for scene: Area_5-storage_2
1159
+ Saved visualization for scene: Area_5-office_1
1160
+ Saved visualization for scene: Area_5-hallway_1
1161
+ Saved visualization for scene: Area_5-hallway_10
1162
+ Saved visualization for scene: Area_5-hallway_8
1163
+ Saved visualization for scene: Area_5-hallway_2
1164
+ Saved visualization for scene: Area_5-hallway_5
1165
+ ==== Evaluation Results ====
1166
+ Mean loss: 0.7041
1167
+ OA : 0.8205
1168
+ μP : 0.5768
1169
+ μIoU : 0.4458
1170
+ μR : 0.5451
1171
+ μF1 : 0.5460
1172
+ ============================
1173
+ ceiling | P: 0.9372 | R: 0.9681 | IoU: 0.9092 | F1: 0.9524
1174
+ floor | P: 0.9879 | R: 0.9952 | IoU: 0.9832 | F1: 0.9915
1175
+ wall | P: 0.8084 | R: 0.8543 | IoU: 0.7105 | F1: 0.8307
1176
+ beam | P: 0.0000 | R: 0.0000 | IoU: 0.0000 | F1: 0.0000
1177
+ column | P: 0.5004 | R: 0.2549 | IoU: 0.2032 | F1: 0.3378
1178
+ window | P: 0.0000 | R: 0.0000 | IoU: 0.0000 | F1: 0.0000
1179
+ door | P: 0.4378 | R: 0.8057 | IoU: 0.3960 | F1: 0.5674
1180
+ table | P: 0.8697 | R: 0.7983 | IoU: 0.7130 | F1: 0.8325
1181
+ chair | P: 0.6402 | R: 0.7280 | IoU: 0.5166 | F1: 0.6813
1182
+ sofa | P: 0.4287 | R: 0.2051 | IoU: 0.1611 | F1: 0.2774
1183
+ bookcase | P: 0.8390 | R: 0.7292 | IoU: 0.6397 | F1: 0.7803
1184
+ board | P: 0.4407 | R: 0.1879 | IoU: 0.1517 | F1: 0.2635
1185
+ clutter | P: 0.6081 | R: 0.5597 | IoU: 0.4114 | F1: 0.5829
1186
+ Experiment on S3DIS dataset!
1187
+ Namespace(exp_name='s3dis-latent-inject-r-0.5', data_root='../../data/gf_s3dis_ss_0.05', model_path='outputs/s3dis-latent-inject-r-0.5/models/model_99.pth', split='val', in_channels=12, num_classes=13, class_names=['ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door', 'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter'], feature_to_file_mapping={'coord': ['X_SS_SPATIAL_0.05', 'Y_SS_SPATIAL_0.05', 'Z_SS_SPATIAL_0.05'], 'segment': 'segment_SS_SPATIAL_0.05', 'Anisotropy': 'Anisotropy_(0.5)_SS_SPATIAL_0.05', 'Octree_normals': ['Nx_SS_SPATIAL_0.05', 'Ny_SS_SPATIAL_0.05', 'Nz_SS_SPATIAL_0.05'], 'PCA1': 'PCA1_(0.5)_SS_SPATIAL_0.05', 'PCA2': 'PCA2_(0.5)_SS_SPATIAL_0.05', 'Roughness': 'Roughness_(0.5)_SS_SPATIAL_0.05', 'Sphericity': 'Sphericity_(0.5)_SS_SPATIAL_0.05', 'Verticality': 'Verticality_(0.5)_SS_SPATIAL_0.05'}, ignore_index=-1, coord_only=False, num_points=8192, dropout=0.5, emb_dims=1024, k=20, batch_size=8, epoch=100, learning_rate=0.001, optimizer='Adam', decay_rate=0.0001, lr_scheduler='cosine', step_size=10, lr_decay=0.7, eval=2, save_model_freq=1, seed=1, visu='', visu_format='ply', train_val=False, jab=True, jab_out_channels=9, sync_bn=True)
1188
+ Please check ZAHA num_points setting!
1189
+ Loading pretrained model outputs/s3dis-latent-inject-r-0.5/models/model_99.pth
1190
+ Loading data
1191
+ The number of training data is: 280
1192
+ Saved visualization for scene: Area_5-office_18
1193
+ Saved visualization for scene: Area_5-office_6
1194
+ Saved visualization for scene: Area_5-office_30
1195
+ Saved visualization for scene: Area_5-office_19
1196
+ Saved visualization for scene: Area_5-office_7
1197
+ Saved visualization for scene: Area_5-office_36
1198
+ Saved visualization for scene: Area_5-office_15
1199
+ Saved visualization for scene: Area_5-office_23
1200
+ Saved visualization for scene: Area_5-storage_1
1201
+ Saved visualization for scene: Area_5-office_20
1202
+ Saved visualization for scene: Area_5-office_5
1203
+ Saved visualization for scene: Area_5-hallway_3
1204
+ Saved visualization for scene: Area_5-office_39
1205
+ Saved visualization for scene: Area_5-office_25
1206
+ Saved visualization for scene: Area_5-storage_4
1207
+ Saved visualization for scene: Area_5-pantry_1
1208
+ Saved visualization for scene: Area_5-lobby_1
1209
+ Saved visualization for scene: Area_5-hallway_6
1210
+ Saved visualization for scene: Area_5-office_31
1211
+ Saved visualization for scene: Area_5-office_29
1212
+ Saved visualization for scene: Area_5-conferenceRoom_3
1213
+ Saved visualization for scene: Area_5-office_17
1214
+ Saved visualization for scene: Area_5-conferenceRoom_2
1215
+ Saved visualization for scene: Area_5-office_37
1216
+ Saved visualization for scene: Area_5-office_22
1217
+ Saved visualization for scene: Area_5-office_12
1218
+ Saved visualization for scene: Area_5-hallway_4
1219
+ Saved visualization for scene: Area_5-office_8
1220
+ Saved visualization for scene: Area_5-office_40
1221
+ Saved visualization for scene: Area_5-office_34
1222
+ Saved visualization for scene: Area_5-hallway_15
1223
+ Saved visualization for scene: Area_5-WC_2
1224
+ Saved visualization for scene: Area_5-office_32
1225
+ Saved visualization for scene: Area_5-office_33
1226
+ Saved visualization for scene: Area_5-hallway_13
1227
+ Saved visualization for scene: Area_5-office_38
1228
+ Saved visualization for scene: Area_5-office_10
1229
+ Saved visualization for scene: Area_5-conferenceRoom_1
1230
+ Saved visualization for scene: Area_5-office_21
1231
+ Saved visualization for scene: Area_5-office_13
1232
+ Saved visualization for scene: Area_5-WC_1
1233
+ Saved visualization for scene: Area_5-office_14
1234
+ Saved visualization for scene: Area_5-office_24
1235
+ Saved visualization for scene: Area_5-office_9
1236
+ Saved visualization for scene: Area_5-office_4
1237
+ Saved visualization for scene: Area_5-hallway_11
1238
+ Saved visualization for scene: Area_5-office_3
1239
+ Saved visualization for scene: Area_5-office_27
1240
+ Saved visualization for scene: Area_5-hallway_9
1241
+ Saved visualization for scene: Area_5-hallway_7
1242
+ Saved visualization for scene: Area_5-office_35
1243
+ Saved visualization for scene: Area_5-office_41
1244
+ Saved visualization for scene: Area_5-office_2
1245
+ Saved visualization for scene: Area_5-office_16
1246
+ Saved visualization for scene: Area_5-storage_2
1247
+ Saved visualization for scene: Area_5-hallway_14
1248
+ Saved visualization for scene: Area_5-office_1
1249
+ Saved visualization for scene: Area_5-office_26
1250
+ Saved visualization for scene: Area_5-hallway_1
1251
+ Saved visualization for scene: Area_5-hallway_10
1252
+ Saved visualization for scene: Area_5-office_42
1253
+ Saved visualization for scene: Area_5-hallway_12
1254
+ Saved visualization for scene: Area_5-hallway_8
1255
+ Saved visualization for scene: Area_5-office_28
1256
+ Saved visualization for scene: Area_5-office_11
1257
+ Saved visualization for scene: Area_5-hallway_2
1258
+ Saved visualization for scene: Area_5-hallway_5
1259
+ ==== Evaluation Results ====
1260
+ Mean loss: 0.7041
1261
+ OA : 0.8205
1262
+ μP : 0.5766
1263
+ μIoU : 0.4457
1264
+ μR : 0.5451
1265
+ μF1 : 0.5459
1266
+ ============================
1267
+ ceiling | P: 0.9372 | R: 0.9681 | IoU: 0.9092 | F1: 0.9524
1268
+ floor | P: 0.9879 | R: 0.9952 | IoU: 0.9832 | F1: 0.9915
1269
+ wall | P: 0.8084 | R: 0.8543 | IoU: 0.7104 | F1: 0.8307
1270
+ beam | P: 0.0000 | R: 0.0000 | IoU: 0.0000 | F1: 0.0000
1271
+ column | P: 0.4994 | R: 0.2543 | IoU: 0.2026 | F1: 0.3370
1272
+ window | P: 0.0000 | R: 0.0000 | IoU: 0.0000 | F1: 0.0000
1273
+ door | P: 0.4378 | R: 0.8057 | IoU: 0.3960 | F1: 0.5674
1274
+ table | P: 0.8697 | R: 0.7980 | IoU: 0.7128 | F1: 0.8323
1275
+ chair | P: 0.6403 | R: 0.7280 | IoU: 0.5167 | F1: 0.6813
1276
+ sofa | P: 0.4271 | R: 0.2051 | IoU: 0.1608 | F1: 0.2771
1277
+ bookcase | P: 0.8390 | R: 0.7293 | IoU: 0.6398 | F1: 0.7803
1278
+ board | P: 0.4409 | R: 0.1881 | IoU: 0.1519 | F1: 0.2637
1279
+ clutter | P: 0.6081 | R: 0.5598 | IoU: 0.4114 | F1: 0.5829
s3dis-latent-inject-r-0.5/util.py.backup ADDED
@@ -0,0 +1,480 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import glob
3
+ import copy
4
+ import random
5
+ import pickle
6
+ import numpy as np
7
+ from plyfile import PlyData
8
+
9
+ import torch
10
+ from torch import nn
11
+ from torch.nn.modules.conv import _ConvNd
12
+ from torch.nn.modules.batchnorm import _BatchNorm
13
+ import torch.nn.init as initer
14
+ import torch.nn.functional as F
15
+
16
+
17
+ class AverageMeter(object):
18
+ """Computes and stores the average and current value"""
19
+
20
+ def __init__(self):
21
+ self.reset()
22
+
23
+ def reset(self):
24
+ self.val = 0
25
+ self.avg = 0
26
+ self.sum = 0
27
+ self.count = 0
28
+
29
+ def update(self, val, n=1):
30
+ self.val = val
31
+ self.sum += val * n
32
+ self.count += n
33
+ self.avg = self.sum / self.count
34
+
35
+
36
+ def set_seed(seed=1):
37
+ print('Using random seed', seed)
38
+ random.seed(seed)
39
+ np.random.seed(seed)
40
+ torch.manual_seed(seed)
41
+ torch.cuda.manual_seed_all(seed)
42
+
43
+
44
+ def str2bool(v):
45
+ return v.lower() in ("yes", "true", "t", "1")
46
+
47
+
48
+ def get_lr(optimizer):
49
+ return optimizer.param_groups[0]['lr']
50
+
51
+
52
+ def adjust_lr(optimizer, new_lr):
53
+ for param_group in optimizer.param_groups:
54
+ param_group['lr'] = new_lr
55
+
56
+
57
+ def weights_init(m):
58
+ classname = m.__class__.__name__
59
+ if classname.find('Conv2d') != -1:
60
+ nn.init.xavier_normal_(m.weight.data)
61
+ try:
62
+ nn.init.constant_(m.bias.data, 0.0)
63
+ except AttributeError:
64
+ pass
65
+ elif classname.find('Linear') != -1:
66
+ nn.init.xavier_normal_(m.weight.data)
67
+ try:
68
+ nn.init.constant_(m.bias.data, 0.0)
69
+ except AttributeError:
70
+ pass
71
+
72
+
73
+ def bn_momentum_adjust(m, momentum):
74
+ if isinstance(m, nn.BatchNorm2d) or \
75
+ isinstance(m, nn.BatchNorm1d):
76
+ m.momentum = momentum
77
+
78
+
79
+ def intersectionAndUnion(output, target, K, ignore_index=255):
80
+ # 'K' classes, output and target sizes are N or N * L or N * H * W, each value in range 0 to K - 1.
81
+ assert (output.ndim in [1, 2, 3])
82
+ assert output.shape == target.shape
83
+ output = output.reshape(output.size).copy()
84
+ target = target.reshape(target.size)
85
+ output[np.where(target == ignore_index)[0]] = 255
86
+ target[np.where(target == ignore_index)[0]] = 255
87
+ intersection = output[np.where(output == target)[0]]
88
+ area_intersection, _ = np.histogram(intersection, bins=np.arange(K+1))
89
+ area_output, _ = np.histogram(output, bins=np.arange(K+1))
90
+ area_target, _ = np.histogram(target, bins=np.arange(K+1))
91
+ area_union = area_output + area_target - area_intersection
92
+ return area_intersection, area_union, area_target
93
+
94
+
95
+ def calc_victim_value(class_value, label, victim_class):
96
+ values = []
97
+ for lbl in victim_class:
98
+ if label is None or (label == lbl).any():
99
+ values.append(class_value[lbl])
100
+ return np.mean(values)
101
+
102
+
103
+ def check_makedirs(dir_name):
104
+ if not os.path.exists(dir_name):
105
+ os.makedirs(dir_name)
106
+
107
+
108
+ def init_weights(model, conv='kaiming', batchnorm='normal', linear='kaiming', lstm='kaiming'):
109
+ """
110
+ :param model: Pytorch Model which is nn.Module
111
+ :param conv: 'kaiming' or 'xavier'
112
+ :param batchnorm: 'normal' or 'constant'
113
+ :param linear: 'kaiming' or 'xavier'
114
+ :param lstm: 'kaiming' or 'xavier'
115
+ """
116
+ for m in model.modules():
117
+ if isinstance(m, (_ConvNd)):
118
+ if conv == 'kaiming':
119
+ initer.kaiming_normal_(m.weight)
120
+ elif conv == 'xavier':
121
+ initer.xavier_normal_(m.weight)
122
+ else:
123
+ raise ValueError("init type of conv error.\n")
124
+ if m.bias is not None:
125
+ initer.constant_(m.bias, 0)
126
+
127
+ elif isinstance(m, _BatchNorm):
128
+ if batchnorm == 'normal':
129
+ initer.normal_(m.weight, 1.0, 0.02)
130
+ elif batchnorm == 'constant':
131
+ initer.constant_(m.weight, 1.0)
132
+ else:
133
+ raise ValueError("init type of batchnorm error.\n")
134
+ initer.constant_(m.bias, 0.0)
135
+
136
+ elif isinstance(m, nn.Linear):
137
+ if linear == 'kaiming':
138
+ initer.kaiming_normal_(m.weight)
139
+ elif linear == 'xavier':
140
+ initer.xavier_normal_(m.weight)
141
+ else:
142
+ raise ValueError("init type of linear error.\n")
143
+ if m.bias is not None:
144
+ initer.constant_(m.bias, 0)
145
+
146
+ elif isinstance(m, nn.LSTM):
147
+ for name, param in m.named_parameters():
148
+ if 'weight' in name:
149
+ if lstm == 'kaiming':
150
+ initer.kaiming_normal_(param)
151
+ elif lstm == 'xavier':
152
+ initer.xavier_normal_(param)
153
+ else:
154
+ raise ValueError("init type of lstm error.\n")
155
+ elif 'bias' in name:
156
+ initer.constant_(param, 0)
157
+
158
+
159
+ def convert_to_syncbn(model):
160
+ def recursive_set(cur_module, name, module):
161
+ if len(name.split('.')) > 1:
162
+ recursive_set(
163
+ getattr(cur_module, name[:name.find('.')]), name[name.find('.')+1:], module)
164
+ else:
165
+ setattr(cur_module, name, module)
166
+ from sync_bn import SynchronizedBatchNorm1d, SynchronizedBatchNorm2d, \
167
+ SynchronizedBatchNorm3d
168
+ for name, m in model.named_modules():
169
+ if isinstance(m, nn.BatchNorm1d):
170
+ recursive_set(model, name, SynchronizedBatchNorm1d(
171
+ m.num_features, m.eps, m.momentum, m.affine))
172
+ elif isinstance(m, nn.BatchNorm2d):
173
+ recursive_set(model, name, SynchronizedBatchNorm2d(
174
+ m.num_features, m.eps, m.momentum, m.affine))
175
+ elif isinstance(m, nn.BatchNorm3d):
176
+ recursive_set(model, name, SynchronizedBatchNorm3d(
177
+ m.num_features, m.eps, m.momentum, m.affine))
178
+
179
+
180
+ def lbl2rgb(label, names):
181
+ """Convert label to rgb colors.
182
+ label: [N]
183
+ """
184
+ from config import NAME2COLOR
185
+ if len(names) == 13:
186
+ colors = NAME2COLOR['S3DIS']
187
+ else:
188
+ colors = NAME2COLOR['ScanNet']
189
+ rgb = np.zeros((label.shape[0], 3))
190
+ uni_lbl = np.unique(label).astype(np.uint8)
191
+ for lbl in uni_lbl:
192
+ mask = (label == lbl)
193
+ rgb[mask] = np.tile(np.array(
194
+ colors[names[lbl]])[None, :], (mask.sum(), 1))
195
+ return rgb
196
+
197
+
198
+ def convert2vis(xyz, label, names):
199
+ """Assign color to each point according to label."""
200
+ rgb = lbl2rgb(label, names) * 255.
201
+ data = np.concatenate([xyz, rgb], axis=1)
202
+ return data
203
+
204
+
205
+ def proc_pert(points, gt, pred, folder,
206
+ names, part=False, ignore_label=255):
207
+ """Process and save files for visulization in perturbation attack."""
208
+ check_makedirs(folder)
209
+ lbl2cls = {i: names[i] for i in range(len(names))}
210
+
211
+ np.savetxt(os.path.join(folder, 'all_points.txt'), points, delimiter=';')
212
+ gt_seg = convert2vis(points[gt != ignore_label, :3],
213
+ gt[gt != ignore_label], names)
214
+ pred_seg = convert2vis(points[gt != ignore_label, :3],
215
+ pred[gt != ignore_label], names)
216
+ np.savetxt(os.path.join(folder, 'gt.txt'),
217
+ gt_seg, delimiter=';')
218
+ np.savetxt(os.path.join(folder, 'pred.txt'),
219
+ pred_seg, delimiter=';')
220
+ if part:
221
+ uni_lbl = np.unique(gt[gt != ignore_label]).astype(np.uint8)
222
+ for lbl in uni_lbl:
223
+ lbl = int(lbl)
224
+ mask = (gt == lbl)
225
+ sel_points = points[mask]
226
+ mask = (gt[gt != ignore_label] == lbl)
227
+ sel_seg = pred_seg[mask]
228
+ np.savetxt(
229
+ os.path.join(folder, '{}_{}_points.txt'.format(
230
+ lbl, lbl2cls[lbl])),
231
+ sel_points, delimiter=';')
232
+ np.savetxt(
233
+ os.path.join(folder, '{}_{}_pred.txt'.format(
234
+ lbl, lbl2cls[lbl])),
235
+ sel_seg, delimiter=';')
236
+
237
+
238
+ def proc_add(points, noise, gt, pred, noise_pred, folder,
239
+ names, part=False, ignore_label=255):
240
+ """Process and save files for visulization in adding attack."""
241
+ check_makedirs(folder)
242
+ lbl2cls = {i: names[i] for i in range(len(names))}
243
+
244
+ np.savetxt(os.path.join(folder, 'all_points.txt'), points, delimiter=';')
245
+ np.savetxt(os.path.join(folder, 'noise_points.txt'), noise, delimiter=';')
246
+ gt_seg = convert2vis(points[gt != ignore_label, :3],
247
+ gt[gt != ignore_label], names)
248
+ pred_seg = convert2vis(points[gt != ignore_label, :3],
249
+ pred[gt != ignore_label], names)
250
+ noise_seg = convert2vis(noise[:, :3], noise_pred, names)
251
+ np.savetxt(os.path.join(folder, 'gt.txt'),
252
+ gt_seg, delimiter=';')
253
+ np.savetxt(os.path.join(folder, 'pred.txt'),
254
+ pred_seg, delimiter=';')
255
+ np.savetxt(os.path.join(folder, 'noise_pred.txt'),
256
+ noise_seg, delimiter=';')
257
+ if part:
258
+ uni_lbl = np.unique(gt[gt != ignore_label]).astype(np.uint8)
259
+ for lbl in uni_lbl:
260
+ lbl = int(lbl)
261
+ mask = (gt == lbl)
262
+ sel_points = points[mask]
263
+ mask = (gt[gt != ignore_label] == lbl)
264
+ sel_seg = pred_seg[mask]
265
+ np.savetxt(
266
+ os.path.join(folder, '{}_{}_points.txt'.format(
267
+ lbl, lbl2cls[lbl])),
268
+ sel_points, delimiter=';')
269
+ np.savetxt(
270
+ os.path.join(folder, '{}_{}_pred.txt'.format(
271
+ lbl, lbl2cls[lbl])),
272
+ sel_seg, delimiter=';')
273
+
274
+
275
+ def save_vis(pred_root, save_root, data_root):
276
+ from config import CLASS_NAMES
277
+ if 'S3DIS' in data_root: # save Area5 data
278
+ names = CLASS_NAMES['S3DIS']['other']
279
+ gt_save = load_pickle(
280
+ os.path.join(pred_root, 'gt_5.pickle'))['gt']
281
+ pred_save = load_pickle(
282
+ os.path.join(pred_root, 'pred_5.pickle'))['pred']
283
+ assert len(gt_save) == len(pred_save)
284
+ all_rooms = sorted(os.listdir(data_root))
285
+ all_rooms = [
286
+ room for room in all_rooms if 'Area_5' in room
287
+ ]
288
+ assert len(gt_save) == len(all_rooms)
289
+ check_makedirs(save_root)
290
+ for i, room in enumerate(all_rooms):
291
+ points = np.load(os.path.join(data_root, room))[:, :6]
292
+ folder = os.path.join(save_root, room[:-4])
293
+ check_makedirs(folder)
294
+ proc_pert(points, gt_save[i], pred_save[i],
295
+ folder, names, part=True)
296
+ elif 'ScanNet' in data_root: # save val set data
297
+ names = CLASS_NAMES['ScanNet']['other']
298
+ gt_save = load_pickle(
299
+ os.path.join(pred_root, 'gt_val.pickle'))['gt']
300
+ pred_save = load_pickle(
301
+ os.path.join(pred_root, 'pred_val.pickle'))['pred']
302
+ assert len(gt_save) == len(pred_save)
303
+ data_file = os.path.join(
304
+ data_root, 'scannet_val_rgb21c_pointid.pickle')
305
+ file_pickle = open(data_file, 'rb')
306
+ xyz_all = pickle.load(file_pickle)
307
+ file_pickle.close()
308
+ assert len(xyz_all) == len(gt_save)
309
+ with open(os.path.join(
310
+ data_root, 'meta_data/scannetv2_val.txt')) as fl:
311
+ scene_id = fl.read().splitlines()
312
+ assert len(scene_id) == len(gt_save)
313
+ check_makedirs(save_root)
314
+ for i in range(len(gt_save)):
315
+ points = xyz_all[i][:, :6]
316
+ folder = os.path.join(save_root, scene_id[i])
317
+ check_makedirs(folder)
318
+ proc_pert(points, gt_save[i], pred_save[i],
319
+ folder, names, part=True)
320
+
321
+
322
+ def save_vis_mink(pred_root, save_root, data_root):
323
+ from config import CLASS_NAMES
324
+
325
+ def load_data(file_name):
326
+ plydata = PlyData.read(file_name)
327
+ data = plydata.elements[0].data
328
+ coords = np.array([data['x'], data['y'], data['z']],
329
+ dtype=np.float32).T
330
+ colors = np.array([data['red'], data['green'],
331
+ data['blue']], dtype=np.float32).T
332
+ return np.concatenate([coords, colors], axis=1)
333
+
334
+ if 'S3DIS' in data_root: # save Area5 data
335
+ names = CLASS_NAMES['S3DIS']['mink']
336
+ gt_save = load_pickle(
337
+ os.path.join(pred_root, 'gt_5.pickle'))['gt']
338
+ pred_save = load_pickle(
339
+ os.path.join(pred_root, 'pred_5.pickle'))['pred']
340
+ assert len(gt_save) == len(pred_save)
341
+ data_root = os.path.join(data_root, 'Area_5')
342
+ all_rooms = sorted(os.listdir(data_root))
343
+ assert len(all_rooms) == len(gt_save)
344
+ check_makedirs(save_root)
345
+
346
+ for i, room in enumerate(all_rooms):
347
+ data = os.path.join(data_root, room)
348
+ points = load_data(data)
349
+ folder = os.path.join(
350
+ save_root, 'Area_5_{}'.format(room[:-4]))
351
+ check_makedirs(folder)
352
+ proc_pert(points, gt_save[i], pred_save[i],
353
+ folder, names, part=True)
354
+ elif 'ScanNet' in data_root: # save val set
355
+ names = CLASS_NAMES['ScanNet']['mink']
356
+ gt_save = load_pickle(
357
+ os.path.join(pred_root, 'gt_val.pickle'))['gt']
358
+ pred_save = load_pickle(
359
+ os.path.join(pred_root, 'pred_val.pickle'))['pred']
360
+ assert len(gt_save) == len(pred_save)
361
+ data_root = os.path.join(data_root, 'train')
362
+ with open(os.path.join(
363
+ data_root, 'scannetv2_val.txt'), 'r') as f:
364
+ all_rooms = f.readlines()
365
+ all_rooms = [room[:-1] for room in all_rooms]
366
+ assert len(all_rooms) == len(gt_save)
367
+ check_makedirs(save_root)
368
+
369
+ for i, room in enumerate(all_rooms):
370
+ data = os.path.join(data_root, room)
371
+ points = load_data(data)
372
+ folder = os.path.join(save_root, room[:-4])
373
+ check_makedirs(folder)
374
+ proc_pert(points, gt_save[i], pred_save[i],
375
+ folder, names, part=True)
376
+
377
+
378
+ def save_vis_from_pickle(pkl_root, save_root=None, room_idx=52,
379
+ room_name='scene0354_00'):
380
+ names = [
381
+ 'wall', 'floor', 'cabinet', 'bed', 'chair', 'sofa', 'table',
382
+ 'door', 'window', 'bookshelf', 'picture', 'counter', 'desk',
383
+ 'curtain', 'refrigerator', 'showercurtain', 'toilet', 'sink',
384
+ 'bathtub', 'otherfurniture'
385
+ ]
386
+ data = load_pickle(pkl_root)
387
+ points = data['data'][room_idx]
388
+ pred = data['pred'][room_idx]
389
+ gt = data['gt'][room_idx]
390
+ if save_root is None:
391
+ save_root = os.path.dirname(pkl_root)
392
+ save_folder = os.path.join(save_root, room_name)
393
+ proc_pert(points, gt, pred, save_folder, names, part=True)
394
+
395
+
396
+ def save_pickle(filename, dict_data):
397
+ with open(filename, 'wb') as handle:
398
+ pickle.dump(dict_data, handle,
399
+ protocol=pickle.HIGHEST_PROTOCOL)
400
+
401
+
402
+ def load_pickle(filename):
403
+ with open(filename, 'rb') as f:
404
+ data = pickle.load(f)
405
+ return data
406
+
407
+
408
+ def load_s3dis_instance(folder, name2cls, load_name=['chair']):
409
+ """Load S3DIS room in a Inst Seg format.
410
+ Get each instance separately.
411
+
412
+ If load_name is None or [], return all instances.
413
+ Returns a list of [np.array of [N, 6], label]
414
+ """
415
+ cls2name = {name2cls[name]: name for name in name2cls.keys()}
416
+ anno_path = os.path.join(folder, 'Annotations')
417
+ points_list = []
418
+ labels_list = []
419
+ idx = 0
420
+ files = glob.glob(os.path.join(anno_path, '*.txt'))
421
+ files.sort()
422
+
423
+ for f in files:
424
+ cls = os.path.basename(f).split('_')[0]
425
+ if cls not in name2cls.keys():
426
+ cls = 'clutter'
427
+ points = np.loadtxt(f) # [N, 6]
428
+ num = points.shape[0]
429
+ points_list.append(points)
430
+ labels_list.append((idx, idx + num, name2cls[cls]))
431
+ idx += num
432
+
433
+ # normalize points coords by minus min
434
+ data = np.concatenate(points_list, 0)
435
+ xyz_min = np.amin(data, axis=0)[0:3]
436
+ data[:, 0:3] -= xyz_min
437
+
438
+ # rearrange to separate instances
439
+ if load_name is None or not load_name:
440
+ load_name = list(name2cls.keys())
441
+ instances = [
442
+ [data[pair[0]:pair[1]], pair[2]] for pair in labels_list if
443
+ cls2name[pair[2]] in load_name
444
+ ]
445
+ return instances
446
+
447
+
448
+ def cal_loss(pred, gold, smoothing=False, ignore_index=255):
449
+ ''' Calculate cross entropy loss, apply label smoothing if needed. '''
450
+
451
+ gold = gold.contiguous().view(-1)
452
+
453
+ if smoothing:
454
+ eps = 0.2
455
+ n_class = pred.size(1)
456
+
457
+ one_hot = torch.zeros_like(pred).scatter(1, gold.view(-1, 1), 1)
458
+ one_hot = one_hot * (1 - eps) + (1 - one_hot) * eps / (n_class - 1)
459
+ log_prb = F.log_softmax(pred, dim=1)
460
+
461
+ loss = -(one_hot * log_prb).sum(dim=1).mean()
462
+ else:
463
+ loss = F.cross_entropy(
464
+ pred, gold, reduction='mean',
465
+ ignore_index=ignore_index)
466
+
467
+ return loss
468
+
469
+
470
+ class IOStream():
471
+ def __init__(self, path):
472
+ self.f = open(path, 'a')
473
+
474
+ def cprint(self, text):
475
+ print(text)
476
+ self.f.write(text+'\n')
477
+ self.f.flush()
478
+
479
+ def close(self):
480
+ self.f.close()