From 139c6f0c7175d7f20bd0632678e52066daa5a246 Mon Sep 17 00:00:00 2001 From: Xiangxu-0103 Date: Tue, 29 Nov 2022 20:44:42 +0800 Subject: [PATCH] [Refactor] Refactor configs of dgcnn for different areas (#1967) * refactor configs of dgcnn * update * Update metafile.yml * Refactor dgcnn * Minor fixes in docstring Co-authored-by: Tai-Wang --- configs/dgcnn/README.md | 18 ++--- ..._4xb32-cosine-100e_s3dis-seg_test-area1.py | 17 +++++ ..._4xb32-cosine-100e_s3dis-seg_test-area2.py | 17 +++++ ..._4xb32-cosine-100e_s3dis-seg_test-area3.py | 17 +++++ ..._4xb32-cosine-100e_s3dis-seg_test-area4.py | 17 +++++ ...4xb32-cosine-100e_s3dis-seg_test-area5.py} | 0 ..._4xb32-cosine-100e_s3dis-seg_test-area6.py | 17 +++++ configs/dgcnn/metafile.yml | 71 ++++++++++++++++++- mmdet3d/models/decode_heads/decode_head.py | 12 ++-- 9 files changed, 168 insertions(+), 18 deletions(-) create mode 100644 configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area1.py create mode 100644 configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area2.py create mode 100644 configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area3.py create mode 100644 configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area4.py rename configs/dgcnn/{dgcnn_4xb32-cosine-100e_s3dis-seg.py => dgcnn_4xb32-cosine-100e_s3dis-seg_test-area5.py} (100%) create mode 100644 configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area6.py diff --git a/configs/dgcnn/README.md b/configs/dgcnn/README.md index 2a90a2e7a7..46c243ad56 100644 --- a/configs/dgcnn/README.md +++ b/configs/dgcnn/README.md @@ -22,15 +22,15 @@ We implement DGCNN and provide the results and checkpoints on S3DIS dataset. ### S3DIS -| Method | Split | Lr schd | Mem (GB) | Inf time (fps) | mIoU (Val set) | Download | -| :---------------------------------------------: | :----: | :---------: | :------: | :------------: | :------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | -| [DGCNN](./dgcnn_4xb32-cosine-100e_s3dis-seg.py) | Area_1 | cosine 100e | 13.1 | | 68.33 | [model](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area1/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210731_000734-39658f14.pth) \| [log](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area1/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210731_000734.log.json) | -| [DGCNN](./dgcnn_4xb32-cosine-100e_s3dis-seg.py) | Area_2 | cosine 100e | 13.1 | | 40.68 | [model](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area2/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210731_144648-aea9ecb6.pth) \| [log](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area2/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210731_144648.log.json) | -| [DGCNN](./dgcnn_4xb32-cosine-100e_s3dis-seg.py) | Area_3 | cosine 100e | 13.1 | | 69.38 | [model](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area3/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210801_154629-2ff50ee0.pth) \| [log](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area3/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210801_154629.log.json) | -| [DGCNN](./dgcnn_4xb32-cosine-100e_s3dis-seg.py) | Area_4 | cosine 100e | 13.1 | | 50.07 | [model](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area4/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210802_073551-dffab9cd.pth) \| [log](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area4/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210802_073551.log.json) | -| [DGCNN](./dgcnn_4xb32-cosine-100e_s3dis-seg.py) | Area_5 | cosine 100e | 13.1 | | 50.59 | [model](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area5/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210730_235824-f277e0c5.pth) \| [log](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area5/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210730_235824.log.json) | -| [DGCNN](./dgcnn_4xb32-cosine-100e_s3dis-seg.py) | Area_6 | cosine 100e | 13.1 | | 77.94 | [model](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area6/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210802_154317-e3511b32.pth) \| [log](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area6/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210802_154317.log.json) | -| [DGCNN](./dgcnn_4xb32-cosine-100e_s3dis-seg.py) | 6-fold | | | | 59.43 | | +| Method | Split | Lr schd | Mem (GB) | Inf time (fps) | mIoU (Val set) | Download | +| :--------------------------------------------------------: | :----: | :---------: | :------: | :------------: | :------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | +| [DGCNN](./dgcnn_4xb32-cosine-100e_s3dis-seg_test-area1.py) | Area_1 | cosine 100e | 13.1 | | 68.33 | [model](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area1/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210731_000734-39658f14.pth) \| [log](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area1/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210731_000734.log.json) | +| [DGCNN](./dgcnn_4xb32-cosine-100e_s3dis-seg_test-area2.py) | Area_2 | cosine 100e | 13.1 | | 40.68 | [model](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area2/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210731_144648-aea9ecb6.pth) \| [log](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area2/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210731_144648.log.json) | +| [DGCNN](./dgcnn_4xb32-cosine-100e_s3dis-seg_test-area3.py) | Area_3 | cosine 100e | 13.1 | | 69.38 | [model](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area3/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210801_154629-2ff50ee0.pth) \| [log](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area3/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210801_154629.log.json) | +| [DGCNN](./dgcnn_4xb32-cosine-100e_s3dis-seg_test-area4.py) | Area_4 | cosine 100e | 13.1 | | 50.07 | [model](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area4/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210802_073551-dffab9cd.pth) \| [log](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area4/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210802_073551.log.json) | +| [DGCNN](./dgcnn_4xb32-cosine-100e_s3dis-seg_test-area5.py) | Area_5 | cosine 100e | 13.1 | | 50.59 | [model](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area5/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210730_235824-f277e0c5.pth) \| [log](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area5/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210730_235824.log.json) | +| [DGCNN](./dgcnn_4xb32-cosine-100e_s3dis-seg_test-area6.py) | Area_6 | cosine 100e | 13.1 | | 77.94 | [model](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area6/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210802_154317-e3511b32.pth) \| [log](https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area6/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210802_154317.log.json) | +| DGCNN | 6-fold | | | | 59.43 | | **Notes:** diff --git a/configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area1.py b/configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area1.py new file mode 100644 index 0000000000..e9b40af80f --- /dev/null +++ b/configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area1.py @@ -0,0 +1,17 @@ +_base_ = './dgcnn_4xb32-cosine-100e_s3dis-seg_test-area5.py' + +# data settings +train_area = [2, 3, 4, 5, 6] +test_area = 1 +train_dataloader = dict( + batch_size=32, + dataset=dict( + ann_files=[f's3dis_infos_Area_{i}.pkl' for i in train_area], + scene_idxs=[ + f'seg_info/Area_{i}_resampled_scene_idxs.npy' for i in train_area + ])) +test_dataloader = dict( + dataset=dict( + ann_files=f's3dis_infos_Area_{test_area}.pkl', + scene_idxs=f'seg_info/Area_{test_area}_resampled_scene_idxs.npy')) +val_dataloader = test_dataloader diff --git a/configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area2.py b/configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area2.py new file mode 100644 index 0000000000..c7a13665fe --- /dev/null +++ b/configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area2.py @@ -0,0 +1,17 @@ +_base_ = './dgcnn_4xb32-cosine-100e_s3dis-seg_test-area5.py' + +# data settings +train_area = [1, 3, 4, 5, 6] +test_area = 2 +train_dataloader = dict( + batch_size=32, + dataset=dict( + ann_files=[f's3dis_infos_Area_{i}.pkl' for i in train_area], + scene_idxs=[ + f'seg_info/Area_{i}_resampled_scene_idxs.npy' for i in train_area + ])) +test_dataloader = dict( + dataset=dict( + ann_files=f's3dis_infos_Area_{test_area}.pkl', + scene_idxs=f'seg_info/Area_{test_area}_resampled_scene_idxs.npy')) +val_dataloader = test_dataloader diff --git a/configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area3.py b/configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area3.py new file mode 100644 index 0000000000..56cbd98b70 --- /dev/null +++ b/configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area3.py @@ -0,0 +1,17 @@ +_base_ = './dgcnn_4xb32-cosine-100e_s3dis-seg_test-area5.py' + +# data settings +train_area = [1, 2, 4, 5, 6] +test_area = 3 +train_dataloader = dict( + batch_size=32, + dataset=dict( + ann_files=[f's3dis_infos_Area_{i}.pkl' for i in train_area], + scene_idxs=[ + f'seg_info/Area_{i}_resampled_scene_idxs.npy' for i in train_area + ])) +test_dataloader = dict( + dataset=dict( + ann_files=f's3dis_infos_Area_{test_area}.pkl', + scene_idxs=f'seg_info/Area_{test_area}_resampled_scene_idxs.npy')) +val_dataloader = test_dataloader diff --git a/configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area4.py b/configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area4.py new file mode 100644 index 0000000000..842f1e18f6 --- /dev/null +++ b/configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area4.py @@ -0,0 +1,17 @@ +_base_ = './dgcnn_4xb32-cosine-100e_s3dis-seg_test-area5.py' + +# data settings +train_area = [1, 2, 3, 5, 6] +test_area = 4 +train_dataloader = dict( + batch_size=32, + dataset=dict( + ann_files=[f's3dis_infos_Area_{i}.pkl' for i in train_area], + scene_idxs=[ + f'seg_info/Area_{i}_resampled_scene_idxs.npy' for i in train_area + ])) +test_dataloader = dict( + dataset=dict( + ann_files=f's3dis_infos_Area_{test_area}.pkl', + scene_idxs=f'seg_info/Area_{test_area}_resampled_scene_idxs.npy')) +val_dataloader = test_dataloader diff --git a/configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg.py b/configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area5.py similarity index 100% rename from configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg.py rename to configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area5.py diff --git a/configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area6.py b/configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area6.py new file mode 100644 index 0000000000..c4f50cd96c --- /dev/null +++ b/configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area6.py @@ -0,0 +1,17 @@ +_base_ = './dgcnn_4xb32-cosine-100e_s3dis-seg_test-area5.py' + +# data settings +train_area = [1, 2, 3, 4, 5] +test_area = 6 +train_dataloader = dict( + batch_size=32, + dataset=dict( + ann_files=[f's3dis_infos_Area_{i}.pkl' for i in train_area], + scene_idxs=[ + f'seg_info/Area_{i}_resampled_scene_idxs.npy' for i in train_area + ])) +test_dataloader = dict( + dataset=dict( + ann_files=f's3dis_infos_Area_{test_area}.pkl', + scene_idxs=f'seg_info/Area_{test_area}_resampled_scene_idxs.npy')) +val_dataloader = test_dataloader diff --git a/configs/dgcnn/metafile.yml b/configs/dgcnn/metafile.yml index 0e01262192..c383576802 100644 --- a/configs/dgcnn/metafile.yml +++ b/configs/dgcnn/metafile.yml @@ -10,15 +10,80 @@ Collections: README: configs/dgcnn/README.md Models: - - Name: dgcnn_4xb32-cosine-100e_s3dis-seg.py + - Name: dgcnn_4xb32-cosine-100e_s3dis-seg_test-area1.py In Collection: DGCNN - Config: configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg.py + Config: configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area1.py Metadata: Training Data: S3DIS Training Memory (GB): 13.3 Results: - Task: 3D Semantic Segmentation - Dataset: S3DIS + Dataset: S3DIS Area1 + Metrics: + mIoU: 68.33 + Weights: https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area1/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210731_000734-39658f14.pth + + - Name: dgcnn_4xb32-cosine-100e_s3dis-seg_test-area2.py + In Collection: DGCNN + Config: configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area2.py + Metadata: + Training Data: S3DIS + Training Memory (GB): 13.3 + Results: + - Task: 3D Semantic Segmentation + Dataset: S3DIS Area2 + Metrics: + mIoU: 40.68 + Weights: https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area2/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210731_144648-aea9ecb6.pth + + - Name: dgcnn_4xb32-cosine-100e_s3dis-seg_test-area3.py + In Collection: DGCNN + Config: configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area3.py + Metadata: + Training Data: S3DIS + Training Memory (GB): 13.3 + Results: + - Task: 3D Semantic Segmentation + Dataset: S3DIS Area3 + Metrics: + mIoU: 69.38 + Weights: https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area3/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210801_154629-2ff50ee0.pth + + - Name: dgcnn_4xb32-cosine-100e_s3dis-seg_test-area4.py + In Collection: DGCNN + Config: configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area4.py + Metadata: + Training Data: S3DIS + Training Memory (GB): 13.3 + Results: + - Task: 3D Semantic Segmentation + Dataset: S3DIS Area4 + Metrics: + mIoU: 50.07 + Weights: https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area4/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210802_073551-dffab9cd.pth + + - Name: dgcnn_4xb32-cosine-100e_s3dis-seg_test-area5.py + In Collection: DGCNN + Config: configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area5.py + Metadata: + Training Data: S3DIS + Training Memory (GB): 13.3 + Results: + - Task: 3D Semantic Segmentation + Dataset: S3DIS Area5 Metrics: mIoU: 50.59 Weights: https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area5/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210730_235824-f277e0c5.pth + + - Name: dgcnn_4xb32-cosine-100e_s3dis-seg_test-area6.py + In Collection: DGCNN + Config: configs/dgcnn/dgcnn_4xb32-cosine-100e_s3dis-seg_test-area6.py + Metadata: + Training Data: S3DIS + Training Memory (GB): 13.3 + Results: + - Task: 3D Semantic Segmentation + Dataset: S3DIS Area6 + Metrics: + mIoU: 77.94 + Weights: https://download.openmmlab.com/mmdetection3d/v0.17.0_models/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class/area6/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class_20210802_154317-e3511b32.pth diff --git a/mmdet3d/models/decode_heads/decode_head.py b/mmdet3d/models/decode_heads/decode_head.py index 06a807bf4f..9b02feb605 100644 --- a/mmdet3d/models/decode_heads/decode_head.py +++ b/mmdet3d/models/decode_heads/decode_head.py @@ -87,8 +87,6 @@ def __init__(self, else: self.dropout = None - self.fp16_enabled = False - def init_weights(self): """Initialize weights of classification layer.""" super().init_weights() @@ -112,9 +110,9 @@ def loss(self, inputs: List[Tensor], batch_data_samples: SampleList, Args: inputs (list[torch.Tensor]): List of multi-level point features. - img_metas (list[dict]): Meta information of each sample. - pts_semantic_mask (torch.Tensor): Semantic segmentation masks - used if the architecture supports semantic segmentation task. + batch_data_samples (List[:obj:`Det3DDataSample`]): The seg + data samples. It usually includes information such + as `metainfo` and `gt_pts_seg`. train_cfg (dict): The training config. Returns: @@ -130,7 +128,9 @@ def predict(self, inputs: List[Tensor], batch_input_metas: List[dict], Args: inputs (list[Tensor]): List of multi-level point features. - batch_img_metas (list[dict]): Meta information of each sample. + batch_data_samples (List[:obj:`Det3DDataSample`]): The seg + data samples. It usually includes information such + as `metainfo` and `gt_pts_seg`. test_cfg (dict): The testing config. Returns: