Skip to content

Commit

Permalink
[Refactor] refactor DGCNN configs for different areas (#1587)
Browse files Browse the repository at this point in the history
* update parf of configs

* update pp-3class configs
  • Loading branch information
ZCMax authored Jun 27, 2022
1 parent 23e858b commit b1ea1a8
Show file tree
Hide file tree
Showing 12 changed files with 357 additions and 33 deletions.
39 changes: 28 additions & 11 deletions configs/_base_/datasets/kitti-3d-3class.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
class_names = ['Pedestrian', 'Cyclist', 'Car']
point_cloud_range = [0, -40, -3, 70.4, 40, 1]
input_modality = dict(use_lidar=True, use_camera=False)

file_client_args = dict(backend='disk')
# Uncomment the following if use ceph or other file clients.
# See https://mmcv.readthedocs.io/en/latest/api.html#mmcv.fileio.FileClient
# for more details.
# file_client_args = dict(
# backend='petrel',
# path_mapping=dict({
# './data/kitti/':
# 's3://openmmlab/datasets/detection3d/kitti/',
# 'data/kitti/':
# 's3://openmmlab/datasets/detection3d/kitti/'
# }))

db_sampler = dict(
data_root=data_root,
info_path=data_root + 'kitti_dbinfos_train.pkl',
Expand All @@ -12,14 +26,14 @@
filter_by_difficulty=[-1],
filter_by_min_points=dict(Car=5, Pedestrian=10, Cyclist=10)),
classes=class_names,
sample_groups=dict(Car=12, Pedestrian=6, Cyclist=6))

file_client_args = dict(backend='disk')
# Uncomment the following if use ceph or other file clients.
# See https://mmcv.readthedocs.io/en/latest/api.html#mmcv.fileio.FileClient
# for more details.
# file_client_args = dict(
# backend='petrel', path_mapping=dict(data='s3://kitti_data/'))
sample_groups=dict(Car=12, Pedestrian=6, Cyclist=6),
points_loader=dict(
type='LoadPointsFromFile',
coord_type='LIDAR',
load_dim=4,
use_dim=4,
file_client_args=file_client_args),
file_client_args=file_client_args)

train_pipeline = [
dict(
Expand Down Expand Up @@ -113,7 +127,8 @@
test_mode=False,
# we use box_type_3d='LiDAR' in kitti and nuscenes dataset
# and box_type_3d='Depth' in sunrgbd and scannet dataset.
box_type_3d='LiDAR')),
box_type_3d='LiDAR',
file_client_args=file_client_args)),
val=dict(
type=dataset_type,
data_root=data_root,
Expand All @@ -124,7 +139,8 @@
modality=input_modality,
classes=class_names,
test_mode=True,
box_type_3d='LiDAR'),
box_type_3d='LiDAR',
file_client_args=file_client_args),
test=dict(
type=dataset_type,
data_root=data_root,
Expand All @@ -135,6 +151,7 @@
modality=input_modality,
classes=class_names,
test_mode=True,
box_type_3d='LiDAR'))
box_type_3d='LiDAR',
file_client_args=file_client_args))

evaluation = dict(interval=1, pipeline=eval_pipeline)
2 changes: 2 additions & 0 deletions configs/_base_/datasets/s3dis_seg-3d-13class.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
data_root = './data/s3dis/'
class_names = ('ceiling', 'floor', 'wall', 'beam', 'column', 'window', 'door',
'table', 'chair', 'sofa', 'bookcase', 'board', 'clutter')

file_client_args = dict(backend='disk')
# Uncomment the following if use ceph or other file clients.
# See https://mmcv.readthedocs.io/en/latest/api.html#mmcv.fileio.FileClient
Expand All @@ -15,6 +16,7 @@
# 'data/s3dis/':
# 's3://openmmlab/datasets/detection3d/s3dis_processed/'
# }))

num_points = 4096
train_area = [1, 2, 3, 4, 6]
test_area = 5
Expand Down
27 changes: 24 additions & 3 deletions configs/_base_/datasets/scannet-3d-18class.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,31 @@
'bookshelf', 'picture', 'counter', 'desk', 'curtain',
'refrigerator', 'showercurtrain', 'toilet', 'sink', 'bathtub',
'garbagebin')

file_client_args = dict(backend='disk')
# Uncomment the following if use ceph or other file clients.
# See https://mmcv.readthedocs.io/en/latest/api.html#mmcv.fileio.FileClient
# for more details.
# file_client_args = dict(
# backend='petrel',
# path_mapping=dict({
# './data/scannet/':
# 's3://openmmlab/datasets/detection3d/scannet_processed/',
# 'data/scannet/':
# 's3://openmmlab/datasets/detection3d/scannet_processed/'
# }))

train_pipeline = [
dict(
type='LoadPointsFromFile',
file_client_args=file_client_args,
coord_type='DEPTH',
shift_height=True,
load_dim=6,
use_dim=[0, 1, 2]),
dict(
type='LoadAnnotations3D',
file_client_args=file_client_args,
with_bbox_3d=True,
with_label_3d=True,
with_mask_3d=True,
Expand Down Expand Up @@ -46,6 +62,7 @@
test_pipeline = [
dict(
type='LoadPointsFromFile',
file_client_args=file_client_args,
coord_type='DEPTH',
shift_height=True,
load_dim=6,
Expand Down Expand Up @@ -80,6 +97,7 @@
eval_pipeline = [
dict(
type='LoadPointsFromFile',
file_client_args=file_client_args,
coord_type='DEPTH',
shift_height=False,
load_dim=6,
Expand Down Expand Up @@ -107,22 +125,25 @@
classes=class_names,
# we use box_type_3d='LiDAR' in kitti and nuscenes dataset
# and box_type_3d='Depth' in sunrgbd and scannet dataset.
box_type_3d='Depth')),
box_type_3d='Depth',
file_client_args=file_client_args)),
val=dict(
type=dataset_type,
data_root=data_root,
ann_file=data_root + 'scannet_infos_val.pkl',
pipeline=test_pipeline,
classes=class_names,
test_mode=True,
box_type_3d='Depth'),
box_type_3d='Depth',
file_client_args=file_client_args),
test=dict(
type=dataset_type,
data_root=data_root,
ann_file=data_root + 'scannet_infos_val.pkl',
pipeline=test_pipeline,
classes=class_names,
test_mode=True,
box_type_3d='Depth'))
box_type_3d='Depth',
file_client_args=file_client_args))

evaluation = dict(pipeline=eval_pipeline)
38 changes: 30 additions & 8 deletions configs/_base_/datasets/scannet_seg-3d-20class.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,36 @@
'curtain', 'refrigerator', 'showercurtrain', 'toilet', 'sink',
'bathtub', 'otherfurniture')
num_points = 8192

file_client_args = dict(backend='disk')
# Uncomment the following if use ceph or other file clients.
# See https://mmcv.readthedocs.io/en/latest/api.html#mmcv.fileio.FileClient
# for more details.
# file_client_args = dict(
# backend='petrel',
# path_mapping=dict({
# './data/scannet/':
# 's3://openmmlab/datasets/detection3d/scannet_processed/',
# 'data/scannet/':
# 's3://openmmlab/datasets/detection3d/scannet_processed/'
# }))

train_pipeline = [
dict(
type='LoadPointsFromFile',
coord_type='DEPTH',
shift_height=False,
use_color=True,
load_dim=6,
use_dim=[0, 1, 2, 3, 4, 5]),
use_dim=[0, 1, 2, 3, 4, 5],
file_client_args=file_client_args),
dict(
type='LoadAnnotations3D',
with_bbox_3d=False,
with_label_3d=False,
with_mask_3d=False,
with_seg_3d=True),
with_seg_3d=True,
file_client_args=file_client_args),
dict(
type='PointSegClassMapping',
valid_cat_ids=(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 24, 28,
Expand All @@ -44,7 +60,8 @@
shift_height=False,
use_color=True,
load_dim=6,
use_dim=[0, 1, 2, 3, 4, 5]),
use_dim=[0, 1, 2, 3, 4, 5],
file_client_args=file_client_args),
dict(type='NormalizePointsColor', color_mean=None),
dict(
# a wrapper in order to successfully call test function
Expand Down Expand Up @@ -81,13 +98,15 @@
shift_height=False,
use_color=True,
load_dim=6,
use_dim=[0, 1, 2, 3, 4, 5]),
use_dim=[0, 1, 2, 3, 4, 5],
file_client_args=file_client_args),
dict(
type='LoadAnnotations3D',
with_bbox_3d=False,
with_label_3d=False,
with_mask_3d=False,
with_seg_3d=True),
with_seg_3d=True,
file_client_args=file_client_args),
dict(
type='PointSegClassMapping',
valid_cat_ids=(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 24, 28,
Expand All @@ -111,22 +130,25 @@
classes=class_names,
test_mode=False,
ignore_index=len(class_names),
scene_idxs=data_root + 'seg_info/train_resampled_scene_idxs.npy'),
scene_idxs=data_root + 'seg_info/train_resampled_scene_idxs.npy',
file_client_args=file_client_args),
val=dict(
type=dataset_type,
data_root=data_root,
ann_file=data_root + 'scannet_infos_val.pkl',
pipeline=test_pipeline,
classes=class_names,
test_mode=True,
ignore_index=len(class_names)),
ignore_index=len(class_names),
file_client_args=file_client_args),
test=dict(
type=dataset_type,
data_root=data_root,
ann_file=data_root + 'scannet_infos_val.pkl',
pipeline=test_pipeline,
classes=class_names,
test_mode=True,
ignore_index=len(class_names)))
ignore_index=len(class_names),
file_client_args=file_client_args))

evaluation = dict(pipeline=eval_pipeline)
34 changes: 27 additions & 7 deletions configs/_base_/datasets/sunrgbd-3d-10class.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,29 @@
data_root = 'data/sunrgbd/'
class_names = ('bed', 'table', 'sofa', 'chair', 'toilet', 'desk', 'dresser',
'night_stand', 'bookshelf', 'bathtub')

file_client_args = dict(backend='disk')
# Uncomment the following if use ceph or other file clients.
# See https://mmcv.readthedocs.io/en/latest/api.html#mmcv.fileio.FileClient
# for more details.
# file_client_args = dict(
# backend='petrel',
# path_mapping=dict({
# './data/sunrgbd/':
# 's3://openmmlab/datasets/detection3d/sunrgbd_processed/',
# 'data/sunrgbd/':
# 's3://openmmlab/datasets/detection3d/sunrgbd_processed/'
# }))

train_pipeline = [
dict(
type='LoadPointsFromFile',
coord_type='DEPTH',
shift_height=True,
load_dim=6,
use_dim=[0, 1, 2]),
dict(type='LoadAnnotations3D'),
use_dim=[0, 1, 2],
file_client_args=file_client_args),
dict(type='LoadAnnotations3D', file_client_args=file_client_args),
dict(
type='RandomFlip3D',
sync_2d=False,
Expand All @@ -30,7 +45,8 @@
coord_type='DEPTH',
shift_height=True,
load_dim=6,
use_dim=[0, 1, 2]),
use_dim=[0, 1, 2],
file_client_args=file_client_args),
dict(
type='MultiScaleFlipAug3D',
img_scale=(1333, 800),
Expand Down Expand Up @@ -63,7 +79,8 @@
coord_type='DEPTH',
shift_height=False,
load_dim=6,
use_dim=[0, 1, 2]),
use_dim=[0, 1, 2],
file_client_args=file_client_args),
dict(
type='DefaultFormatBundle3D',
class_names=class_names,
Expand All @@ -86,22 +103,25 @@
filter_empty_gt=False,
# we use box_type_3d='LiDAR' in kitti and nuscenes dataset
# and box_type_3d='Depth' in sunrgbd and scannet dataset.
box_type_3d='Depth')),
box_type_3d='Depth',
file_client_args=file_client_args)),
val=dict(
type=dataset_type,
data_root=data_root,
ann_file=data_root + 'sunrgbd_infos_val.pkl',
pipeline=test_pipeline,
classes=class_names,
test_mode=True,
box_type_3d='Depth'),
box_type_3d='Depth',
file_client_args=file_client_args),
test=dict(
type=dataset_type,
data_root=data_root,
ann_file=data_root + 'sunrgbd_infos_val.pkl',
pipeline=test_pipeline,
classes=class_names,
test_mode=True,
box_type_3d='Depth'))
box_type_3d='Depth',
file_client_args=file_client_args))

evaluation = dict(pipeline=eval_pipeline)
42 changes: 42 additions & 0 deletions configs/dgcnn/dgcnn_32x4_cosine_100e_s3dis_seg-3d-13class-area1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
_base_ = [
'../_base_/datasets/s3dis_seg-3d-13class.py', '../_base_/models/dgcnn.py',
'../_base_/schedules/seg_cosine_100e.py', '../_base_/default_runtime.py'
]

# data settings
train_area = [2, 3, 4, 5, 6]
test_area = 1
data_root = './data/s3dis/'
data = dict(
samples_per_gpu=32,
train=dict(
ann_files=[
data_root + f's3dis_infos_Area_{i}.pkl' for i in train_area
],
scene_idxs=[
data_root + f'seg_info/Area_{i}_resampled_scene_idxs.npy'
for i in train_area
]),
val=dict(
ann_files=data_root + f's3dis_infos_Area_{test_area}.pkl',
scene_idxs=data_root +
f'seg_info/Area_{test_area}_resampled_scene_idxs.npy'),
test=dict(ann_files=data_root + f's3dis_infos_Area_{test_area}.pkl'))

evaluation = dict(interval=2)

# model settings
model = dict(
backbone=dict(in_channels=9), # [xyz, rgb, normalized_xyz]
decode_head=dict(
num_classes=13, ignore_index=13,
loss_decode=dict(class_weight=None)), # S3DIS doesn't use class_weight
test_cfg=dict(
num_points=4096,
block_size=1.0,
sample_rate=0.5,
use_normalized_coord=True,
batch_size=24))

# runtime settings
checkpoint_config = dict(interval=2)
Loading

0 comments on commit b1ea1a8

Please sign in to comment.