Unverified Commit 3365d7e5 authored by Sun Jiahao's avatar Sun Jiahao Committed by GitHub
Browse files

[Feature]Add Lidarseg benchmark (#2530)

* enhance minkunet

* add 2x

* add config

* add flip...

* add bottleneck

* add spvcnn & cylinder3d

* add spvcnn & cylinder3d

* refactor minkunet & spvcnn

* add minkv2

* fix mink34 shared res block

* add mink spconv

* fix spconv int32 max bug

* fix spconv int32 max bug2

* add minkowski backends

* rename config

* fix minkv2 config

* fix max voxel bug

* add checkpointhook mink18

* add backbone docstring

* fix torchsparse uninstall bug

* remove ME

* fix ut

* fix cylinder3d config
parent 3fa4dc1a
......@@ -4,19 +4,24 @@ model = dict(
type='Det3DDataPreprocessor',
voxel=True,
voxel_type='minkunet',
batch_first=False,
max_voxels=80000,
voxel_layer=dict(
max_num_points=-1,
point_cloud_range=[-100, -100, -20, 100, 100, 20],
voxel_size=[0.05, 0.05, 0.05],
max_voxels=(-1, -1)),
max_voxels=80000),
max_voxels=(-1, -1))),
backbone=dict(
type='MinkUNetBackbone',
in_channels=4,
base_channels=32,
num_stages=4,
base_channels=32,
encoder_channels=[32, 64, 128, 256],
decoder_channels=[256, 128, 96, 96]),
encoder_blocks=[2, 2, 2, 2],
decoder_channels=[256, 128, 96, 96],
decoder_blocks=[2, 2, 2, 2],
block_type='basic',
sparseconv_backend='torchsparse'),
decode_head=dict(
type='MinkUNetHead',
channels=96,
......
......@@ -4,19 +4,24 @@ model = dict(
type='Det3DDataPreprocessor',
voxel=True,
voxel_type='minkunet',
batch_first=False,
max_voxels=80000,
voxel_layer=dict(
max_num_points=-1,
point_cloud_range=[-100, -100, -20, 100, 100, 20],
voxel_size=[0.05, 0.05, 0.05],
max_voxels=(-1, -1)),
max_voxels=80000),
max_voxels=(-1, -1))),
backbone=dict(
type='SPVCNNBackbone',
in_channels=4,
base_channels=32,
num_stages=4,
base_channels=32,
encoder_channels=[32, 64, 128, 256],
encoder_blocks=[2, 2, 2, 2],
decoder_channels=[256, 128, 96, 96],
decoder_blocks=[2, 2, 2, 2],
block_type='basic',
sparseconv_backend='torchsparse',
drop_ratio=0.3),
decode_head=dict(
type='MinkUNetHead',
......
......@@ -8,7 +8,7 @@ optim_wrapper = dict(
clip_grad=dict(max_norm=10, norm_type=2),
)
# training schedule for 1x
# training schedule for 3x
train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=36, val_interval=1)
val_cfg = dict(type='ValLoop')
test_cfg = dict(type='TestLoop')
......
......@@ -4,7 +4,6 @@ _base_ = [
]
# optimizer
# This schedule is mainly used by models on nuScenes dataset
lr = 0.001
optim_wrapper = dict(
type='OptimWrapper',
......
_base_ = [
'../_base_/datasets/semantickitti.py', '../_base_/models/cylinder3d.py',
'../_base_/schedules/schedule-3x.py', '../_base_/default_runtime.py'
]
train_pipeline = [
dict(type='LoadPointsFromFile', coord_type='LIDAR', load_dim=4, use_dim=4),
dict(
type='LoadAnnotations3D',
with_bbox_3d=False,
with_label_3d=False,
with_seg_3d=True,
seg_3d_dtype='np.int32',
seg_offset=2**16,
dataset_type='semantickitti'),
dict(type='PointSegClassMapping'),
dict(
type='RandomChoice',
transforms=[
[
dict(
type='LaserMix',
num_areas=[3, 4, 5, 6],
pitch_angles=[-25, 3],
pre_transform=[
dict(
type='LoadPointsFromFile',
coord_type='LIDAR',
load_dim=4,
use_dim=4),
dict(
type='LoadAnnotations3D',
with_bbox_3d=False,
with_label_3d=False,
with_seg_3d=True,
seg_3d_dtype='np.int32',
seg_offset=2**16,
dataset_type='semantickitti'),
dict(type='PointSegClassMapping')
],
prob=1)
],
[
dict(
type='PolarMix',
instance_classes=[0, 1, 2, 3, 4, 5, 6, 7],
swap_ratio=0.5,
rotate_paste_ratio=1.0,
pre_transform=[
dict(
type='LoadPointsFromFile',
coord_type='LIDAR',
load_dim=4,
use_dim=4),
dict(
type='LoadAnnotations3D',
with_bbox_3d=False,
with_label_3d=False,
with_seg_3d=True,
seg_3d_dtype='np.int32',
seg_offset=2**16,
dataset_type='semantickitti'),
dict(type='PointSegClassMapping')
],
prob=1)
],
],
prob=[0.5, 0.5]),
dict(
type='GlobalRotScaleTrans',
rot_range=[0., 6.28318531],
scale_ratio_range=[0.95, 1.05],
translation_std=[0, 0, 0],
),
dict(type='Pack3DDetInputs', keys=['points', 'pts_semantic_mask'])
]
train_dataloader = dict(dataset=dict(pipeline=train_pipeline))
default_hooks = dict(checkpoint=dict(type='CheckpointHook', interval=1))
_base_ = [
'./minkunet34_w32_torchsparse_8xb2-laser-polar-mix-3x_semantickitti.py'
]
model = dict(
data_preprocessor=dict(batch_first=True),
backbone=dict(sparseconv_backend='minkowski'))
_base_ = [
'./minkunet34_w32_torchsparse_8xb2-laser-polar-mix-3x_semantickitti.py'
]
model = dict(
data_preprocessor=dict(batch_first=True),
backbone=dict(sparseconv_backend='spconv'))
optim_wrapper = dict(type='AmpOptimWrapper', loss_scale='dynamic')
_base_ = [
'./minkunet34_w32_torchsparse_8xb2-laser-polar-mix-3x_semantickitti.py'
]
model = dict(
data_preprocessor=dict(batch_first=True),
backbone=dict(sparseconv_backend='spconv'))
_base_ = [
'./minkunet34_w32_torchsparse_8xb2-laser-polar-mix-3x_semantickitti.py'
]
optim_wrapper = dict(type='AmpOptimWrapper', loss_scale='dynamic')
_base_ = [
'../_base_/datasets/semantickitti.py', '../_base_/models/minkunet.py',
'../_base_/schedules/schedule-3x.py', '../_base_/default_runtime.py'
]
model = dict(
data_preprocessor=dict(max_voxels=None),
backbone=dict(encoder_blocks=[2, 3, 4, 6]))
train_pipeline = [
dict(type='LoadPointsFromFile', coord_type='LIDAR', load_dim=4, use_dim=4),
dict(
type='LoadAnnotations3D',
with_bbox_3d=False,
with_label_3d=False,
with_seg_3d=True,
seg_3d_dtype='np.int32',
seg_offset=2**16,
dataset_type='semantickitti'),
dict(type='PointSegClassMapping'),
dict(
type='RandomChoice',
transforms=[
[
dict(
type='LaserMix',
num_areas=[3, 4, 5, 6],
pitch_angles=[-25, 3],
pre_transform=[
dict(
type='LoadPointsFromFile',
coord_type='LIDAR',
load_dim=4,
use_dim=4),
dict(
type='LoadAnnotations3D',
with_bbox_3d=False,
with_label_3d=False,
with_seg_3d=True,
seg_3d_dtype='np.int32',
seg_offset=2**16,
dataset_type='semantickitti'),
dict(type='PointSegClassMapping')
],
prob=1)
],
[
dict(
type='PolarMix',
instance_classes=[0, 1, 2, 3, 4, 5, 6, 7],
swap_ratio=0.5,
rotate_paste_ratio=1.0,
pre_transform=[
dict(
type='LoadPointsFromFile',
coord_type='LIDAR',
load_dim=4,
use_dim=4),
dict(
type='LoadAnnotations3D',
with_bbox_3d=False,
with_label_3d=False,
with_seg_3d=True,
seg_3d_dtype='np.int32',
seg_offset=2**16,
dataset_type='semantickitti'),
dict(type='PointSegClassMapping')
],
prob=1)
],
],
prob=[0.5, 0.5]),
dict(
type='GlobalRotScaleTrans',
rot_range=[0., 6.28318531],
scale_ratio_range=[0.95, 1.05],
translation_std=[0, 0, 0],
),
dict(type='Pack3DDetInputs', keys=['points', 'pts_semantic_mask'])
]
train_dataloader = dict(dataset=dict(pipeline=train_pipeline))
default_hooks = dict(checkpoint=dict(type='CheckpointHook', interval=1))
_base_ = [
'./minkunet34_w32_torchsparse_8xb2-amp-laser-polar-mix-3x_semantickitti.py'
]
model = dict(
backbone=dict(type='MinkUNetBackboneV2'),
decode_head=dict(channels=256 + 128 + 96))
randomness = dict(seed=None, deterministic=False, diff_rank_seed=True)
env_cfg = dict(cudnn_benchmark=True)
_base_ = [
'../_base_/datasets/semantickitti.py', '../_base_/models/spvcnn.py',
'../_base_/schedules/schedule-3x.py', '../_base_/default_runtime.py'
]
model = dict(data_preprocessor=dict(max_voxels=None))
train_pipeline = [
dict(type='LoadPointsFromFile', coord_type='LIDAR', load_dim=4, use_dim=4),
dict(
type='LoadAnnotations3D',
with_bbox_3d=False,
with_label_3d=False,
with_seg_3d=True,
seg_3d_dtype='np.int32',
seg_offset=2**16,
dataset_type='semantickitti'),
dict(type='PointSegClassMapping'),
dict(
type='RandomChoice',
transforms=[
[
dict(
type='LaserMix',
num_areas=[3, 4, 5, 6],
pitch_angles=[-25, 3],
pre_transform=[
dict(
type='LoadPointsFromFile',
coord_type='LIDAR',
load_dim=4,
use_dim=4),
dict(
type='LoadAnnotations3D',
with_bbox_3d=False,
with_label_3d=False,
with_seg_3d=True,
seg_3d_dtype='np.int32',
seg_offset=2**16,
dataset_type='semantickitti'),
dict(type='PointSegClassMapping')
],
prob=1)
],
[
dict(
type='PolarMix',
instance_classes=[0, 1, 2, 3, 4, 5, 6, 7],
swap_ratio=0.5,
rotate_paste_ratio=1.0,
pre_transform=[
dict(
type='LoadPointsFromFile',
coord_type='LIDAR',
load_dim=4,
use_dim=4),
dict(
type='LoadAnnotations3D',
with_bbox_3d=False,
with_label_3d=False,
with_seg_3d=True,
seg_3d_dtype='np.int32',
seg_offset=2**16,
dataset_type='semantickitti'),
dict(type='PointSegClassMapping')
],
prob=1)
],
],
prob=[0.5, 0.5]),
dict(
type='GlobalRotScaleTrans',
rot_range=[0., 6.28318531],
scale_ratio_range=[0.95, 1.05],
translation_std=[0, 0, 0],
),
dict(type='Pack3DDetInputs', keys=['points', 'pts_semantic_mask'])
]
train_dataloader = dict(dataset=dict(pipeline=train_pipeline))
optim_wrapper = dict(type='AmpOptimWrapper', loss_scale='dynamic')
default_hooks = dict(checkpoint=dict(type='CheckpointHook', interval=1))
randomness = dict(seed=0, deterministic=False, diff_rank_seed=True)
env_cfg = dict(cudnn_benchmark=True)
......@@ -1039,7 +1039,7 @@ class PointSample(BaseTransform):
def _points_random_sampling(
self,
points: BasePoints,
num_samples: int,
num_samples: Union[int, float],
sample_range: Optional[float] = None,
replace: bool = False,
return_choices: bool = False
......@@ -1050,7 +1050,9 @@ class PointSample(BaseTransform):
Args:
points (:obj:`BasePoints`): 3D Points.
num_samples (int): Number of samples to be sampled.
num_samples (int, float): Number of samples to be sampled. If
float, we sample random fraction of points from num_points
to 100%.
sample_range (float, optional): Indicating the range where the
points will be sampled. Defaults to None.
replace (bool): Sampling with or without replacement.
......@@ -1063,6 +1065,11 @@ class PointSample(BaseTransform):
- points (:obj:`BasePoints`): 3D Points.
- choices (np.ndarray, optional): The generated random samples.
"""
if isinstance(num_samples, float):
assert num_samples < 1
num_samples = int(
np.random.uniform(self.num_points, 1.) * points.shape[0])
if not replace:
replace = (points.shape[0] < num_samples)
point_range = range(len(points))
......
......@@ -11,11 +11,11 @@ from .nostem_regnet import NoStemRegNet
from .pointnet2_sa_msg import PointNet2SAMSG
from .pointnet2_sa_ssg import PointNet2SASSG
from .second import SECOND
from .spvcnn_backone import SPVCNNBackbone
from .spvcnn_backone import MinkUNetBackboneV2, SPVCNNBackbone
__all__ = [
'ResNet', 'ResNetV1d', 'ResNeXt', 'SSDVGG', 'HRNet', 'NoStemRegNet',
'SECOND', 'DGCNNBackbone', 'PointNet2SASSG', 'PointNet2SAMSG',
'MultiBackbone', 'DLANet', 'MinkResNet', 'Asymm3DSpconv',
'MinkUNetBackbone', 'SPVCNNBackbone'
'MinkUNetBackbone', 'SPVCNNBackbone', 'MinkUNetBackboneV2'
]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment