From ea89ea16e021da41a07a88cd18558a7fc017511d Mon Sep 17 00:00:00 2001 From: liyinhao Date: Mon, 7 Sep 2020 17:10:47 +0800 Subject: [PATCH 01/21] Add pointpillar configs. --- configs/_base_/models/centerpoint_pp.py | 96 +++++++++ .../models/centerpoint_pp_circle_nms.py | 93 +++++++++ configs/_base_/models/centerpoint_pp_dcn.py | 96 +++++++++ .../models/centerpoint_pp_dcn_circle_nms.py | 93 +++++++++ configs/centerpoint/centerpoint_pp.py | 179 +++++++++++++++++ .../centerpoint/centerpoint_pp_circle_nms.py | 182 ++++++++++++++++++ configs/centerpoint/centerpoint_pp_dcn.py | 181 +++++++++++++++++ .../centerpoint_pp_dcn_circle_nms.py | 182 ++++++++++++++++++ 8 files changed, 1102 insertions(+) create mode 100644 configs/_base_/models/centerpoint_pp.py create mode 100644 configs/_base_/models/centerpoint_pp_circle_nms.py create mode 100644 configs/_base_/models/centerpoint_pp_dcn.py create mode 100644 configs/_base_/models/centerpoint_pp_dcn_circle_nms.py create mode 100644 configs/centerpoint/centerpoint_pp.py create mode 100644 configs/centerpoint/centerpoint_pp_circle_nms.py create mode 100644 configs/centerpoint/centerpoint_pp_dcn.py create mode 100644 configs/centerpoint/centerpoint_pp_dcn_circle_nms.py diff --git a/configs/_base_/models/centerpoint_pp.py b/configs/_base_/models/centerpoint_pp.py new file mode 100644 index 0000000000..82113498e9 --- /dev/null +++ b/configs/_base_/models/centerpoint_pp.py @@ -0,0 +1,96 @@ +voxel_size = [0.2, 0.2, 8] +model = dict( + type='CenterPoint', + pts_voxel_layer=dict( + max_num_points=20, + point_cloud_range=[-51.2, -51.2, -5.0, 51.2, 51.2, 3.0], + voxel_size=voxel_size, + max_voxels=(30000, 40000)), + pts_voxel_encoder=dict( + type='PillarFeatureNet', + in_channels=5, + feat_channels=[64], + with_distance=False, + voxel_size=(0.2, 0.2, 8), + point_cloud_range=(-51.2, -51.2, -5.0, 51.2, 51.2, 3.0), + norm_cfg=dict(type='BN1d', eps=1e-3, momentum=0.01), + legacy=False), + pts_middle_encoder=dict( + type='PointPillarsScatter', in_channels=64, output_shape=(512, 512)), + pts_backbone=dict( + type='SECOND', + in_channels=64, + out_channels=[64, 128, 256], + layer_nums=[3, 5, 5], + layer_strides=[2, 2, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + conv_cfg=dict(type='Conv2d', bias=False)), + pts_neck=dict( + type='SECONDFPN', + in_channels=[64, 128, 256], + out_channels=[128, 128, 128], + upsample_strides=[0.5, 1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + upsample_cfg=dict(type='deconv', bias=False), + use_conv_for_no_stride=True), + pts_bbox_head=dict( + type='CenterHead', + mode='3d', + in_channels=sum([128, 128, 128]), + tasks=[ + dict(num_class=1, class_names=['car']), + dict(num_class=2, class_names=['truck', 'construction_vehicle']), + dict(num_class=2, class_names=['bus', 'trailer']), + dict(num_class=1, class_names=['barrier']), + dict(num_class=2, class_names=['motorcycle', 'bicycle']), + dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), + ], + common_heads={ + 'reg': (2, 2), + 'height': (1, 2), + 'dim': (3, 2), + 'rot': (2, 2), + 'vel': (2, 2) + }, + share_conv_channel=64, + bbox_coder=dict( + type='CenterPointBBoxCoder', + post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_num=500, + score_threshold=0.1, + pc_range=[-51.2, -51.2], + out_size_factor=4, + voxel_size=voxel_size[:2], + code_size=9), + dcn_head=False, + loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) +# model training and testing settings +train_cfg = dict( + pts=dict( + grid_size=[512, 512, 1], + point_cloud_range=[-51.2, -51.2, -5., 51.2, 51.2, 3.], + voxel_size=voxel_size, + out_size_factor=4, + dense_reg=1, + gaussian_overlap=0.1, + max_objs=500, + min_radius=2, + no_log=False, + code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0])) +test_cfg = dict( + pts=dict( + post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_per_img=500, + max_pool_nms=False, + min_radius=[4, 12, 10, 1, 0.85, 0.175], + post_max_size=83, + score_threshold=0.1, + pc_range=[-51.2, -51.2], + out_size_factor=4, + voxel_size=voxel_size[:2], + nms_type='rotate', + nms_pre_max_size=1000, + nms_post_max_size=83, + nms_iou_threshold=0.2, + no_log=False)) diff --git a/configs/_base_/models/centerpoint_pp_circle_nms.py b/configs/_base_/models/centerpoint_pp_circle_nms.py new file mode 100644 index 0000000000..9b368854b5 --- /dev/null +++ b/configs/_base_/models/centerpoint_pp_circle_nms.py @@ -0,0 +1,93 @@ +voxel_size = [0.2, 0.2, 8] +model = dict( + type='CenterPoint', + pts_voxel_layer=dict( + max_num_points=20, + point_cloud_range=[-51.2, -51.2, -5.0, 51.2, 51.2, 3.0], + voxel_size=voxel_size, + max_voxels=(30000, 40000)), + pts_voxel_encoder=dict( + type='PillarFeatureNet', + in_channels=5, + feat_channels=[64], + with_distance=False, + voxel_size=(0.2, 0.2, 8), + point_cloud_range=(-51.2, -51.2, -5.0, 51.2, 51.2, 3.0), + norm_cfg=dict(type='BN1d', eps=1e-3, momentum=0.01), + legacy=False), + pts_middle_encoder=dict( + type='PointPillarsScatter', in_channels=64, output_shape=(512, 512)), + pts_backbone=dict( + type='SECOND', + in_channels=64, + out_channels=[64, 128, 256], + layer_nums=[3, 5, 5], + layer_strides=[2, 2, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + conv_cfg=dict(type='Conv2d', bias=False)), + pts_neck=dict( + type='SECONDFPN', + in_channels=[64, 128, 256], + out_channels=[128, 128, 128], + upsample_strides=[0.5, 1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + upsample_cfg=dict(type='deconv', bias=False), + use_conv_for_no_stride=True), + pts_bbox_head=dict( + type='CenterHead', + mode='3d', + in_channels=sum([128, 128, 128]), + tasks=[ + dict(num_class=1, class_names=['car']), + dict(num_class=2, class_names=['truck', 'construction_vehicle']), + dict(num_class=2, class_names=['bus', 'trailer']), + dict(num_class=1, class_names=['barrier']), + dict(num_class=2, class_names=['motorcycle', 'bicycle']), + dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), + ], + common_heads={ + 'reg': (2, 2), + 'height': (1, 2), + 'dim': (3, 2), + 'rot': (2, 2), + 'vel': (2, 2) + }, + share_conv_channel=64, + bbox_coder=dict( + type='CenterPointBBoxCoder', + post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_num=500, + score_threshold=0.1, + pc_range=[-51.2, -51.2], + out_size_factor=4, + voxel_size=voxel_size[:2], + code_size=9), + dcn_head=False, + loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) +# model training and testing settings +train_cfg = dict( + pts=dict( + grid_size=[512, 512, 1], + point_cloud_range=[-51.2, -51.2, -5., 51.2, 51.2, 3.], + voxel_size=voxel_size, + out_size_factor=4, + dense_reg=1, + gaussian_overlap=0.1, + max_objs=500, + min_radius=2, + no_log=False, + code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0])) +test_cfg = dict( + pts=dict( + post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_per_img=500, + max_pool_nms=False, + min_radius=[4, 12, 10, 1, 0.85, 0.175], + post_max_size=83, + score_threshold=0.1, + pc_range=[-51.2, -51.2], + out_size_factor=4, + voxel_size=voxel_size[:2], + nms_type='circle', + no_log=False)) diff --git a/configs/_base_/models/centerpoint_pp_dcn.py b/configs/_base_/models/centerpoint_pp_dcn.py new file mode 100644 index 0000000000..1b17c4f4e1 --- /dev/null +++ b/configs/_base_/models/centerpoint_pp_dcn.py @@ -0,0 +1,96 @@ +voxel_size = [0.2, 0.2, 8] +model = dict( + type='CenterPoint', + pts_voxel_layer=dict( + max_num_points=20, + point_cloud_range=[-51.2, -51.2, -5.0, 51.2, 51.2, 3.0], + voxel_size=voxel_size, + max_voxels=(30000, 40000)), + pts_voxel_encoder=dict( + type='PillarFeatureNet', + in_channels=5, + feat_channels=[64], + with_distance=False, + voxel_size=(0.2, 0.2, 8), + point_cloud_range=(-51.2, -51.2, -5.0, 51.2, 51.2, 3.0), + norm_cfg=dict(type='BN1d', eps=1e-3, momentum=0.01), + legacy=False), + pts_middle_encoder=dict( + type='PointPillarsScatter', in_channels=64, output_shape=(512, 512)), + pts_backbone=dict( + type='SECOND', + in_channels=64, + out_channels=[64, 128, 256], + layer_nums=[3, 5, 5], + layer_strides=[2, 2, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + conv_cfg=dict(type='Conv2d', bias=False)), + pts_neck=dict( + type='SECONDFPN', + in_channels=[64, 128, 256], + out_channels=[128, 128, 128], + upsample_strides=[0.5, 1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + upsample_cfg=dict(type='deconv', bias=False), + use_conv_for_no_stride=True), + pts_bbox_head=dict( + type='CenterHead', + mode='3d', + in_channels=sum([128, 128, 128]), + tasks=[ + dict(num_class=1, class_names=['car']), + dict(num_class=2, class_names=['truck', 'construction_vehicle']), + dict(num_class=2, class_names=['bus', 'trailer']), + dict(num_class=1, class_names=['barrier']), + dict(num_class=2, class_names=['motorcycle', 'bicycle']), + dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), + ], + common_heads={ + 'reg': (2, 2), + 'height': (1, 2), + 'dim': (3, 2), + 'rot': (2, 2), + 'vel': (2, 2) + }, + share_conv_channel=64, + bbox_coder=dict( + type='CenterPointBBoxCoder', + post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_num=500, + score_threshold=0.1, + pc_range=[-51.2, -51.2], + out_size_factor=4, + voxel_size=voxel_size[:2], + code_size=9), + dcn_head=True, + loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) +# model training and testing settings +train_cfg = dict( + pts=dict( + grid_size=[512, 512, 1], + point_cloud_range=[-51.2, -51.2, -5., 51.2, 51.2, 3.], + voxel_size=voxel_size, + out_size_factor=4, + dense_reg=1, + gaussian_overlap=0.1, + max_objs=500, + min_radius=2, + no_log=False, + code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0])) +test_cfg = dict( + pts=dict( + post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_per_img=500, + max_pool_nms=False, + min_radius=[4, 12, 10, 1, 0.85, 0.175], + post_max_size=83, + score_threshold=0.1, + pc_range=[-51.2, -51.2], + out_size_factor=4, + voxel_size=voxel_size[:2], + nms_type='rotate', + nms_pre_max_size=1000, + nms_post_max_size=83, + nms_iou_threshold=0.2, + no_log=False)) diff --git a/configs/_base_/models/centerpoint_pp_dcn_circle_nms.py b/configs/_base_/models/centerpoint_pp_dcn_circle_nms.py new file mode 100644 index 0000000000..c82f434a15 --- /dev/null +++ b/configs/_base_/models/centerpoint_pp_dcn_circle_nms.py @@ -0,0 +1,93 @@ +voxel_size = [0.2, 0.2, 8] +model = dict( + type='CenterPoint', + pts_voxel_layer=dict( + max_num_points=20, + point_cloud_range=[-51.2, -51.2, -5.0, 51.2, 51.2, 3.0], + voxel_size=voxel_size, + max_voxels=(30000, 40000)), + pts_voxel_encoder=dict( + type='PillarFeatureNet', + in_channels=5, + feat_channels=[64], + with_distance=False, + voxel_size=(0.2, 0.2, 8), + point_cloud_range=(-51.2, -51.2, -5.0, 51.2, 51.2, 3.0), + norm_cfg=dict(type='BN1d', eps=1e-3, momentum=0.01), + legacy=False), + pts_middle_encoder=dict( + type='PointPillarsScatter', in_channels=64, output_shape=(512, 512)), + pts_backbone=dict( + type='SECOND', + in_channels=64, + out_channels=[64, 128, 256], + layer_nums=[3, 5, 5], + layer_strides=[2, 2, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + conv_cfg=dict(type='Conv2d', bias=False)), + pts_neck=dict( + type='SECONDFPN', + in_channels=[64, 128, 256], + out_channels=[128, 128, 128], + upsample_strides=[0.5, 1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + upsample_cfg=dict(type='deconv', bias=False), + use_conv_for_no_stride=True), + pts_bbox_head=dict( + type='CenterHead', + mode='3d', + in_channels=sum([128, 128, 128]), + tasks=[ + dict(num_class=1, class_names=['car']), + dict(num_class=2, class_names=['truck', 'construction_vehicle']), + dict(num_class=2, class_names=['bus', 'trailer']), + dict(num_class=1, class_names=['barrier']), + dict(num_class=2, class_names=['motorcycle', 'bicycle']), + dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), + ], + common_heads={ + 'reg': (2, 2), + 'height': (1, 2), + 'dim': (3, 2), + 'rot': (2, 2), + 'vel': (2, 2) + }, + share_conv_channel=64, + bbox_coder=dict( + type='CenterPointBBoxCoder', + post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_num=500, + score_threshold=0.1, + pc_range=[-51.2, -51.2], + out_size_factor=4, + voxel_size=voxel_size[:2], + code_size=9), + dcn_head=True, + loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) +# model training and testing settings +train_cfg = dict( + pts=dict( + grid_size=[512, 512, 1], + point_cloud_range=[-51.2, -51.2, -5., 51.2, 51.2, 3.], + voxel_size=voxel_size, + out_size_factor=4, + dense_reg=1, + gaussian_overlap=0.1, + max_objs=500, + min_radius=2, + no_log=False, + code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0])) +test_cfg = dict( + pts=dict( + post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_per_img=500, + max_pool_nms=False, + min_radius=[4, 12, 10, 1, 0.85, 0.175], + post_max_size=83, + score_threshold=0.1, + pc_range=[-51.2, -51.2], + out_size_factor=4, + voxel_size=voxel_size[:2], + nms_type='circle', + no_log=False)) diff --git a/configs/centerpoint/centerpoint_pp.py b/configs/centerpoint/centerpoint_pp.py new file mode 100644 index 0000000000..816702a372 --- /dev/null +++ b/configs/centerpoint/centerpoint_pp.py @@ -0,0 +1,179 @@ +_base_ = ['../_base_/models/centerpoint_pp.py', '../_base_/default_runtime.py'] + +# If point cloud range is changed, the models should also change their point +# cloud range accordingly +point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] +# For nuScenes we usually do 10-class detection +class_names = [ + 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', + 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' +] +dataset_type = 'NuScenesDataset' +data_root = 'data/nuscenes/' +# Input modality for nuScenes dataset, this is consistent with the submission +# format which requires the information in input_modality. +input_modality = dict( + use_lidar=True, + use_camera=False, + use_radar=False, + use_map=False, + use_external=False) +file_client_args = dict(backend='disk') + +db_sampler = dict( + data_root=data_root, + info_path=data_root + 'nuscenes_dbinfos_train.pkl', + rate=1.0, + prepare=dict( + filter_by_difficulty=[-1], + filter_by_min_points=dict( + car=5, + truck=5, + bus=5, + trailer=5, + construction_vehicle=5, + traffic_cone=5, + barrier=5, + motorcycle=5, + bicycle=5, + pedestrian=5, + )), + classes=class_names, + sample_groups=dict( + car=2, + truck=3, + construction_vehicle=7, + bus=4, + trailer=6, + barrier=2, + motorcycle=6, + bicycle=6, + pedestrian=2, + traffic_cone=2, + ), + load_dim=5, + use_dim=[0, 1, 2, 3, 4]) + +train_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), + dict(type='ObjectSample', db_sampler=db_sampler), + dict( + type='GlobalRotScaleTrans', + rot_range=[-0.3925, 0.3925], + scale_ratio_range=[0.95, 1.05], + translation_std=[0, 0, 0]), + dict( + type='RandomFlip3D', + sync_2d=False, + flip_ratio_bev_horizontal=0.5, + flip_ratio_bev_vertical=0.5), + dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectNameFilter', classes=class_names), + dict(type='PointShuffle'), + dict(type='DefaultFormatBundle3D', class_names=class_names), + dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) +] +test_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict( + type='MultiScaleFlipAug3D', + img_scale=(1333, 800), + pts_scale_ratio=1, + flip=False, + transforms=[ + dict( + type='GlobalRotScaleTrans', + rot_range=[0, 0], + scale_ratio_range=[1., 1.], + translation_std=[0, 0, 0]), + dict(type='RandomFlip3D'), + dict( + type='DefaultFormatBundle3D', + class_names=class_names, + with_label=False), + dict(type='Collect3D', keys=['points']) + ]) +] + +data = dict( + samples_per_gpu=4, + workers_per_gpu=4, + train=dict( + type='CBGSDataset', + dataset=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_train.pkl', + pipeline=train_pipeline, + classes=class_names, + modality=input_modality, + test_mode=False, + use_valid_flag=True, + # 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')), + val=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR'), + test=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR')) +# For nuScenes dataset, we usually evaluate the model at the end of training. +# Since the models are trained by 24 epochs by default, we set evaluation +# interval to be 24. Please change the interval accordingly if you do not +# use a default schedule. + +optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) +# max_norm=10 is better for SECOND +optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) +lr_config = dict( + policy='cyclic', + target_ratio=(10, 1e-4), + cyclic_times=1, + step_ratio_up=0.4, +) +momentum_config = dict( + policy='cyclic', + target_ratio=(0.85 / 0.95, 1), + cyclic_times=1, + step_ratio_up=0.4, +) + +# runtime settings +total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_pp_circle_nms.py b/configs/centerpoint/centerpoint_pp_circle_nms.py new file mode 100644 index 0000000000..4d02805358 --- /dev/null +++ b/configs/centerpoint/centerpoint_pp_circle_nms.py @@ -0,0 +1,182 @@ +_base_ = [ + '../_base_/models/centerpoint_pp_circle_nms.py', + '../_base_/default_runtime.py' +] + +# If point cloud range is changed, the models should also change their point +# cloud range accordingly +point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] +# For nuScenes we usually do 10-class detection +class_names = [ + 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', + 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' +] +dataset_type = 'NuScenesDataset' +data_root = 'data/nuscenes/' +# Input modality for nuScenes dataset, this is consistent with the submission +# format which requires the information in input_modality. +input_modality = dict( + use_lidar=True, + use_camera=False, + use_radar=False, + use_map=False, + use_external=False) +file_client_args = dict(backend='disk') + +db_sampler = dict( + data_root=data_root, + info_path=data_root + 'nuscenes_dbinfos_train.pkl', + rate=1.0, + prepare=dict( + filter_by_difficulty=[-1], + filter_by_min_points=dict( + car=5, + truck=5, + bus=5, + trailer=5, + construction_vehicle=5, + traffic_cone=5, + barrier=5, + motorcycle=5, + bicycle=5, + pedestrian=5, + )), + classes=class_names, + sample_groups=dict( + car=2, + truck=3, + construction_vehicle=7, + bus=4, + trailer=6, + barrier=2, + motorcycle=6, + bicycle=6, + pedestrian=2, + traffic_cone=2, + ), + load_dim=5, + use_dim=[0, 1, 2, 3, 4]) + +train_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), + dict(type='ObjectSample', db_sampler=db_sampler), + dict( + type='GlobalRotScaleTrans', + rot_range=[-0.3925, 0.3925], + scale_ratio_range=[0.95, 1.05], + translation_std=[0, 0, 0]), + dict( + type='RandomFlip3D', + sync_2d=False, + flip_ratio_bev_horizontal=0.5, + flip_ratio_bev_vertical=0.5), + dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectNameFilter', classes=class_names), + dict(type='PointShuffle'), + dict(type='DefaultFormatBundle3D', class_names=class_names), + dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) +] +test_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict( + type='MultiScaleFlipAug3D', + img_scale=(1333, 800), + pts_scale_ratio=1, + flip=False, + transforms=[ + dict( + type='GlobalRotScaleTrans', + rot_range=[0, 0], + scale_ratio_range=[1., 1.], + translation_std=[0, 0, 0]), + dict(type='RandomFlip3D'), + dict( + type='DefaultFormatBundle3D', + class_names=class_names, + with_label=False), + dict(type='Collect3D', keys=['points']) + ]) +] + +data = dict( + samples_per_gpu=4, + workers_per_gpu=4, + train=dict( + type='CBGSDataset', + dataset=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_train.pkl', + pipeline=train_pipeline, + classes=class_names, + modality=input_modality, + test_mode=False, + use_valid_flag=True, + # 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')), + val=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR'), + test=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR')) +# For nuScenes dataset, we usually evaluate the model at the end of training. +# Since the models are trained by 24 epochs by default, we set evaluation +# interval to be 24. Please change the interval accordingly if you do not +# use a default schedule. + +optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) +# max_norm=10 is better for SECOND +optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) +lr_config = dict( + policy='cyclic', + target_ratio=(10, 1e-4), + cyclic_times=1, + step_ratio_up=0.4, +) +momentum_config = dict( + policy='cyclic', + target_ratio=(0.85 / 0.95, 1), + cyclic_times=1, + step_ratio_up=0.4, +) + +# runtime settings +total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_pp_dcn.py b/configs/centerpoint/centerpoint_pp_dcn.py new file mode 100644 index 0000000000..4ba1e159e4 --- /dev/null +++ b/configs/centerpoint/centerpoint_pp_dcn.py @@ -0,0 +1,181 @@ +_base_ = [ + '../_base_/models/centerpoint_pp_dcn.py', '../_base_/default_runtime.py' +] + +# If point cloud range is changed, the models should also change their point +# cloud range accordingly +point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] +# For nuScenes we usually do 10-class detection +class_names = [ + 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', + 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' +] +dataset_type = 'NuScenesDataset' +data_root = 'data/nuscenes/' +# Input modality for nuScenes dataset, this is consistent with the submission +# format which requires the information in input_modality. +input_modality = dict( + use_lidar=True, + use_camera=False, + use_radar=False, + use_map=False, + use_external=False) +file_client_args = dict(backend='disk') + +db_sampler = dict( + data_root=data_root, + info_path=data_root + 'nuscenes_dbinfos_train.pkl', + rate=1.0, + prepare=dict( + filter_by_difficulty=[-1], + filter_by_min_points=dict( + car=5, + truck=5, + bus=5, + trailer=5, + construction_vehicle=5, + traffic_cone=5, + barrier=5, + motorcycle=5, + bicycle=5, + pedestrian=5, + )), + classes=class_names, + sample_groups=dict( + car=2, + truck=3, + construction_vehicle=7, + bus=4, + trailer=6, + barrier=2, + motorcycle=6, + bicycle=6, + pedestrian=2, + traffic_cone=2, + ), + load_dim=5, + use_dim=[0, 1, 2, 3, 4]) + +train_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), + # dict(type='ObjectSample', db_sampler=db_sampler), + dict( + type='GlobalRotScaleTrans', + rot_range=[-0.3925, 0.3925], + scale_ratio_range=[0.95, 1.05], + translation_std=[0, 0, 0]), + dict( + type='RandomFlip3D', + sync_2d=False, + flip_ratio_bev_horizontal=0.5, + flip_ratio_bev_vertical=0.5), + dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectNameFilter', classes=class_names), + dict(type='PointShuffle'), + dict(type='DefaultFormatBundle3D', class_names=class_names), + dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) +] +test_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict( + type='MultiScaleFlipAug3D', + img_scale=(1333, 800), + pts_scale_ratio=1, + flip=False, + transforms=[ + dict( + type='GlobalRotScaleTrans', + rot_range=[0, 0], + scale_ratio_range=[1., 1.], + translation_std=[0, 0, 0]), + dict(type='RandomFlip3D'), + dict( + type='DefaultFormatBundle3D', + class_names=class_names, + with_label=False), + dict(type='Collect3D', keys=['points']) + ]) +] + +data = dict( + samples_per_gpu=4, + workers_per_gpu=4, + train=dict( + type='CBGSDataset', + dataset=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_train.pkl', + pipeline=train_pipeline, + classes=class_names, + modality=input_modality, + test_mode=False, + use_valid_flag=True, + # 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')), + val=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR'), + test=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR')) +# For nuScenes dataset, we usually evaluate the model at the end of training. +# Since the models are trained by 24 epochs by default, we set evaluation +# interval to be 24. Please change the interval accordingly if you do not +# use a default schedule. + +optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) +# max_norm=10 is better for SECOND +optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) +lr_config = dict( + policy='cyclic', + target_ratio=(10, 1e-4), + cyclic_times=1, + step_ratio_up=0.4, +) +momentum_config = dict( + policy='cyclic', + target_ratio=(0.85 / 0.95, 1), + cyclic_times=1, + step_ratio_up=0.4, +) + +# runtime settings +total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_pp_dcn_circle_nms.py b/configs/centerpoint/centerpoint_pp_dcn_circle_nms.py new file mode 100644 index 0000000000..2d595aa24e --- /dev/null +++ b/configs/centerpoint/centerpoint_pp_dcn_circle_nms.py @@ -0,0 +1,182 @@ +_base_ = [ + '../_base_/models/centerpoint_pp_dcn_circle_nms.py', + '../_base_/default_runtime.py' +] + +# If point cloud range is changed, the models should also change their point +# cloud range accordingly +point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] +# For nuScenes we usually do 10-class detection +class_names = [ + 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', + 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' +] +dataset_type = 'NuScenesDataset' +data_root = 'data/nuscenes/' +# Input modality for nuScenes dataset, this is consistent with the submission +# format which requires the information in input_modality. +input_modality = dict( + use_lidar=True, + use_camera=False, + use_radar=False, + use_map=False, + use_external=False) +file_client_args = dict(backend='disk') + +db_sampler = dict( + data_root=data_root, + info_path=data_root + 'nuscenes_dbinfos_train.pkl', + rate=1.0, + prepare=dict( + filter_by_difficulty=[-1], + filter_by_min_points=dict( + car=5, + truck=5, + bus=5, + trailer=5, + construction_vehicle=5, + traffic_cone=5, + barrier=5, + motorcycle=5, + bicycle=5, + pedestrian=5, + )), + classes=class_names, + sample_groups=dict( + car=2, + truck=3, + construction_vehicle=7, + bus=4, + trailer=6, + barrier=2, + motorcycle=6, + bicycle=6, + pedestrian=2, + traffic_cone=2, + ), + load_dim=5, + use_dim=[0, 1, 2, 3, 4]) + +train_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), + dict(type='ObjectSample', db_sampler=db_sampler), + dict( + type='GlobalRotScaleTrans', + rot_range=[-0.3925, 0.3925], + scale_ratio_range=[0.95, 1.05], + translation_std=[0, 0, 0]), + dict( + type='RandomFlip3D', + sync_2d=False, + flip_ratio_bev_horizontal=0.5, + flip_ratio_bev_vertical=0.5), + dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectNameFilter', classes=class_names), + dict(type='PointShuffle'), + dict(type='DefaultFormatBundle3D', class_names=class_names), + dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) +] +test_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict( + type='MultiScaleFlipAug3D', + img_scale=(1333, 800), + pts_scale_ratio=1, + flip=False, + transforms=[ + dict( + type='GlobalRotScaleTrans', + rot_range=[0, 0], + scale_ratio_range=[1., 1.], + translation_std=[0, 0, 0]), + dict(type='RandomFlip3D'), + dict( + type='DefaultFormatBundle3D', + class_names=class_names, + with_label=False), + dict(type='Collect3D', keys=['points']) + ]) +] + +data = dict( + samples_per_gpu=4, + workers_per_gpu=4, + train=dict( + type='CBGSDataset', + dataset=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_train.pkl', + pipeline=train_pipeline, + classes=class_names, + modality=input_modality, + test_mode=False, + use_valid_flag=True, + # 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')), + val=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR'), + test=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR')) +# For nuScenes dataset, we usually evaluate the model at the end of training. +# Since the models are trained by 24 epochs by default, we set evaluation +# interval to be 24. Please change the interval accordingly if you do not +# use a default schedule. + +optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) +# max_norm=10 is better for SECOND +optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) +lr_config = dict( + policy='cyclic', + target_ratio=(10, 1e-4), + cyclic_times=1, + step_ratio_up=0.4, +) +momentum_config = dict( + policy='cyclic', + target_ratio=(0.85 / 0.95, 1), + cyclic_times=1, + step_ratio_up=0.4, +) + +# runtime settings +total_epochs = 20 From 35f508a7992b650e37bb25babd36a723173a042b Mon Sep 17 00:00:00 2001 From: liyinhao Date: Mon, 7 Sep 2020 17:39:54 +0800 Subject: [PATCH 02/21] Add 0075 voxel configs. --- ...y => centerpoint_0075_voxel_circle_nms.py} | 68 ++++--- .../centerpoint_0075_voxel_dcn_circle_nms.py | 94 +++++++++ .../centerpoint_0075_voxel_circle_nms.py | 185 ++++++++++++++++++ .../centerpoint_0075_voxel_dcn_circle_nms.py | 185 ++++++++++++++++++ 4 files changed, 497 insertions(+), 35 deletions(-) rename configs/_base_/models/{centerpoint_pp.py => centerpoint_0075_voxel_circle_nms.py} (64%) create mode 100644 configs/_base_/models/centerpoint_0075_voxel_dcn_circle_nms.py create mode 100644 configs/centerpoint/centerpoint_0075_voxel_circle_nms.py create mode 100644 configs/centerpoint/centerpoint_0075_voxel_dcn_circle_nms.py diff --git a/configs/_base_/models/centerpoint_pp.py b/configs/_base_/models/centerpoint_0075_voxel_circle_nms.py similarity index 64% rename from configs/_base_/models/centerpoint_pp.py rename to configs/_base_/models/centerpoint_0075_voxel_circle_nms.py index 82113498e9..bdc82b47a8 100644 --- a/configs/_base_/models/centerpoint_pp.py +++ b/configs/_base_/models/centerpoint_0075_voxel_circle_nms.py @@ -1,42 +1,43 @@ -voxel_size = [0.2, 0.2, 8] +voxel_size = [0.075, 0.075, 0.2] +point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] model = dict( type='CenterPoint', pts_voxel_layer=dict( - max_num_points=20, - point_cloud_range=[-51.2, -51.2, -5.0, 51.2, 51.2, 3.0], + max_num_points=10, + point_cloud_range=point_cloud_range, voxel_size=voxel_size, - max_voxels=(30000, 40000)), - pts_voxel_encoder=dict( - type='PillarFeatureNet', - in_channels=5, - feat_channels=[64], - with_distance=False, - voxel_size=(0.2, 0.2, 8), - point_cloud_range=(-51.2, -51.2, -5.0, 51.2, 51.2, 3.0), - norm_cfg=dict(type='BN1d', eps=1e-3, momentum=0.01), - legacy=False), + max_voxels=(90000, 120000)), + pts_voxel_encoder=dict(type='HardSimpleVFE', num_features=5), pts_middle_encoder=dict( - type='PointPillarsScatter', in_channels=64, output_shape=(512, 512)), + type='SparseEncoder', + in_channels=5, + sparse_shape=[41, 1440, 1440], + output_channels=128, + order=('conv', 'norm', 'act'), + encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, + 128)), + encoder_paddings=((0, 0, 1), (0, 0, 1), (0, 0, [0, 1, 1]), (0, 0)), + block_type='basicblock'), pts_backbone=dict( type='SECOND', - in_channels=64, - out_channels=[64, 128, 256], - layer_nums=[3, 5, 5], - layer_strides=[2, 2, 2], + in_channels=256, + out_channels=[128, 256], + layer_nums=[5, 5], + layer_strides=[1, 2], norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), conv_cfg=dict(type='Conv2d', bias=False)), pts_neck=dict( type='SECONDFPN', - in_channels=[64, 128, 256], - out_channels=[128, 128, 128], - upsample_strides=[0.5, 1, 2], + in_channels=[128, 256], + out_channels=[256, 256], + upsample_strides=[1, 2], norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), upsample_cfg=dict(type='deconv', bias=False), use_conv_for_no_stride=True), pts_bbox_head=dict( type='CenterHead', mode='3d', - in_channels=sum([128, 128, 128]), + in_channels=sum([256, 256]), tasks=[ dict(num_class=1, class_names=['car']), dict(num_class=2, class_names=['truck', 'construction_vehicle']), @@ -58,8 +59,8 @@ post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], max_num=500, score_threshold=0.1, - pc_range=[-51.2, -51.2], - out_size_factor=4, + pc_range=point_cloud_range[:2], + out_size_factor=8, voxel_size=voxel_size[:2], code_size=9), dcn_head=False, @@ -68,16 +69,16 @@ # model training and testing settings train_cfg = dict( pts=dict( - grid_size=[512, 512, 1], - point_cloud_range=[-51.2, -51.2, -5., 51.2, 51.2, 3.], + grid_size=[1440, 1440, 40], + point_cloud_range=point_cloud_range, voxel_size=voxel_size, - out_size_factor=4, + out_size_factor=8, dense_reg=1, gaussian_overlap=0.1, max_objs=500, min_radius=2, - no_log=False, - code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0])) + code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0], + no_log=False)) test_cfg = dict( pts=dict( post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], @@ -86,11 +87,8 @@ min_radius=[4, 12, 10, 1, 0.85, 0.175], post_max_size=83, score_threshold=0.1, - pc_range=[-51.2, -51.2], - out_size_factor=4, + pc_range=point_cloud_range[:2], + out_size_factor=8, voxel_size=voxel_size[:2], - nms_type='rotate', - nms_pre_max_size=1000, - nms_post_max_size=83, - nms_iou_threshold=0.2, + nms_type='circle', no_log=False)) diff --git a/configs/_base_/models/centerpoint_0075_voxel_dcn_circle_nms.py b/configs/_base_/models/centerpoint_0075_voxel_dcn_circle_nms.py new file mode 100644 index 0000000000..cb20166e21 --- /dev/null +++ b/configs/_base_/models/centerpoint_0075_voxel_dcn_circle_nms.py @@ -0,0 +1,94 @@ +voxel_size = [0.075, 0.075, 0.2] +point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] +model = dict( + type='CenterPoint', + pts_voxel_layer=dict( + max_num_points=10, + point_cloud_range=point_cloud_range, + voxel_size=voxel_size, + max_voxels=(90000, 120000)), + pts_voxel_encoder=dict(type='HardSimpleVFE', num_features=5), + pts_middle_encoder=dict( + type='SparseEncoder', + in_channels=5, + sparse_shape=[41, 1440, 1440], + output_channels=128, + order=('conv', 'norm', 'act'), + encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, + 128)), + encoder_paddings=((0, 0, 1), (0, 0, 1), (0, 0, [0, 1, 1]), (0, 0)), + block_type='basicblock'), + pts_backbone=dict( + type='SECOND', + in_channels=256, + out_channels=[128, 256], + layer_nums=[5, 5], + layer_strides=[1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + conv_cfg=dict(type='Conv2d', bias=False)), + pts_neck=dict( + type='SECONDFPN', + in_channels=[128, 256], + out_channels=[256, 256], + upsample_strides=[1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + upsample_cfg=dict(type='deconv', bias=False), + use_conv_for_no_stride=True), + pts_bbox_head=dict( + type='CenterHead', + mode='3d', + in_channels=sum([256, 256]), + tasks=[ + dict(num_class=1, class_names=['car']), + dict(num_class=2, class_names=['truck', 'construction_vehicle']), + dict(num_class=2, class_names=['bus', 'trailer']), + dict(num_class=1, class_names=['barrier']), + dict(num_class=2, class_names=['motorcycle', 'bicycle']), + dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), + ], + common_heads={ + 'reg': (2, 2), + 'height': (1, 2), + 'dim': (3, 2), + 'rot': (2, 2), + 'vel': (2, 2) + }, + share_conv_channel=64, + bbox_coder=dict( + type='CenterPointBBoxCoder', + post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_num=500, + score_threshold=0.1, + pc_range=point_cloud_range[:2], + out_size_factor=8, + voxel_size=voxel_size[:2], + code_size=9), + dcn_head=True, + loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) +# model training and testing settings +train_cfg = dict( + pts=dict( + grid_size=[1440, 1440, 40], + point_cloud_range=point_cloud_range, + voxel_size=voxel_size, + out_size_factor=8, + dense_reg=1, + gaussian_overlap=0.1, + max_objs=500, + min_radius=2, + code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0], + no_log=False)) +test_cfg = dict( + pts=dict( + post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_per_img=500, + max_pool_nms=False, + min_radius=[4, 12, 10, 1, 0.85, 0.175], + post_max_size=83, + score_threshold=0.1, + pc_range=point_cloud_range[:2], + out_size_factor=8, + voxel_size=voxel_size[:2], + nms_type='circle', + no_log=False)) diff --git a/configs/centerpoint/centerpoint_0075_voxel_circle_nms.py b/configs/centerpoint/centerpoint_0075_voxel_circle_nms.py new file mode 100644 index 0000000000..2c3792f3db --- /dev/null +++ b/configs/centerpoint/centerpoint_0075_voxel_circle_nms.py @@ -0,0 +1,185 @@ +_base_ = [ + '../_base_/models/centerpoint_0075_voxel_circle_nms.py', + '../_base_/default_runtime.py' +] + +# If point cloud range is changed, the models should also change their point +# cloud range accordingly +point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] +# For nuScenes we usually do 10-class detection +class_names = [ + 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', + 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' +] +dataset_type = 'NuScenesDataset' +data_root = 'data/nuscenes/' +# Input modality for nuScenes dataset, this is consistent with the submission +# format which requires the information in input_modality. +input_modality = dict( + use_lidar=True, + use_camera=False, + use_radar=False, + use_map=False, + use_external=False) +file_client_args = dict(backend='disk') + +db_sampler = dict( + data_root=data_root, + info_path=data_root + 'nuscenes_dbinfos_train.pkl', + rate=1.0, + prepare=dict( + filter_by_difficulty=[-1], + filter_by_min_points=dict( + car=5, + truck=5, + bus=5, + trailer=5, + construction_vehicle=5, + traffic_cone=5, + barrier=5, + motorcycle=5, + bicycle=5, + pedestrian=5, + )), + classes=class_names, + sample_groups=dict( + car=2, + truck=3, + construction_vehicle=7, + bus=4, + trailer=6, + barrier=2, + motorcycle=6, + bicycle=6, + pedestrian=2, + traffic_cone=2, + ), + load_dim=5, + use_dim=[0, 1, 2, 3, 4]) + +train_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), + dict(type='ObjectSample', db_sampler=db_sampler), + dict( + type='GlobalRotScaleTrans', + rot_range=[-0.3925, 0.3925], + scale_ratio_range=[0.95, 1.05], + translation_std=[0, 0, 0]), + dict( + type='RandomFlip3D', + sync_2d=False, + flip_ratio_bev_horizontal=0.5, + flip_ratio_bev_vertical=0.5), + dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectNameFilter', classes=class_names), + dict(type='PointShuffle'), + dict(type='DefaultFormatBundle3D', class_names=class_names), + dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) +] +test_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict( + type='MultiScaleFlipAug3D', + img_scale=(1333, 800), + pts_scale_ratio=1, + flip=False, + transforms=[ + dict( + type='GlobalRotScaleTrans', + rot_range=[0, 0], + scale_ratio_range=[1., 1.], + translation_std=[0, 0, 0]), + dict(type='RandomFlip3D'), + dict( + type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict( + type='DefaultFormatBundle3D', + class_names=class_names, + with_label=False), + dict(type='Collect3D', keys=['points']) + ]) +] + +data = dict( + samples_per_gpu=4, + workers_per_gpu=4, + train=dict( + type='CBGSDataset', + dataset=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_train.pkl', + pipeline=train_pipeline, + classes=class_names, + modality=input_modality, + test_mode=False, + use_valid_flag=True, + # 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')), + val=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR'), + test=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR')) +# For nuScenes dataset, we usually evaluate the model at the end of training. +# Since the models are trained by 24 epochs by default, we set evaluation +# interval to be 24. Please change the interval accordingly if you do not +# use a default schedule. +# optimizer +# This schedule is mainly used by models on nuScenes dataset +optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) +# max_norm=10 is better for SECOND +optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) +lr_config = dict( + policy='cyclic', + target_ratio=(10, 1e-4), + cyclic_times=1, + step_ratio_up=0.4, +) +momentum_config = dict( + policy='cyclic', + target_ratio=(0.85 / 0.95, 1), + cyclic_times=1, + step_ratio_up=0.4, +) + +# runtime settings +total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_0075_voxel_dcn_circle_nms.py b/configs/centerpoint/centerpoint_0075_voxel_dcn_circle_nms.py new file mode 100644 index 0000000000..5a252b847f --- /dev/null +++ b/configs/centerpoint/centerpoint_0075_voxel_dcn_circle_nms.py @@ -0,0 +1,185 @@ +_base_ = [ + '../_base_/models/centerpoint_0075_voxel_dcn_circle_nms.py', + '../_base_/default_runtime.py' +] + +# If point cloud range is changed, the models should also change their point +# cloud range accordingly +point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] +# For nuScenes we usually do 10-class detection +class_names = [ + 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', + 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' +] +dataset_type = 'NuScenesDataset' +data_root = 'data/nuscenes/' +# Input modality for nuScenes dataset, this is consistent with the submission +# format which requires the information in input_modality. +input_modality = dict( + use_lidar=True, + use_camera=False, + use_radar=False, + use_map=False, + use_external=False) +file_client_args = dict(backend='disk') + +db_sampler = dict( + data_root=data_root, + info_path=data_root + 'nuscenes_dbinfos_train.pkl', + rate=1.0, + prepare=dict( + filter_by_difficulty=[-1], + filter_by_min_points=dict( + car=5, + truck=5, + bus=5, + trailer=5, + construction_vehicle=5, + traffic_cone=5, + barrier=5, + motorcycle=5, + bicycle=5, + pedestrian=5, + )), + classes=class_names, + sample_groups=dict( + car=2, + truck=3, + construction_vehicle=7, + bus=4, + trailer=6, + barrier=2, + motorcycle=6, + bicycle=6, + pedestrian=2, + traffic_cone=2, + ), + load_dim=5, + use_dim=[0, 1, 2, 3, 4]) + +train_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), + dict(type='ObjectSample', db_sampler=db_sampler), + dict( + type='GlobalRotScaleTrans', + rot_range=[-0.3925, 0.3925], + scale_ratio_range=[0.95, 1.05], + translation_std=[0, 0, 0]), + dict( + type='RandomFlip3D', + sync_2d=False, + flip_ratio_bev_horizontal=0.5, + flip_ratio_bev_vertical=0.5), + dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectNameFilter', classes=class_names), + dict(type='PointShuffle'), + dict(type='DefaultFormatBundle3D', class_names=class_names), + dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) +] +test_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict( + type='MultiScaleFlipAug3D', + img_scale=(1333, 800), + pts_scale_ratio=1, + flip=False, + transforms=[ + dict( + type='GlobalRotScaleTrans', + rot_range=[0, 0], + scale_ratio_range=[1., 1.], + translation_std=[0, 0, 0]), + dict(type='RandomFlip3D'), + dict( + type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict( + type='DefaultFormatBundle3D', + class_names=class_names, + with_label=False), + dict(type='Collect3D', keys=['points']) + ]) +] + +data = dict( + samples_per_gpu=4, + workers_per_gpu=4, + train=dict( + type='CBGSDataset', + dataset=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_train.pkl', + pipeline=train_pipeline, + classes=class_names, + modality=input_modality, + test_mode=False, + use_valid_flag=True, + # 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')), + val=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR'), + test=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR')) +# For nuScenes dataset, we usually evaluate the model at the end of training. +# Since the models are trained by 24 epochs by default, we set evaluation +# interval to be 24. Please change the interval accordingly if you do not +# use a default schedule. +# optimizer +# This schedule is mainly used by models on nuScenes dataset +optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) +# max_norm=10 is better for SECOND +optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) +lr_config = dict( + policy='cyclic', + target_ratio=(10, 1e-4), + cyclic_times=1, + step_ratio_up=0.4, +) +momentum_config = dict( + policy='cyclic', + target_ratio=(0.85 / 0.95, 1), + cyclic_times=1, + step_ratio_up=0.4, +) + +# runtime settings +total_epochs = 20 From a0ccdf68a20807a83eea9115c48e5dd8414d14ef Mon Sep 17 00:00:00 2001 From: liyinhao Date: Mon, 7 Sep 2020 21:50:02 +0800 Subject: [PATCH 03/21] Add configs, change to pipeline. --- .../_base_/models/centerpoint_0075_voxel.py | 97 +++++++++ .../models/centerpoint_0075_voxel_dcn.py | 97 +++++++++ configs/_base_/models/centerpoint_pp.py | 96 +++++++++ configs/centerpoint/centerpoint_0075_voxel.py | 188 ++++++++++++++++++ .../centerpoint_0075_voxel_circle_nms.py | 7 +- .../centerpoint/centerpoint_0075_voxel_dcn.py | 188 ++++++++++++++++++ .../centerpoint_0075_voxel_dcn_circle_nms.py | 7 +- configs/centerpoint/centerpoint_pp.py | 7 +- .../centerpoint/centerpoint_pp_circle_nms.py | 7 +- 9 files changed, 686 insertions(+), 8 deletions(-) create mode 100644 configs/_base_/models/centerpoint_0075_voxel.py create mode 100644 configs/_base_/models/centerpoint_0075_voxel_dcn.py create mode 100644 configs/_base_/models/centerpoint_pp.py create mode 100644 configs/centerpoint/centerpoint_0075_voxel.py create mode 100644 configs/centerpoint/centerpoint_0075_voxel_dcn.py diff --git a/configs/_base_/models/centerpoint_0075_voxel.py b/configs/_base_/models/centerpoint_0075_voxel.py new file mode 100644 index 0000000000..bcde14715c --- /dev/null +++ b/configs/_base_/models/centerpoint_0075_voxel.py @@ -0,0 +1,97 @@ +voxel_size = [0.075, 0.075, 0.2] +point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] +model = dict( + type='CenterPoint', + pts_voxel_layer=dict( + max_num_points=10, + point_cloud_range=point_cloud_range, + voxel_size=voxel_size, + max_voxels=(90000, 120000)), + pts_voxel_encoder=dict(type='HardSimpleVFE', num_features=5), + pts_middle_encoder=dict( + type='SparseEncoder', + in_channels=5, + sparse_shape=[41, 1440, 1440], + output_channels=128, + order=('conv', 'norm', 'act'), + encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, + 128)), + encoder_paddings=((0, 0, 1), (0, 0, 1), (0, 0, [0, 1, 1]), (0, 0)), + block_type='basicblock'), + pts_backbone=dict( + type='SECOND', + in_channels=256, + out_channels=[128, 256], + layer_nums=[5, 5], + layer_strides=[1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + conv_cfg=dict(type='Conv2d', bias=False)), + pts_neck=dict( + type='SECONDFPN', + in_channels=[128, 256], + out_channels=[256, 256], + upsample_strides=[1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + upsample_cfg=dict(type='deconv', bias=False), + use_conv_for_no_stride=True), + pts_bbox_head=dict( + type='CenterHead', + mode='3d', + in_channels=sum([256, 256]), + tasks=[ + dict(num_class=1, class_names=['car']), + dict(num_class=2, class_names=['truck', 'construction_vehicle']), + dict(num_class=2, class_names=['bus', 'trailer']), + dict(num_class=1, class_names=['barrier']), + dict(num_class=2, class_names=['motorcycle', 'bicycle']), + dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), + ], + common_heads={ + 'reg': (2, 2), + 'height': (1, 2), + 'dim': (3, 2), + 'rot': (2, 2), + 'vel': (2, 2) + }, + share_conv_channel=64, + bbox_coder=dict( + type='CenterPointBBoxCoder', + post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_num=500, + score_threshold=0.1, + pc_range=point_cloud_range[:2], + out_size_factor=8, + voxel_size=voxel_size[:2], + code_size=9), + dcn_head=False, + loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) +# model training and testing settings +train_cfg = dict( + pts=dict( + grid_size=[1440, 1440, 40], + point_cloud_range=point_cloud_range, + voxel_size=voxel_size, + out_size_factor=8, + dense_reg=1, + gaussian_overlap=0.1, + max_objs=500, + min_radius=2, + code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0], + no_log=False)) +test_cfg = dict( + pts=dict( + post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_per_img=500, + max_pool_nms=False, + min_radius=[4, 12, 10, 1, 0.85, 0.175], + post_max_size=83, + score_threshold=0.1, + pc_range=point_cloud_range[:2], + out_size_factor=8, + voxel_size=voxel_size[:2], + nms_type='rotate', + nms_pre_max_size=1000, + nms_post_max_size=83, + nms_iou_threshold=0.2, + no_log=False)) diff --git a/configs/_base_/models/centerpoint_0075_voxel_dcn.py b/configs/_base_/models/centerpoint_0075_voxel_dcn.py new file mode 100644 index 0000000000..0bd90ff521 --- /dev/null +++ b/configs/_base_/models/centerpoint_0075_voxel_dcn.py @@ -0,0 +1,97 @@ +voxel_size = [0.075, 0.075, 0.2] +point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] +model = dict( + type='CenterPoint', + pts_voxel_layer=dict( + max_num_points=10, + point_cloud_range=point_cloud_range, + voxel_size=voxel_size, + max_voxels=(90000, 120000)), + pts_voxel_encoder=dict(type='HardSimpleVFE', num_features=5), + pts_middle_encoder=dict( + type='SparseEncoder', + in_channels=5, + sparse_shape=[41, 1440, 1440], + output_channels=128, + order=('conv', 'norm', 'act'), + encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, + 128)), + encoder_paddings=((0, 0, 1), (0, 0, 1), (0, 0, [0, 1, 1]), (0, 0)), + block_type='basicblock'), + pts_backbone=dict( + type='SECOND', + in_channels=256, + out_channels=[128, 256], + layer_nums=[5, 5], + layer_strides=[1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + conv_cfg=dict(type='Conv2d', bias=False)), + pts_neck=dict( + type='SECONDFPN', + in_channels=[128, 256], + out_channels=[256, 256], + upsample_strides=[1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + upsample_cfg=dict(type='deconv', bias=False), + use_conv_for_no_stride=True), + pts_bbox_head=dict( + type='CenterHead', + mode='3d', + in_channels=sum([256, 256]), + tasks=[ + dict(num_class=1, class_names=['car']), + dict(num_class=2, class_names=['truck', 'construction_vehicle']), + dict(num_class=2, class_names=['bus', 'trailer']), + dict(num_class=1, class_names=['barrier']), + dict(num_class=2, class_names=['motorcycle', 'bicycle']), + dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), + ], + common_heads={ + 'reg': (2, 2), + 'height': (1, 2), + 'dim': (3, 2), + 'rot': (2, 2), + 'vel': (2, 2) + }, + share_conv_channel=64, + bbox_coder=dict( + type='CenterPointBBoxCoder', + post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_num=500, + score_threshold=0.1, + pc_range=point_cloud_range[:2], + out_size_factor=8, + voxel_size=voxel_size[:2], + code_size=9), + dcn_head=True, + loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) +# model training and testing settings +train_cfg = dict( + pts=dict( + grid_size=[1440, 1440, 40], + point_cloud_range=point_cloud_range, + voxel_size=voxel_size, + out_size_factor=8, + dense_reg=1, + gaussian_overlap=0.1, + max_objs=500, + min_radius=2, + code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0], + no_log=False)) +test_cfg = dict( + pts=dict( + post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_per_img=500, + max_pool_nms=False, + min_radius=[4, 12, 10, 1, 0.85, 0.175], + post_max_size=83, + score_threshold=0.1, + pc_range=point_cloud_range[:2], + out_size_factor=8, + voxel_size=voxel_size[:2], + nms_type='rotate', + nms_pre_max_size=1000, + nms_post_max_size=83, + nms_iou_threshold=0.2, + no_log=False)) diff --git a/configs/_base_/models/centerpoint_pp.py b/configs/_base_/models/centerpoint_pp.py new file mode 100644 index 0000000000..82113498e9 --- /dev/null +++ b/configs/_base_/models/centerpoint_pp.py @@ -0,0 +1,96 @@ +voxel_size = [0.2, 0.2, 8] +model = dict( + type='CenterPoint', + pts_voxel_layer=dict( + max_num_points=20, + point_cloud_range=[-51.2, -51.2, -5.0, 51.2, 51.2, 3.0], + voxel_size=voxel_size, + max_voxels=(30000, 40000)), + pts_voxel_encoder=dict( + type='PillarFeatureNet', + in_channels=5, + feat_channels=[64], + with_distance=False, + voxel_size=(0.2, 0.2, 8), + point_cloud_range=(-51.2, -51.2, -5.0, 51.2, 51.2, 3.0), + norm_cfg=dict(type='BN1d', eps=1e-3, momentum=0.01), + legacy=False), + pts_middle_encoder=dict( + type='PointPillarsScatter', in_channels=64, output_shape=(512, 512)), + pts_backbone=dict( + type='SECOND', + in_channels=64, + out_channels=[64, 128, 256], + layer_nums=[3, 5, 5], + layer_strides=[2, 2, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + conv_cfg=dict(type='Conv2d', bias=False)), + pts_neck=dict( + type='SECONDFPN', + in_channels=[64, 128, 256], + out_channels=[128, 128, 128], + upsample_strides=[0.5, 1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + upsample_cfg=dict(type='deconv', bias=False), + use_conv_for_no_stride=True), + pts_bbox_head=dict( + type='CenterHead', + mode='3d', + in_channels=sum([128, 128, 128]), + tasks=[ + dict(num_class=1, class_names=['car']), + dict(num_class=2, class_names=['truck', 'construction_vehicle']), + dict(num_class=2, class_names=['bus', 'trailer']), + dict(num_class=1, class_names=['barrier']), + dict(num_class=2, class_names=['motorcycle', 'bicycle']), + dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), + ], + common_heads={ + 'reg': (2, 2), + 'height': (1, 2), + 'dim': (3, 2), + 'rot': (2, 2), + 'vel': (2, 2) + }, + share_conv_channel=64, + bbox_coder=dict( + type='CenterPointBBoxCoder', + post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_num=500, + score_threshold=0.1, + pc_range=[-51.2, -51.2], + out_size_factor=4, + voxel_size=voxel_size[:2], + code_size=9), + dcn_head=False, + loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) +# model training and testing settings +train_cfg = dict( + pts=dict( + grid_size=[512, 512, 1], + point_cloud_range=[-51.2, -51.2, -5., 51.2, 51.2, 3.], + voxel_size=voxel_size, + out_size_factor=4, + dense_reg=1, + gaussian_overlap=0.1, + max_objs=500, + min_radius=2, + no_log=False, + code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0])) +test_cfg = dict( + pts=dict( + post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_per_img=500, + max_pool_nms=False, + min_radius=[4, 12, 10, 1, 0.85, 0.175], + post_max_size=83, + score_threshold=0.1, + pc_range=[-51.2, -51.2], + out_size_factor=4, + voxel_size=voxel_size[:2], + nms_type='rotate', + nms_pre_max_size=1000, + nms_post_max_size=83, + nms_iou_threshold=0.2, + no_log=False)) diff --git a/configs/centerpoint/centerpoint_0075_voxel.py b/configs/centerpoint/centerpoint_0075_voxel.py new file mode 100644 index 0000000000..c0e40f84ab --- /dev/null +++ b/configs/centerpoint/centerpoint_0075_voxel.py @@ -0,0 +1,188 @@ +_base_ = [ + '../_base_/models/centerpoint_0075_voxel.py', + '../_base_/default_runtime.py' +] + +# If point cloud range is changed, the models should also change their point +# cloud range accordingly +point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] +# For nuScenes we usually do 10-class detection +class_names = [ + 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', + 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' +] +dataset_type = 'NuScenesDataset' +data_root = 'data/nuscenes/' +# Input modality for nuScenes dataset, this is consistent with the submission +# format which requires the information in input_modality. +input_modality = dict( + use_lidar=True, + use_camera=False, + use_radar=False, + use_map=False, + use_external=False) +file_client_args = dict(backend='disk') + +db_sampler = dict( + data_root=data_root, + info_path=data_root + 'nuscenes_dbinfos_train.pkl', + rate=1.0, + prepare=dict( + filter_by_difficulty=[-1], + filter_by_min_points=dict( + car=5, + truck=5, + bus=5, + trailer=5, + construction_vehicle=5, + traffic_cone=5, + barrier=5, + motorcycle=5, + bicycle=5, + pedestrian=5, + )), + classes=class_names, + sample_groups=dict( + car=2, + truck=3, + construction_vehicle=7, + bus=4, + trailer=6, + barrier=2, + motorcycle=6, + bicycle=6, + pedestrian=2, + traffic_cone=2, + ), + points_loader=dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args)) + +train_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), + dict(type='ObjectSample', db_sampler=db_sampler), + dict( + type='GlobalRotScaleTrans', + rot_range=[-0.3925, 0.3925], + scale_ratio_range=[0.95, 1.05], + translation_std=[0, 0, 0]), + dict( + type='RandomFlip3D', + sync_2d=False, + flip_ratio_bev_horizontal=0.5, + flip_ratio_bev_vertical=0.5), + dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectNameFilter', classes=class_names), + dict(type='PointShuffle'), + dict(type='DefaultFormatBundle3D', class_names=class_names), + dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) +] +test_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict( + type='MultiScaleFlipAug3D', + img_scale=(1333, 800), + pts_scale_ratio=1, + flip=False, + transforms=[ + dict( + type='GlobalRotScaleTrans', + rot_range=[0, 0], + scale_ratio_range=[1., 1.], + translation_std=[0, 0, 0]), + dict(type='RandomFlip3D'), + dict( + type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict( + type='DefaultFormatBundle3D', + class_names=class_names, + with_label=False), + dict(type='Collect3D', keys=['points']) + ]) +] + +data = dict( + samples_per_gpu=4, + workers_per_gpu=4, + train=dict( + type='CBGSDataset', + dataset=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_train.pkl', + pipeline=train_pipeline, + classes=class_names, + modality=input_modality, + test_mode=False, + use_valid_flag=True, + # 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')), + val=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR'), + test=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR')) +# For nuScenes dataset, we usually evaluate the model at the end of training. +# Since the models are trained by 24 epochs by default, we set evaluation +# interval to be 24. Please change the interval accordingly if you do not +# use a default schedule. +# optimizer +# This schedule is mainly used by models on nuScenes dataset +optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) +# max_norm=10 is better for SECOND +optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) +lr_config = dict( + policy='cyclic', + target_ratio=(10, 1e-4), + cyclic_times=1, + step_ratio_up=0.4, +) +momentum_config = dict( + policy='cyclic', + target_ratio=(0.85 / 0.95, 1), + cyclic_times=1, + step_ratio_up=0.4, +) + +# runtime settings +total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_0075_voxel_circle_nms.py b/configs/centerpoint/centerpoint_0075_voxel_circle_nms.py index 2c3792f3db..e8ca241e9c 100644 --- a/configs/centerpoint/centerpoint_0075_voxel_circle_nms.py +++ b/configs/centerpoint/centerpoint_0075_voxel_circle_nms.py @@ -54,8 +54,11 @@ pedestrian=2, traffic_cone=2, ), - load_dim=5, - use_dim=[0, 1, 2, 3, 4]) + points_loader=dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args)) train_pipeline = [ dict( diff --git a/configs/centerpoint/centerpoint_0075_voxel_dcn.py b/configs/centerpoint/centerpoint_0075_voxel_dcn.py new file mode 100644 index 0000000000..b81fe491b1 --- /dev/null +++ b/configs/centerpoint/centerpoint_0075_voxel_dcn.py @@ -0,0 +1,188 @@ +_base_ = [ + '../_base_/models/centerpoint_0075_voxel_dcn.py', + '../_base_/default_runtime.py' +] + +# If point cloud range is changed, the models should also change their point +# cloud range accordingly +point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] +# For nuScenes we usually do 10-class detection +class_names = [ + 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', + 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' +] +dataset_type = 'NuScenesDataset' +data_root = 'data/nuscenes/' +# Input modality for nuScenes dataset, this is consistent with the submission +# format which requires the information in input_modality. +input_modality = dict( + use_lidar=True, + use_camera=False, + use_radar=False, + use_map=False, + use_external=False) +file_client_args = dict(backend='disk') + +db_sampler = dict( + data_root=data_root, + info_path=data_root + 'nuscenes_dbinfos_train.pkl', + rate=1.0, + prepare=dict( + filter_by_difficulty=[-1], + filter_by_min_points=dict( + car=5, + truck=5, + bus=5, + trailer=5, + construction_vehicle=5, + traffic_cone=5, + barrier=5, + motorcycle=5, + bicycle=5, + pedestrian=5, + )), + classes=class_names, + sample_groups=dict( + car=2, + truck=3, + construction_vehicle=7, + bus=4, + trailer=6, + barrier=2, + motorcycle=6, + bicycle=6, + pedestrian=2, + traffic_cone=2, + ), + points_loader=dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args)) + +train_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), + dict(type='ObjectSample', db_sampler=db_sampler), + dict( + type='GlobalRotScaleTrans', + rot_range=[-0.3925, 0.3925], + scale_ratio_range=[0.95, 1.05], + translation_std=[0, 0, 0]), + dict( + type='RandomFlip3D', + sync_2d=False, + flip_ratio_bev_horizontal=0.5, + flip_ratio_bev_vertical=0.5), + dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectNameFilter', classes=class_names), + dict(type='PointShuffle'), + dict(type='DefaultFormatBundle3D', class_names=class_names), + dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) +] +test_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict( + type='MultiScaleFlipAug3D', + img_scale=(1333, 800), + pts_scale_ratio=1, + flip=False, + transforms=[ + dict( + type='GlobalRotScaleTrans', + rot_range=[0, 0], + scale_ratio_range=[1., 1.], + translation_std=[0, 0, 0]), + dict(type='RandomFlip3D'), + dict( + type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict( + type='DefaultFormatBundle3D', + class_names=class_names, + with_label=False), + dict(type='Collect3D', keys=['points']) + ]) +] + +data = dict( + samples_per_gpu=4, + workers_per_gpu=4, + train=dict( + type='CBGSDataset', + dataset=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_train.pkl', + pipeline=train_pipeline, + classes=class_names, + modality=input_modality, + test_mode=False, + use_valid_flag=True, + # 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')), + val=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR'), + test=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR')) +# For nuScenes dataset, we usually evaluate the model at the end of training. +# Since the models are trained by 24 epochs by default, we set evaluation +# interval to be 24. Please change the interval accordingly if you do not +# use a default schedule. +# optimizer +# This schedule is mainly used by models on nuScenes dataset +optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) +# max_norm=10 is better for SECOND +optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) +lr_config = dict( + policy='cyclic', + target_ratio=(10, 1e-4), + cyclic_times=1, + step_ratio_up=0.4, +) +momentum_config = dict( + policy='cyclic', + target_ratio=(0.85 / 0.95, 1), + cyclic_times=1, + step_ratio_up=0.4, +) + +# runtime settings +total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_0075_voxel_dcn_circle_nms.py b/configs/centerpoint/centerpoint_0075_voxel_dcn_circle_nms.py index 5a252b847f..92da5b2273 100644 --- a/configs/centerpoint/centerpoint_0075_voxel_dcn_circle_nms.py +++ b/configs/centerpoint/centerpoint_0075_voxel_dcn_circle_nms.py @@ -54,8 +54,11 @@ pedestrian=2, traffic_cone=2, ), - load_dim=5, - use_dim=[0, 1, 2, 3, 4]) + points_loader=dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args)) train_pipeline = [ dict( diff --git a/configs/centerpoint/centerpoint_pp.py b/configs/centerpoint/centerpoint_pp.py index 816702a372..9f2e0fc824 100644 --- a/configs/centerpoint/centerpoint_pp.py +++ b/configs/centerpoint/centerpoint_pp.py @@ -51,8 +51,11 @@ pedestrian=2, traffic_cone=2, ), - load_dim=5, - use_dim=[0, 1, 2, 3, 4]) + points_loader=dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args)) train_pipeline = [ dict( diff --git a/configs/centerpoint/centerpoint_pp_circle_nms.py b/configs/centerpoint/centerpoint_pp_circle_nms.py index 4d02805358..dabe345a4f 100644 --- a/configs/centerpoint/centerpoint_pp_circle_nms.py +++ b/configs/centerpoint/centerpoint_pp_circle_nms.py @@ -54,8 +54,11 @@ pedestrian=2, traffic_cone=2, ), - load_dim=5, - use_dim=[0, 1, 2, 3, 4]) + points_loader=dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args)) train_pipeline = [ dict( From 309760aebae0bc831c56e5e06c48237a46810ef6 Mon Sep 17 00:00:00 2001 From: liyinhao Date: Mon, 7 Sep 2020 21:53:17 +0800 Subject: [PATCH 04/21] Add centerpoint. --- mmdet3d/models/detectors/__init__.py | 4 +- mmdet3d/models/detectors/centerpoint.py | 487 ++++++++++++++++++++++++ 2 files changed, 490 insertions(+), 1 deletion(-) create mode 100644 mmdet3d/models/detectors/centerpoint.py diff --git a/mmdet3d/models/detectors/__init__.py b/mmdet3d/models/detectors/__init__.py index c0995a8b1d..58e0a10fa4 100644 --- a/mmdet3d/models/detectors/__init__.py +++ b/mmdet3d/models/detectors/__init__.py @@ -1,4 +1,5 @@ from .base import Base3DDetector +from .centerpoint import CenterPoint from .dynamic_voxelnet import DynamicVoxelNet from .h3dnet import H3DNet from .mvx_faster_rcnn import DynamicMVXFasterRCNN, MVXFasterRCNN @@ -9,5 +10,6 @@ __all__ = [ 'Base3DDetector', 'VoxelNet', 'DynamicVoxelNet', 'MVXTwoStageDetector', - 'DynamicMVXFasterRCNN', 'MVXFasterRCNN', 'PartA2', 'VoteNet', 'H3DNet' + 'DynamicMVXFasterRCNN', 'MVXFasterRCNN', 'PartA2', 'VoteNet', + 'CenterPoint', 'H3DNet' ] diff --git a/mmdet3d/models/detectors/centerpoint.py b/mmdet3d/models/detectors/centerpoint.py new file mode 100644 index 0000000000..b20fd78c1a --- /dev/null +++ b/mmdet3d/models/detectors/centerpoint.py @@ -0,0 +1,487 @@ +import mmcv +import torch +from mmcv.parallel import DataContainer as DC +from os import path as osp +from torch import nn as nn +from torch.nn import functional as F + +from mmdet3d.core import (Box3DMode, bbox3d2result, merge_aug_bboxes_3d, + show_result) +from mmdet3d.ops import Voxelization +from mmdet.core import multi_apply +from mmdet.models import DETECTORS +from .. import builder +from .base import Base3DDetector + + +@DETECTORS.register_module() +class CenterPoint(Base3DDetector): + """Base class of Multi-modality VoxelNet.""" + + def __init__(self, + pts_voxel_layer=None, + pts_voxel_encoder=None, + pts_middle_encoder=None, + pts_fusion_layer=None, + img_backbone=None, + pts_backbone=None, + img_neck=None, + pts_neck=None, + pts_bbox_head=None, + img_roi_head=None, + img_rpn_head=None, + train_cfg=None, + test_cfg=None, + pretrained=None): + super(CenterPoint, self).__init__() + + if pts_voxel_layer: + self.pts_voxel_layer = Voxelization(**pts_voxel_layer) + if pts_voxel_encoder: + self.pts_voxel_encoder = builder.build_voxel_encoder( + pts_voxel_encoder) + if pts_middle_encoder: + self.pts_middle_encoder = builder.build_middle_encoder( + pts_middle_encoder) + if pts_backbone: + self.pts_backbone = builder.build_backbone(pts_backbone) + if pts_fusion_layer: + self.pts_fusion_layer = builder.build_fusion_layer( + pts_fusion_layer) + if pts_neck is not None: + self.pts_neck = builder.build_neck(pts_neck) + if pts_bbox_head: + pts_train_cfg = train_cfg.pts if train_cfg else None + pts_bbox_head.update(train_cfg=pts_train_cfg) + pts_test_cfg = test_cfg.pts if test_cfg else None + pts_bbox_head.update(test_cfg=pts_test_cfg) + self.pts_bbox_head = builder.build_head(pts_bbox_head) + + if img_backbone: + self.img_backbone = builder.build_backbone(img_backbone) + if img_neck is not None: + self.img_neck = builder.build_neck(img_neck) + if img_rpn_head is not None: + self.img_rpn_head = builder.build_head(img_rpn_head) + if img_roi_head is not None: + self.img_roi_head = builder.build_head(img_roi_head) + + self.train_cfg = train_cfg + self.test_cfg = test_cfg + self.init_weights(pretrained=pretrained) + + def init_weights(self, pretrained=None): + """Initialize model weights.""" + super(CenterPoint, self).init_weights(pretrained) + if pretrained is None: + img_pretrained = None + pts_pretrained = None + elif isinstance(pretrained, dict): + img_pretrained = pretrained.get('img', None) + pts_pretrained = pretrained.get('pts', None) + else: + raise ValueError( + f'pretrained should be a dict, got {type(pretrained)}') + if self.with_img_backbone: + self.img_backbone.init_weights(pretrained=img_pretrained) + if self.with_pts_backbone: + self.pts_backbone.init_weights(pretrained=pts_pretrained) + if self.with_img_neck: + if isinstance(self.img_neck, nn.Sequential): + for m in self.img_neck: + m.init_weights() + else: + self.img_neck.init_weights() + + if self.with_img_roi_head: + self.img_roi_head.init_weights(img_pretrained) + if self.with_img_rpn: + self.img_rpn_head.init_weights() + if self.with_pts_bbox: + self.pts_bbox_head.init_weights() + + @property + def with_img_shared_head(self): + """bool: Whether the detector has a shared head in image branch.""" + return hasattr(self, + 'img_shared_head') and self.img_shared_head is not None + + @property + def with_pts_bbox(self): + """bool: Whether the detector has a 3D box head.""" + return hasattr(self, + 'pts_bbox_head') and self.pts_bbox_head is not None + + @property + def with_img_bbox(self): + """bool: Whether the detector has a 2D image box head.""" + return hasattr(self, + 'img_bbox_head') and self.img_bbox_head is not None + + @property + def with_img_backbone(self): + """bool: Whether the detector has a 2D image backbone.""" + return hasattr(self, 'img_backbone') and self.img_backbone is not None + + @property + def with_pts_backbone(self): + """bool: Whether the detector has a 3D backbone.""" + return hasattr(self, 'pts_backbone') and self.pts_backbone is not None + + @property + def with_fusion(self): + """bool: Whether the detector has a fusion layer.""" + return hasattr(self, + 'pts_fusion_layer') and self.fusion_layer is not None + + @property + def with_img_neck(self): + """bool: Whether the detector has a neck in image branch.""" + return hasattr(self, 'img_neck') and self.img_neck is not None + + @property + def with_pts_neck(self): + """bool: Whether the detector has a neck in 3D detector branch.""" + return hasattr(self, 'pts_neck') and self.pts_neck is not None + + @property + def with_img_rpn(self): + """bool: Whether the detector has a 2D RPN in image detector branch.""" + return hasattr(self, 'img_rpn_head') and self.img_rpn_head is not None + + @property + def with_img_roi_head(self): + """bool: Whether the detector has a RoI Head in image branch.""" + return hasattr(self, 'img_roi_head') and self.img_roi_head is not None + + @property + def with_voxel_encoder(self): + """bool: Whether the detector has a voxel encoder.""" + return hasattr(self, + 'voxel_encoder') and self.voxel_encoder is not None + + @property + def with_middle_encoder(self): + """bool: Whether the detector has a middle encoder.""" + return hasattr(self, + 'middle_encoder') and self.middle_encoder is not None + + def extract_img_feat(self, img, img_metas): + """Extract features of images.""" + if self.with_img_backbone: + if img.dim() == 5 and img.size(0) == 1: + img.squeeze_() + elif img.dim() == 5 and img.size(0) > 1: + B, N, C, H, W = img.size() + img = img.view(B * N, C, H, W) + img_feats = self.img_backbone(img) + else: + return None + if self.with_img_neck: + img_feats = self.img_neck(img_feats) + return img_feats + + def extract_pts_feat(self, pts, img_feats, img_metas): + """Extract features of points.""" + if not self.with_pts_bbox: + return None + voxels, num_points, coors = self.voxelize(pts) + + voxel_features = self.pts_voxel_encoder(voxels, num_points, coors) + batch_size = coors[-1, 0] + 1 + x = self.pts_middle_encoder(voxel_features, coors, batch_size) + x = self.pts_backbone(x) + if self.with_pts_neck: + x = self.pts_neck(x) + return x + + def extract_feat(self, points, img, img_metas): + """Extract features from images and points.""" + img_feats = self.extract_img_feat(img, img_metas) + pts_feats = self.extract_pts_feat(points, img_feats, img_metas) + return (img_feats, pts_feats) + + @torch.no_grad() + def voxelize(self, points): + """Apply dynamic voxelization to points. + + Args: + points (list[torch.Tensor]): Points of each sample. + + Returns: + tuple[torch.Tensor]: Concatenated points, number of points + per voxel, and coordinates. + """ + voxels, coors, num_points = [], [], [] + for res in points: + res_voxels, res_coors, res_num_points = self.pts_voxel_layer(res) + voxels.append(res_voxels) + coors.append(res_coors) + num_points.append(res_num_points) + voxels = torch.cat(voxels, dim=0) + num_points = torch.cat(num_points, dim=0) + coors_batch = [] + for i, coor in enumerate(coors): + coor_pad = F.pad(coor, (1, 0), mode='constant', value=i) + coors_batch.append(coor_pad) + coors_batch = torch.cat(coors_batch, dim=0) + return voxels, num_points, coors_batch + + def forward_train(self, + points=None, + img_metas=None, + gt_bboxes_3d=None, + gt_labels_3d=None, + gt_labels=None, + gt_bboxes=None, + img=None, + proposals=None, + gt_bboxes_ignore=None): + """Forward training function. + + Args: + points (list[torch.Tensor], optional): Points of each sample. + Defaults to None. + img_metas (list[dict], optional): Meta information of each sample. + Defaults to None. + gt_bboxes_3d (list[:obj:`BaseInstance3DBoxes`], optional): + Ground truth 3D boxes. Defaults to None. + gt_labels_3d (list[torch.Tensor], optional): Ground truth labels + of 3D boxes. Defaults to None. + gt_labels (list[torch.Tensor], optional): Ground truth labels + of 2D boxes in images. Defaults to None. + gt_bboxes (list[torch.Tensor], optional): Ground truth 2D boxes in + images. Defaults to None. + img (torch.Tensor optional): Images of each sample with shape + (N, C, H, W). Defaults to None. + proposals ([list[torch.Tensor], optional): Predicted proposals + used for training Fast RCNN. Defaults to None. + gt_bboxes_ignore (list[torch.Tensor], optional): Ground truth + 2D boxes in images to be ignored. Defaults to None. + + Returns: + dict: Losses of different branches. + """ + img_feats, pts_feats = self.extract_feat( + points, img=img, img_metas=img_metas) + losses = dict() + if pts_feats: + losses_pts = self.forward_pts_train(pts_feats, gt_bboxes_3d, + gt_labels_3d, img_metas, + gt_bboxes_ignore) + losses.update(losses_pts) + if img_feats: + losses_img = self.forward_img_train( + img_feats, + img_metas=img_metas, + gt_bboxes=gt_bboxes, + gt_labels=gt_labels, + gt_bboxes_ignore=gt_bboxes_ignore, + proposals=proposals) + losses.update(losses_img) + return losses + + def forward_pts_train(self, + pts_feats, + gt_bboxes_3d, + gt_labels_3d, + img_metas, + gt_bboxes_ignore=None): + """Forward function for point cloud branch. + + Args: + pts_feats (list[torch.Tensor]): Features of point cloud branch + gt_bboxes_3d (list[:obj:`BaseInstance3DBoxes`]): Ground truth + boxes for each sample. + gt_labels_3d (list[torch.Tensor]): Ground truth labels for + boxes of each sampole + img_metas (list[dict]): Meta information of samples. + gt_bboxes_ignore (list[torch.Tensor], optional): Ground truth + boxes to be ignored. Defaults to None. + + Returns: + dict: Losses of each branch. + """ + outs = self.pts_bbox_head(pts_feats) + loss_inputs = [gt_bboxes_3d, gt_labels_3d, outs] + losses = self.pts_bbox_head.loss(*loss_inputs) + return losses + + def forward_img_train(self, + x, + img_metas, + gt_bboxes, + gt_labels, + gt_bboxes_ignore=None, + proposals=None, + **kwargs): + """Forward function for image branch. + + This function works similar to the forward function of Faster R-CNN. + + Args: + x (list[torch.Tensor]): Image features of shape (B, C, H, W) + of multiple levels. + img_metas (list[dict]): Meta information of images. + gt_bboxes (list[torch.Tensor]): Ground truth boxes of each image + sample. + gt_labels (list[torch.Tensor]): Ground truth labels of boxes. + gt_bboxes_ignore (list[torch.Tensor], optional): Ground truth + boxes to be ignored. Defaults to None. + proposals (list[torch.Tensor], optional): Proposals of each sample. + Defaults to None. + + Returns: + dict: Losses of each branch. + """ + losses = dict() + # RPN forward and loss + if self.with_img_rpn: + rpn_outs = self.img_rpn_head(x) + rpn_loss_inputs = rpn_outs + (gt_bboxes, img_metas, + self.train_cfg.img_rpn) + rpn_losses = self.img_rpn_head.loss( + *rpn_loss_inputs, gt_bboxes_ignore=gt_bboxes_ignore) + losses.update(rpn_losses) + + proposal_cfg = self.train_cfg.get('img_rpn_proposal', + self.test_cfg.img_rpn) + proposal_inputs = rpn_outs + (img_metas, proposal_cfg) + proposal_list = self.img_rpn_head.get_bboxes(*proposal_inputs) + else: + proposal_list = proposals + + # bbox head forward and loss + if self.with_img_bbox: + # bbox head forward and loss + img_roi_losses = self.img_roi_head.forward_train( + x, img_metas, proposal_list, gt_bboxes, gt_labels, + gt_bboxes_ignore, **kwargs) + losses.update(img_roi_losses) + + return losses + + def simple_test_img(self, x, img_metas, proposals=None, rescale=False): + """Test without augmentation.""" + if proposals is None: + proposal_list = self.simple_test_rpn(x, img_metas, + self.test_cfg.img_rpn) + else: + proposal_list = proposals + + return self.img_roi_head.simple_test( + x, proposal_list, img_metas, rescale=rescale) + + def simple_test_rpn(self, x, img_metas, rpn_test_cfg): + """RPN test function.""" + rpn_outs = self.img_rpn_head(x) + proposal_inputs = rpn_outs + (img_metas, rpn_test_cfg) + proposal_list = self.img_rpn_head.get_bboxes(*proposal_inputs) + return proposal_list + + def simple_test_pts(self, x, img_metas, rescale=False): + """Test function of point cloud branch.""" + outs = self.pts_bbox_head(x) + bbox_list = self.pts_bbox_head.get_bboxes( + outs, img_metas, rescale=rescale) + bbox_results = [ + bbox3d2result(bboxes, scores, labels) + for bboxes, scores, labels in bbox_list + ] + return bbox_results[0] + + def simple_test(self, points, img_metas, img=None, rescale=False): + """Test function without augmentaiton.""" + img_feats, pts_feats = self.extract_feat( + points, img=img, img_metas=img_metas) + + bbox_list = dict() + if pts_feats and self.with_pts_bbox: + bbox_pts = self.simple_test_pts( + pts_feats, img_metas, rescale=rescale) + bbox_list.update(pts_bbox=bbox_pts) + if img_feats and self.with_img_bbox: + bbox_img = self.simple_test_img( + img_feats, img_metas, rescale=rescale) + bbox_list.update(img_bbox=bbox_img) + return bbox_list + + def aug_test(self, points, img_metas, imgs=None, rescale=False): + """Test function with augmentaiton.""" + img_feats, pts_feats = self.extract_feats(points, img_metas, imgs) + + bbox_list = dict() + if pts_feats and self.with_pts_bbox: + bbox_pts = self.aug_test_pts(pts_feats, img_metas, rescale) + bbox_list.update(pts_bbox=bbox_pts) + return bbox_list + + def extract_feats(self, points, img_metas, imgs=None): + """Extract point and image features of multiple samples.""" + if imgs is None: + imgs = [None] * len(img_metas) + img_feats, pts_feats = multi_apply(self.extract_feat, points, imgs, + img_metas) + return img_feats, pts_feats + + def aug_test_pts(self, feats, img_metas, rescale=False): + """Test function of point cloud branch with augmentaiton.""" + # only support aug_test for one sample + aug_bboxes = [] + for x, img_meta in zip(feats, img_metas): + outs = self.pts_bbox_head(x) + bbox_list = self.pts_bbox_head.get_bboxes( + *outs, img_meta, rescale=rescale) + bbox_list = [ + dict(boxes_3d=bboxes, scores_3d=scores, labels_3d=labels) + for bboxes, scores, labels in bbox_list + ] + aug_bboxes.append(bbox_list[0]) + + # after merging, bboxes will be rescaled to the original image size + merged_bboxes = merge_aug_bboxes_3d(aug_bboxes, img_metas, + self.pts_bbox_head.test_cfg) + return merged_bboxes + + def show_results(self, data, result, out_dir): + """Results visualization. + + Args: + data (dict): Input points and the information of the sample. + result (dict): Prediction results. + out_dir (str): Output directory of visualization result. + """ + if isinstance(data['points'][0], DC): + points = data['points'][0]._data[0][0].numpy() + elif mmcv.is_list_of(data['points'][0], torch.Tensor): + points = data['points'][0][0] + else: + ValueError(f"Unsupported data type {type(data['points'][0])} " + f'for visualization!') + if isinstance(data['img_metas'][0], DC): + pts_filename = data['img_metas'][0]._data[0][0]['pts_filename'] + box_mode_3d = data['img_metas'][0]._data[0][0]['box_mode_3d'] + elif mmcv.is_list_of(data['img_metas'][0], dict): + pts_filename = data['img_metas'][0][0]['pts_filename'] + box_mode_3d = data['img_metas'][0][0]['box_mode_3d'] + else: + ValueError(f"Unsupported data type {type(data['img_metas'][0])} " + f'for visualization!') + file_name = osp.split(pts_filename)[-1].split('.')[0] + + assert out_dir is not None, 'Expect out_dir, got none.' + inds = result['pts_bbox']['scores_3d'] > 0.1 + pred_bboxes = result['pts_bbox']['boxes_3d'][inds].tensor.numpy() + # for now we convert points into depth mode + if box_mode_3d == Box3DMode.DEPTH: + pred_bboxes[..., 2] += pred_bboxes[..., 5] / 2 + elif box_mode_3d == Box3DMode.CAM or box_mode_3d == Box3DMode.LIDAR: + points = points[..., [1, 0, 2]] + points[..., 0] *= -1 + pred_bboxes = Box3DMode.convert(pred_bboxes, box_mode_3d, + Box3DMode.DEPTH) + pred_bboxes[..., 2] += pred_bboxes[..., 5] / 2 + else: + ValueError( + f'Unsupported box_mode_3d {box_mode_3d} for convertion!') + show_result(points, None, pred_bboxes, out_dir, file_name) From cbcb2401213c6beeeb2afe91fe33680668ef19ec Mon Sep 17 00:00:00 2001 From: liyinhao Date: Tue, 8 Sep 2020 09:16:36 +0800 Subject: [PATCH 05/21] Add 01 configs. --- configs/_base_/models/centerpoint_01_voxel.py | 97 +++++++++ .../models/centerpoint_01_voxel_circle_nms.py | 94 +++++++++ .../_base_/models/centerpoint_01_voxel_dcn.py | 97 +++++++++ .../centerpoint_01_voxel_dcn_circle_nms.py | 94 +++++++++ configs/centerpoint/centerpoint_01_voxel.py | 187 +++++++++++++++++ .../centerpoint_01_voxel_circle_nms.py | 188 ++++++++++++++++++ .../centerpoint/centerpoint_01_voxel_dcn.py | 188 ++++++++++++++++++ .../centerpoint_01_voxel_dcn_circle_nms.py | 188 ++++++++++++++++++ 8 files changed, 1133 insertions(+) create mode 100644 configs/_base_/models/centerpoint_01_voxel.py create mode 100644 configs/_base_/models/centerpoint_01_voxel_circle_nms.py create mode 100644 configs/_base_/models/centerpoint_01_voxel_dcn.py create mode 100644 configs/_base_/models/centerpoint_01_voxel_dcn_circle_nms.py create mode 100644 configs/centerpoint/centerpoint_01_voxel.py create mode 100644 configs/centerpoint/centerpoint_01_voxel_circle_nms.py create mode 100644 configs/centerpoint/centerpoint_01_voxel_dcn.py create mode 100644 configs/centerpoint/centerpoint_01_voxel_dcn_circle_nms.py diff --git a/configs/_base_/models/centerpoint_01_voxel.py b/configs/_base_/models/centerpoint_01_voxel.py new file mode 100644 index 0000000000..d4f0a21224 --- /dev/null +++ b/configs/_base_/models/centerpoint_01_voxel.py @@ -0,0 +1,97 @@ +voxel_size = [0.1, 0.1, 0.2] +point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] +model = dict( + type='CenterPoint', + pts_voxel_layer=dict( + max_num_points=10, + point_cloud_range=point_cloud_range, + voxel_size=voxel_size, + max_voxels=(90000, 120000)), + pts_voxel_encoder=dict(type='HardSimpleVFE', num_features=5), + pts_middle_encoder=dict( + type='SparseEncoder', + in_channels=5, + sparse_shape=[41, 1440, 1440], + output_channels=128, + order=('conv', 'norm', 'act'), + encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, + 128)), + encoder_paddings=((0, 0, 1), (0, 0, 1), (0, 0, [0, 1, 1]), (0, 0)), + block_type='basicblock'), + pts_backbone=dict( + type='SECOND', + in_channels=256, + out_channels=[128, 256], + layer_nums=[5, 5], + layer_strides=[1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + conv_cfg=dict(type='Conv2d', bias=False)), + pts_neck=dict( + type='SECONDFPN', + in_channels=[128, 256], + out_channels=[256, 256], + upsample_strides=[1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + upsample_cfg=dict(type='deconv', bias=False), + use_conv_for_no_stride=True), + pts_bbox_head=dict( + type='CenterHead', + mode='3d', + in_channels=sum([256, 256]), + tasks=[ + dict(num_class=1, class_names=['car']), + dict(num_class=2, class_names=['truck', 'construction_vehicle']), + dict(num_class=2, class_names=['bus', 'trailer']), + dict(num_class=1, class_names=['barrier']), + dict(num_class=2, class_names=['motorcycle', 'bicycle']), + dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), + ], + common_heads={ + 'reg': (2, 2), + 'height': (1, 2), + 'dim': (3, 2), + 'rot': (2, 2), + 'vel': (2, 2) + }, + share_conv_channel=64, + bbox_coder=dict( + type='CenterPointBBoxCoder', + post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_num=500, + score_threshold=0.1, + pc_range=point_cloud_range[:2], + out_size_factor=8, + voxel_size=voxel_size[:2], + code_size=9), + dcn_head=False, + loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) +# model training and testing settings +train_cfg = dict( + pts=dict( + grid_size=[1440, 1440, 40], + point_cloud_range=point_cloud_range, + voxel_size=voxel_size, + out_size_factor=8, + dense_reg=1, + gaussian_overlap=0.1, + max_objs=500, + min_radius=2, + code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0], + no_log=False)) +test_cfg = dict( + pts=dict( + post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_per_img=500, + max_pool_nms=False, + min_radius=[4, 12, 10, 1, 0.85, 0.175], + post_max_size=83, + score_threshold=0.1, + pc_range=point_cloud_range[:2], + out_size_factor=8, + voxel_size=voxel_size[:2], + nms_type='rotate', + nms_pre_max_size=1000, + nms_post_max_size=83, + nms_iou_threshold=0.2, + no_log=False)) diff --git a/configs/_base_/models/centerpoint_01_voxel_circle_nms.py b/configs/_base_/models/centerpoint_01_voxel_circle_nms.py new file mode 100644 index 0000000000..5d92767d0f --- /dev/null +++ b/configs/_base_/models/centerpoint_01_voxel_circle_nms.py @@ -0,0 +1,94 @@ +voxel_size = [0.1, 0.1, 0.2] +point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] +model = dict( + type='CenterPoint', + pts_voxel_layer=dict( + max_num_points=10, + point_cloud_range=point_cloud_range, + voxel_size=voxel_size, + max_voxels=(90000, 120000)), + pts_voxel_encoder=dict(type='HardSimpleVFE', num_features=5), + pts_middle_encoder=dict( + type='SparseEncoder', + in_channels=5, + sparse_shape=[41, 1440, 1440], + output_channels=128, + order=('conv', 'norm', 'act'), + encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, + 128)), + encoder_paddings=((0, 0, 1), (0, 0, 1), (0, 0, [0, 1, 1]), (0, 0)), + block_type='basicblock'), + pts_backbone=dict( + type='SECOND', + in_channels=256, + out_channels=[128, 256], + layer_nums=[5, 5], + layer_strides=[1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + conv_cfg=dict(type='Conv2d', bias=False)), + pts_neck=dict( + type='SECONDFPN', + in_channels=[128, 256], + out_channels=[256, 256], + upsample_strides=[1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + upsample_cfg=dict(type='deconv', bias=False), + use_conv_for_no_stride=True), + pts_bbox_head=dict( + type='CenterHead', + mode='3d', + in_channels=sum([256, 256]), + tasks=[ + dict(num_class=1, class_names=['car']), + dict(num_class=2, class_names=['truck', 'construction_vehicle']), + dict(num_class=2, class_names=['bus', 'trailer']), + dict(num_class=1, class_names=['barrier']), + dict(num_class=2, class_names=['motorcycle', 'bicycle']), + dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), + ], + common_heads={ + 'reg': (2, 2), + 'height': (1, 2), + 'dim': (3, 2), + 'rot': (2, 2), + 'vel': (2, 2) + }, + share_conv_channel=64, + bbox_coder=dict( + type='CenterPointBBoxCoder', + post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_num=500, + score_threshold=0.1, + pc_range=point_cloud_range[:2], + out_size_factor=8, + voxel_size=voxel_size[:2], + code_size=9), + dcn_head=False, + loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) +# model training and testing settings +train_cfg = dict( + pts=dict( + grid_size=[1440, 1440, 40], + point_cloud_range=point_cloud_range, + voxel_size=voxel_size, + out_size_factor=8, + dense_reg=1, + gaussian_overlap=0.1, + max_objs=500, + min_radius=2, + code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0], + no_log=False)) +test_cfg = dict( + pts=dict( + post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_per_img=500, + max_pool_nms=False, + min_radius=[4, 12, 10, 1, 0.85, 0.175], + post_max_size=83, + score_threshold=0.1, + pc_range=point_cloud_range[:2], + out_size_factor=8, + voxel_size=voxel_size[:2], + nms_type='circle', + no_log=False)) diff --git a/configs/_base_/models/centerpoint_01_voxel_dcn.py b/configs/_base_/models/centerpoint_01_voxel_dcn.py new file mode 100644 index 0000000000..914c4cf487 --- /dev/null +++ b/configs/_base_/models/centerpoint_01_voxel_dcn.py @@ -0,0 +1,97 @@ +voxel_size = [0.1, 0.1, 0.2] +point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] +model = dict( + type='CenterPoint', + pts_voxel_layer=dict( + max_num_points=10, + point_cloud_range=point_cloud_range, + voxel_size=voxel_size, + max_voxels=(90000, 120000)), + pts_voxel_encoder=dict(type='HardSimpleVFE', num_features=5), + pts_middle_encoder=dict( + type='SparseEncoder', + in_channels=5, + sparse_shape=[41, 1440, 1440], + output_channels=128, + order=('conv', 'norm', 'act'), + encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, + 128)), + encoder_paddings=((0, 0, 1), (0, 0, 1), (0, 0, [0, 1, 1]), (0, 0)), + block_type='basicblock'), + pts_backbone=dict( + type='SECOND', + in_channels=256, + out_channels=[128, 256], + layer_nums=[5, 5], + layer_strides=[1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + conv_cfg=dict(type='Conv2d', bias=False)), + pts_neck=dict( + type='SECONDFPN', + in_channels=[128, 256], + out_channels=[256, 256], + upsample_strides=[1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + upsample_cfg=dict(type='deconv', bias=False), + use_conv_for_no_stride=True), + pts_bbox_head=dict( + type='CenterHead', + mode='3d', + in_channels=sum([256, 256]), + tasks=[ + dict(num_class=1, class_names=['car']), + dict(num_class=2, class_names=['truck', 'construction_vehicle']), + dict(num_class=2, class_names=['bus', 'trailer']), + dict(num_class=1, class_names=['barrier']), + dict(num_class=2, class_names=['motorcycle', 'bicycle']), + dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), + ], + common_heads={ + 'reg': (2, 2), + 'height': (1, 2), + 'dim': (3, 2), + 'rot': (2, 2), + 'vel': (2, 2) + }, + share_conv_channel=64, + bbox_coder=dict( + type='CenterPointBBoxCoder', + post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_num=500, + score_threshold=0.1, + pc_range=point_cloud_range[:2], + out_size_factor=8, + voxel_size=voxel_size[:2], + code_size=9), + dcn_head=True, + loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) +# model training and testing settings +train_cfg = dict( + pts=dict( + grid_size=[1440, 1440, 40], + point_cloud_range=point_cloud_range, + voxel_size=voxel_size, + out_size_factor=8, + dense_reg=1, + gaussian_overlap=0.1, + max_objs=500, + min_radius=2, + code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0], + no_log=False)) +test_cfg = dict( + pts=dict( + post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_per_img=500, + max_pool_nms=False, + min_radius=[4, 12, 10, 1, 0.85, 0.175], + post_max_size=83, + score_threshold=0.1, + pc_range=point_cloud_range[:2], + out_size_factor=8, + voxel_size=voxel_size[:2], + nms_type='rotate', + nms_pre_max_size=1000, + nms_post_max_size=83, + nms_iou_threshold=0.2, + no_log=False)) diff --git a/configs/_base_/models/centerpoint_01_voxel_dcn_circle_nms.py b/configs/_base_/models/centerpoint_01_voxel_dcn_circle_nms.py new file mode 100644 index 0000000000..b82ec0bdb9 --- /dev/null +++ b/configs/_base_/models/centerpoint_01_voxel_dcn_circle_nms.py @@ -0,0 +1,94 @@ +voxel_size = [0.1, 0.1, 0.2] +point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] +model = dict( + type='CenterPoint', + pts_voxel_layer=dict( + max_num_points=10, + point_cloud_range=point_cloud_range, + voxel_size=voxel_size, + max_voxels=(90000, 120000)), + pts_voxel_encoder=dict(type='HardSimpleVFE', num_features=5), + pts_middle_encoder=dict( + type='SparseEncoder', + in_channels=5, + sparse_shape=[41, 1440, 1440], + output_channels=128, + order=('conv', 'norm', 'act'), + encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, + 128)), + encoder_paddings=((0, 0, 1), (0, 0, 1), (0, 0, [0, 1, 1]), (0, 0)), + block_type='basicblock'), + pts_backbone=dict( + type='SECOND', + in_channels=256, + out_channels=[128, 256], + layer_nums=[5, 5], + layer_strides=[1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + conv_cfg=dict(type='Conv2d', bias=False)), + pts_neck=dict( + type='SECONDFPN', + in_channels=[128, 256], + out_channels=[256, 256], + upsample_strides=[1, 2], + norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), + upsample_cfg=dict(type='deconv', bias=False), + use_conv_for_no_stride=True), + pts_bbox_head=dict( + type='CenterHead', + mode='3d', + in_channels=sum([256, 256]), + tasks=[ + dict(num_class=1, class_names=['car']), + dict(num_class=2, class_names=['truck', 'construction_vehicle']), + dict(num_class=2, class_names=['bus', 'trailer']), + dict(num_class=1, class_names=['barrier']), + dict(num_class=2, class_names=['motorcycle', 'bicycle']), + dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), + ], + common_heads={ + 'reg': (2, 2), + 'height': (1, 2), + 'dim': (3, 2), + 'rot': (2, 2), + 'vel': (2, 2) + }, + share_conv_channel=64, + bbox_coder=dict( + type='CenterPointBBoxCoder', + post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_num=500, + score_threshold=0.1, + pc_range=point_cloud_range[:2], + out_size_factor=8, + voxel_size=voxel_size[:2], + code_size=9), + dcn_head=True, + loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) +# model training and testing settings +train_cfg = dict( + pts=dict( + grid_size=[1440, 1440, 40], + point_cloud_range=point_cloud_range, + voxel_size=voxel_size, + out_size_factor=8, + dense_reg=1, + gaussian_overlap=0.1, + max_objs=500, + min_radius=2, + code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0], + no_log=False)) +test_cfg = dict( + pts=dict( + post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], + max_per_img=500, + max_pool_nms=False, + min_radius=[4, 12, 10, 1, 0.85, 0.175], + post_max_size=83, + score_threshold=0.1, + pc_range=point_cloud_range[:2], + out_size_factor=8, + voxel_size=voxel_size[:2], + nms_type='circle', + no_log=False)) diff --git a/configs/centerpoint/centerpoint_01_voxel.py b/configs/centerpoint/centerpoint_01_voxel.py new file mode 100644 index 0000000000..8c2d4ef08e --- /dev/null +++ b/configs/centerpoint/centerpoint_01_voxel.py @@ -0,0 +1,187 @@ +_base_ = [ + '../_base_/models/centerpoint_01_voxel.py', '../_base_/default_runtime.py' +] + +# If point cloud range is changed, the models should also change their point +# cloud range accordingly +point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] +# For nuScenes we usually do 10-class detection +class_names = [ + 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', + 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' +] +dataset_type = 'NuScenesDataset' +data_root = 'data/nuscenes/' +# Input modality for nuScenes dataset, this is consistent with the submission +# format which requires the information in input_modality. +input_modality = dict( + use_lidar=True, + use_camera=False, + use_radar=False, + use_map=False, + use_external=False) +file_client_args = dict(backend='disk') + +db_sampler = dict( + data_root=data_root, + info_path=data_root + 'nuscenes_dbinfos_train.pkl', + rate=1.0, + prepare=dict( + filter_by_difficulty=[-1], + filter_by_min_points=dict( + car=5, + truck=5, + bus=5, + trailer=5, + construction_vehicle=5, + traffic_cone=5, + barrier=5, + motorcycle=5, + bicycle=5, + pedestrian=5, + )), + classes=class_names, + sample_groups=dict( + car=2, + truck=3, + construction_vehicle=7, + bus=4, + trailer=6, + barrier=2, + motorcycle=6, + bicycle=6, + pedestrian=2, + traffic_cone=2, + ), + points_loader=dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args)) + +train_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), + dict(type='ObjectSample', db_sampler=db_sampler), + dict( + type='GlobalRotScaleTrans', + rot_range=[-0.3925, 0.3925], + scale_ratio_range=[0.95, 1.05], + translation_std=[0, 0, 0]), + dict( + type='RandomFlip3D', + sync_2d=False, + flip_ratio_bev_horizontal=0.5, + flip_ratio_bev_vertical=0.5), + dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectNameFilter', classes=class_names), + dict(type='PointShuffle'), + dict(type='DefaultFormatBundle3D', class_names=class_names), + dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) +] +test_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict( + type='MultiScaleFlipAug3D', + img_scale=(1333, 800), + pts_scale_ratio=1, + flip=False, + transforms=[ + dict( + type='GlobalRotScaleTrans', + rot_range=[0, 0], + scale_ratio_range=[1., 1.], + translation_std=[0, 0, 0]), + dict(type='RandomFlip3D'), + dict( + type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict( + type='DefaultFormatBundle3D', + class_names=class_names, + with_label=False), + dict(type='Collect3D', keys=['points']) + ]) +] + +data = dict( + samples_per_gpu=4, + workers_per_gpu=4, + train=dict( + type='CBGSDataset', + dataset=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_train.pkl', + pipeline=train_pipeline, + classes=class_names, + modality=input_modality, + test_mode=False, + use_valid_flag=True, + # 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')), + val=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR'), + test=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR')) +# For nuScenes dataset, we usually evaluate the model at the end of training. +# Since the models are trained by 24 epochs by default, we set evaluation +# interval to be 24. Please change the interval accordingly if you do not +# use a default schedule. +# optimizer +# This schedule is mainly used by models on nuScenes dataset +optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) +# max_norm=10 is better for SECOND +optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) +lr_config = dict( + policy='cyclic', + target_ratio=(10, 1e-4), + cyclic_times=1, + step_ratio_up=0.4, +) +momentum_config = dict( + policy='cyclic', + target_ratio=(0.85 / 0.95, 1), + cyclic_times=1, + step_ratio_up=0.4, +) + +# runtime settings +total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_01_voxel_circle_nms.py b/configs/centerpoint/centerpoint_01_voxel_circle_nms.py new file mode 100644 index 0000000000..d6922627e6 --- /dev/null +++ b/configs/centerpoint/centerpoint_01_voxel_circle_nms.py @@ -0,0 +1,188 @@ +_base_ = [ + '../_base_/models/centerpoint_01_voxel_circle_nms.py', + '../_base_/default_runtime.py' +] + +# If point cloud range is changed, the models should also change their point +# cloud range accordingly +point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] +# For nuScenes we usually do 10-class detection +class_names = [ + 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', + 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' +] +dataset_type = 'NuScenesDataset' +data_root = 'data/nuscenes/' +# Input modality for nuScenes dataset, this is consistent with the submission +# format which requires the information in input_modality. +input_modality = dict( + use_lidar=True, + use_camera=False, + use_radar=False, + use_map=False, + use_external=False) +file_client_args = dict(backend='disk') + +db_sampler = dict( + data_root=data_root, + info_path=data_root + 'nuscenes_dbinfos_train.pkl', + rate=1.0, + prepare=dict( + filter_by_difficulty=[-1], + filter_by_min_points=dict( + car=5, + truck=5, + bus=5, + trailer=5, + construction_vehicle=5, + traffic_cone=5, + barrier=5, + motorcycle=5, + bicycle=5, + pedestrian=5, + )), + classes=class_names, + sample_groups=dict( + car=2, + truck=3, + construction_vehicle=7, + bus=4, + trailer=6, + barrier=2, + motorcycle=6, + bicycle=6, + pedestrian=2, + traffic_cone=2, + ), + points_loader=dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args)) + +train_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), + dict(type='ObjectSample', db_sampler=db_sampler), + dict( + type='GlobalRotScaleTrans', + rot_range=[-0.3925, 0.3925], + scale_ratio_range=[0.95, 1.05], + translation_std=[0, 0, 0]), + dict( + type='RandomFlip3D', + sync_2d=False, + flip_ratio_bev_horizontal=0.5, + flip_ratio_bev_vertical=0.5), + dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectNameFilter', classes=class_names), + dict(type='PointShuffle'), + dict(type='DefaultFormatBundle3D', class_names=class_names), + dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) +] +test_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict( + type='MultiScaleFlipAug3D', + img_scale=(1333, 800), + pts_scale_ratio=1, + flip=False, + transforms=[ + dict( + type='GlobalRotScaleTrans', + rot_range=[0, 0], + scale_ratio_range=[1., 1.], + translation_std=[0, 0, 0]), + dict(type='RandomFlip3D'), + dict( + type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict( + type='DefaultFormatBundle3D', + class_names=class_names, + with_label=False), + dict(type='Collect3D', keys=['points']) + ]) +] + +data = dict( + samples_per_gpu=4, + workers_per_gpu=4, + train=dict( + type='CBGSDataset', + dataset=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_train.pkl', + pipeline=train_pipeline, + classes=class_names, + modality=input_modality, + test_mode=False, + use_valid_flag=True, + # 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')), + val=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR'), + test=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR')) +# For nuScenes dataset, we usually evaluate the model at the end of training. +# Since the models are trained by 24 epochs by default, we set evaluation +# interval to be 24. Please change the interval accordingly if you do not +# use a default schedule. +# optimizer +# This schedule is mainly used by models on nuScenes dataset +optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) +# max_norm=10 is better for SECOND +optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) +lr_config = dict( + policy='cyclic', + target_ratio=(10, 1e-4), + cyclic_times=1, + step_ratio_up=0.4, +) +momentum_config = dict( + policy='cyclic', + target_ratio=(0.85 / 0.95, 1), + cyclic_times=1, + step_ratio_up=0.4, +) + +# runtime settings +total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_01_voxel_dcn.py b/configs/centerpoint/centerpoint_01_voxel_dcn.py new file mode 100644 index 0000000000..72159dfd47 --- /dev/null +++ b/configs/centerpoint/centerpoint_01_voxel_dcn.py @@ -0,0 +1,188 @@ +_base_ = [ + '../_base_/models/centerpoint_01_voxel_dcn.py', + '../_base_/default_runtime.py' +] + +# If point cloud range is changed, the models should also change their point +# cloud range accordingly +point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] +# For nuScenes we usually do 10-class detection +class_names = [ + 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', + 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' +] +dataset_type = 'NuScenesDataset' +data_root = 'data/nuscenes/' +# Input modality for nuScenes dataset, this is consistent with the submission +# format which requires the information in input_modality. +input_modality = dict( + use_lidar=True, + use_camera=False, + use_radar=False, + use_map=False, + use_external=False) +file_client_args = dict(backend='disk') + +db_sampler = dict( + data_root=data_root, + info_path=data_root + 'nuscenes_dbinfos_train.pkl', + rate=1.0, + prepare=dict( + filter_by_difficulty=[-1], + filter_by_min_points=dict( + car=5, + truck=5, + bus=5, + trailer=5, + construction_vehicle=5, + traffic_cone=5, + barrier=5, + motorcycle=5, + bicycle=5, + pedestrian=5, + )), + classes=class_names, + sample_groups=dict( + car=2, + truck=3, + construction_vehicle=7, + bus=4, + trailer=6, + barrier=2, + motorcycle=6, + bicycle=6, + pedestrian=2, + traffic_cone=2, + ), + points_loader=dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args)) + +train_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), + dict(type='ObjectSample', db_sampler=db_sampler), + dict( + type='GlobalRotScaleTrans', + rot_range=[-0.3925, 0.3925], + scale_ratio_range=[0.95, 1.05], + translation_std=[0, 0, 0]), + dict( + type='RandomFlip3D', + sync_2d=False, + flip_ratio_bev_horizontal=0.5, + flip_ratio_bev_vertical=0.5), + dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectNameFilter', classes=class_names), + dict(type='PointShuffle'), + dict(type='DefaultFormatBundle3D', class_names=class_names), + dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) +] +test_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict( + type='MultiScaleFlipAug3D', + img_scale=(1333, 800), + pts_scale_ratio=1, + flip=False, + transforms=[ + dict( + type='GlobalRotScaleTrans', + rot_range=[0, 0], + scale_ratio_range=[1., 1.], + translation_std=[0, 0, 0]), + dict(type='RandomFlip3D'), + dict( + type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict( + type='DefaultFormatBundle3D', + class_names=class_names, + with_label=False), + dict(type='Collect3D', keys=['points']) + ]) +] + +data = dict( + samples_per_gpu=4, + workers_per_gpu=4, + train=dict( + type='CBGSDataset', + dataset=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_train.pkl', + pipeline=train_pipeline, + classes=class_names, + modality=input_modality, + test_mode=False, + use_valid_flag=True, + # 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')), + val=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR'), + test=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR')) +# For nuScenes dataset, we usually evaluate the model at the end of training. +# Since the models are trained by 24 epochs by default, we set evaluation +# interval to be 24. Please change the interval accordingly if you do not +# use a default schedule. +# optimizer +# This schedule is mainly used by models on nuScenes dataset +optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) +# max_norm=10 is better for SECOND +optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) +lr_config = dict( + policy='cyclic', + target_ratio=(10, 1e-4), + cyclic_times=1, + step_ratio_up=0.4, +) +momentum_config = dict( + policy='cyclic', + target_ratio=(0.85 / 0.95, 1), + cyclic_times=1, + step_ratio_up=0.4, +) + +# runtime settings +total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_01_voxel_dcn_circle_nms.py b/configs/centerpoint/centerpoint_01_voxel_dcn_circle_nms.py new file mode 100644 index 0000000000..21b0795377 --- /dev/null +++ b/configs/centerpoint/centerpoint_01_voxel_dcn_circle_nms.py @@ -0,0 +1,188 @@ +_base_ = [ + '../_base_/models/centerpoint_01_voxel_dcn_circle_nms.py', + '../_base_/default_runtime.py' +] + +# If point cloud range is changed, the models should also change their point +# cloud range accordingly +point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] +# For nuScenes we usually do 10-class detection +class_names = [ + 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', + 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' +] +dataset_type = 'NuScenesDataset' +data_root = 'data/nuscenes/' +# Input modality for nuScenes dataset, this is consistent with the submission +# format which requires the information in input_modality. +input_modality = dict( + use_lidar=True, + use_camera=False, + use_radar=False, + use_map=False, + use_external=False) +file_client_args = dict(backend='disk') + +db_sampler = dict( + data_root=data_root, + info_path=data_root + 'nuscenes_dbinfos_train.pkl', + rate=1.0, + prepare=dict( + filter_by_difficulty=[-1], + filter_by_min_points=dict( + car=5, + truck=5, + bus=5, + trailer=5, + construction_vehicle=5, + traffic_cone=5, + barrier=5, + motorcycle=5, + bicycle=5, + pedestrian=5, + )), + classes=class_names, + sample_groups=dict( + car=2, + truck=3, + construction_vehicle=7, + bus=4, + trailer=6, + barrier=2, + motorcycle=6, + bicycle=6, + pedestrian=2, + traffic_cone=2, + ), + points_loader=dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args)) + +train_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), + dict(type='ObjectSample', db_sampler=db_sampler), + dict( + type='GlobalRotScaleTrans', + rot_range=[-0.3925, 0.3925], + scale_ratio_range=[0.95, 1.05], + translation_std=[0, 0, 0]), + dict( + type='RandomFlip3D', + sync_2d=False, + flip_ratio_bev_horizontal=0.5, + flip_ratio_bev_vertical=0.5), + dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), + dict(type='ObjectNameFilter', classes=class_names), + dict(type='PointShuffle'), + dict(type='DefaultFormatBundle3D', class_names=class_names), + dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) +] +test_pipeline = [ + dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=5, + file_client_args=file_client_args), + dict( + type='LoadPointsFromMultiSweeps', + sweeps_num=9, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args, + pad_empty_sweeps=True, + remove_close=True), + dict( + type='MultiScaleFlipAug3D', + img_scale=(1333, 800), + pts_scale_ratio=1, + flip=False, + transforms=[ + dict( + type='GlobalRotScaleTrans', + rot_range=[0, 0], + scale_ratio_range=[1., 1.], + translation_std=[0, 0, 0]), + dict(type='RandomFlip3D'), + dict( + type='PointsRangeFilter', point_cloud_range=point_cloud_range), + dict( + type='DefaultFormatBundle3D', + class_names=class_names, + with_label=False), + dict(type='Collect3D', keys=['points']) + ]) +] + +data = dict( + samples_per_gpu=4, + workers_per_gpu=4, + train=dict( + type='CBGSDataset', + dataset=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_train.pkl', + pipeline=train_pipeline, + classes=class_names, + modality=input_modality, + test_mode=False, + use_valid_flag=True, + # 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')), + val=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR'), + test=dict( + type=dataset_type, + data_root=data_root, + ann_file=data_root + 'nuscenes_infos_val.pkl', + pipeline=test_pipeline, + classes=class_names, + modality=input_modality, + test_mode=True, + box_type_3d='LiDAR')) +# For nuScenes dataset, we usually evaluate the model at the end of training. +# Since the models are trained by 24 epochs by default, we set evaluation +# interval to be 24. Please change the interval accordingly if you do not +# use a default schedule. +# optimizer +# This schedule is mainly used by models on nuScenes dataset +optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) +# max_norm=10 is better for SECOND +optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) +lr_config = dict( + policy='cyclic', + target_ratio=(10, 1e-4), + cyclic_times=1, + step_ratio_up=0.4, +) +momentum_config = dict( + policy='cyclic', + target_ratio=(0.85 / 0.95, 1), + cyclic_times=1, + step_ratio_up=0.4, +) + +# runtime settings +total_epochs = 20 From b12097e3ccc0c6c53b733ee1eab439a6b1025f28 Mon Sep 17 00:00:00 2001 From: liyinhao Date: Tue, 8 Sep 2020 09:24:01 +0800 Subject: [PATCH 06/21] Change sparse shape --- configs/_base_/models/centerpoint_01_voxel.py | 4 ++-- configs/_base_/models/centerpoint_01_voxel_circle_nms.py | 4 ++-- configs/_base_/models/centerpoint_01_voxel_dcn.py | 4 ++-- configs/_base_/models/centerpoint_01_voxel_dcn_circle_nms.py | 4 ++-- configs/centerpoint/centerpoint_01_voxel_circle_nms.py | 2 +- configs/centerpoint/centerpoint_01_voxel_dcn.py | 2 +- configs/centerpoint/centerpoint_01_voxel_dcn_circle_nms.py | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/configs/_base_/models/centerpoint_01_voxel.py b/configs/_base_/models/centerpoint_01_voxel.py index d4f0a21224..a0855b476a 100644 --- a/configs/_base_/models/centerpoint_01_voxel.py +++ b/configs/_base_/models/centerpoint_01_voxel.py @@ -11,7 +11,7 @@ pts_middle_encoder=dict( type='SparseEncoder', in_channels=5, - sparse_shape=[41, 1440, 1440], + sparse_shape=[41, 1024, 1024], output_channels=128, order=('conv', 'norm', 'act'), encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, @@ -69,7 +69,7 @@ # model training and testing settings train_cfg = dict( pts=dict( - grid_size=[1440, 1440, 40], + grid_size=[1024, 1024, 40], point_cloud_range=point_cloud_range, voxel_size=voxel_size, out_size_factor=8, diff --git a/configs/_base_/models/centerpoint_01_voxel_circle_nms.py b/configs/_base_/models/centerpoint_01_voxel_circle_nms.py index 5d92767d0f..73a462cac9 100644 --- a/configs/_base_/models/centerpoint_01_voxel_circle_nms.py +++ b/configs/_base_/models/centerpoint_01_voxel_circle_nms.py @@ -11,7 +11,7 @@ pts_middle_encoder=dict( type='SparseEncoder', in_channels=5, - sparse_shape=[41, 1440, 1440], + sparse_shape=[41, 1024, 1024], output_channels=128, order=('conv', 'norm', 'act'), encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, @@ -69,7 +69,7 @@ # model training and testing settings train_cfg = dict( pts=dict( - grid_size=[1440, 1440, 40], + grid_size=[1024, 1024, 40], point_cloud_range=point_cloud_range, voxel_size=voxel_size, out_size_factor=8, diff --git a/configs/_base_/models/centerpoint_01_voxel_dcn.py b/configs/_base_/models/centerpoint_01_voxel_dcn.py index 914c4cf487..a71d1fe9e9 100644 --- a/configs/_base_/models/centerpoint_01_voxel_dcn.py +++ b/configs/_base_/models/centerpoint_01_voxel_dcn.py @@ -11,7 +11,7 @@ pts_middle_encoder=dict( type='SparseEncoder', in_channels=5, - sparse_shape=[41, 1440, 1440], + sparse_shape=[41, 1024, 1024], output_channels=128, order=('conv', 'norm', 'act'), encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, @@ -69,7 +69,7 @@ # model training and testing settings train_cfg = dict( pts=dict( - grid_size=[1440, 1440, 40], + grid_size=[1024, 1024, 40], point_cloud_range=point_cloud_range, voxel_size=voxel_size, out_size_factor=8, diff --git a/configs/_base_/models/centerpoint_01_voxel_dcn_circle_nms.py b/configs/_base_/models/centerpoint_01_voxel_dcn_circle_nms.py index b82ec0bdb9..8954f87d9e 100644 --- a/configs/_base_/models/centerpoint_01_voxel_dcn_circle_nms.py +++ b/configs/_base_/models/centerpoint_01_voxel_dcn_circle_nms.py @@ -11,7 +11,7 @@ pts_middle_encoder=dict( type='SparseEncoder', in_channels=5, - sparse_shape=[41, 1440, 1440], + sparse_shape=[41, 1024, 1024], output_channels=128, order=('conv', 'norm', 'act'), encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, @@ -69,7 +69,7 @@ # model training and testing settings train_cfg = dict( pts=dict( - grid_size=[1440, 1440, 40], + grid_size=[1024, 1024, 40], point_cloud_range=point_cloud_range, voxel_size=voxel_size, out_size_factor=8, diff --git a/configs/centerpoint/centerpoint_01_voxel_circle_nms.py b/configs/centerpoint/centerpoint_01_voxel_circle_nms.py index d6922627e6..5a11128615 100644 --- a/configs/centerpoint/centerpoint_01_voxel_circle_nms.py +++ b/configs/centerpoint/centerpoint_01_voxel_circle_nms.py @@ -5,7 +5,7 @@ # If point cloud range is changed, the models should also change their point # cloud range accordingly -point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] +point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] # For nuScenes we usually do 10-class detection class_names = [ 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', diff --git a/configs/centerpoint/centerpoint_01_voxel_dcn.py b/configs/centerpoint/centerpoint_01_voxel_dcn.py index 72159dfd47..fb99d0e7c1 100644 --- a/configs/centerpoint/centerpoint_01_voxel_dcn.py +++ b/configs/centerpoint/centerpoint_01_voxel_dcn.py @@ -5,7 +5,7 @@ # If point cloud range is changed, the models should also change their point # cloud range accordingly -point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] +point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] # For nuScenes we usually do 10-class detection class_names = [ 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', diff --git a/configs/centerpoint/centerpoint_01_voxel_dcn_circle_nms.py b/configs/centerpoint/centerpoint_01_voxel_dcn_circle_nms.py index 21b0795377..632fab353e 100644 --- a/configs/centerpoint/centerpoint_01_voxel_dcn_circle_nms.py +++ b/configs/centerpoint/centerpoint_01_voxel_dcn_circle_nms.py @@ -5,7 +5,7 @@ # If point cloud range is changed, the models should also change their point # cloud range accordingly -point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] +point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] # For nuScenes we usually do 10-class detection class_names = [ 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', From 6a9286aa0e36e552443d23a1a044d492de74f61a Mon Sep 17 00:00:00 2001 From: liyinhao Date: Tue, 8 Sep 2020 21:47:12 +0800 Subject: [PATCH 07/21] Change model config, change centerpoint detector to inherite from mvx two stage. --- .../_base_/models/centerpoint_0075_voxel.py | 2 +- .../centerpoint_0075_voxel_circle_nms.py | 2 +- .../models/centerpoint_0075_voxel_dcn.py | 2 +- .../centerpoint_0075_voxel_dcn_circle_nms.py | 2 +- configs/_base_/models/centerpoint_01_voxel.py | 2 +- .../models/centerpoint_01_voxel_circle_nms.py | 2 +- .../_base_/models/centerpoint_01_voxel_dcn.py | 2 +- .../centerpoint_01_voxel_dcn_circle_nms.py | 2 +- configs/_base_/models/centerpoint_pp.py | 2 +- .../models/centerpoint_pp_circle_nms.py | 2 +- configs/_base_/models/centerpoint_pp_dcn.py | 2 +- .../models/centerpoint_pp_dcn_circle_nms.py | 2 +- mmdet3d/models/detectors/centerpoint.py | 424 +----------------- 13 files changed, 21 insertions(+), 427 deletions(-) diff --git a/configs/_base_/models/centerpoint_0075_voxel.py b/configs/_base_/models/centerpoint_0075_voxel.py index bcde14715c..18d1c4ac8a 100644 --- a/configs/_base_/models/centerpoint_0075_voxel.py +++ b/configs/_base_/models/centerpoint_0075_voxel.py @@ -64,7 +64,7 @@ voxel_size=voxel_size[:2], code_size=9), dcn_head=False, - loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( diff --git a/configs/_base_/models/centerpoint_0075_voxel_circle_nms.py b/configs/_base_/models/centerpoint_0075_voxel_circle_nms.py index bdc82b47a8..a73c0060f6 100644 --- a/configs/_base_/models/centerpoint_0075_voxel_circle_nms.py +++ b/configs/_base_/models/centerpoint_0075_voxel_circle_nms.py @@ -64,7 +64,7 @@ voxel_size=voxel_size[:2], code_size=9), dcn_head=False, - loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( diff --git a/configs/_base_/models/centerpoint_0075_voxel_dcn.py b/configs/_base_/models/centerpoint_0075_voxel_dcn.py index 0bd90ff521..c2e76b91ab 100644 --- a/configs/_base_/models/centerpoint_0075_voxel_dcn.py +++ b/configs/_base_/models/centerpoint_0075_voxel_dcn.py @@ -64,7 +64,7 @@ voxel_size=voxel_size[:2], code_size=9), dcn_head=True, - loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( diff --git a/configs/_base_/models/centerpoint_0075_voxel_dcn_circle_nms.py b/configs/_base_/models/centerpoint_0075_voxel_dcn_circle_nms.py index cb20166e21..fcf6c37c11 100644 --- a/configs/_base_/models/centerpoint_0075_voxel_dcn_circle_nms.py +++ b/configs/_base_/models/centerpoint_0075_voxel_dcn_circle_nms.py @@ -64,7 +64,7 @@ voxel_size=voxel_size[:2], code_size=9), dcn_head=True, - loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( diff --git a/configs/_base_/models/centerpoint_01_voxel.py b/configs/_base_/models/centerpoint_01_voxel.py index a0855b476a..263640cc3f 100644 --- a/configs/_base_/models/centerpoint_01_voxel.py +++ b/configs/_base_/models/centerpoint_01_voxel.py @@ -64,7 +64,7 @@ voxel_size=voxel_size[:2], code_size=9), dcn_head=False, - loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( diff --git a/configs/_base_/models/centerpoint_01_voxel_circle_nms.py b/configs/_base_/models/centerpoint_01_voxel_circle_nms.py index 73a462cac9..c56280254e 100644 --- a/configs/_base_/models/centerpoint_01_voxel_circle_nms.py +++ b/configs/_base_/models/centerpoint_01_voxel_circle_nms.py @@ -64,7 +64,7 @@ voxel_size=voxel_size[:2], code_size=9), dcn_head=False, - loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( diff --git a/configs/_base_/models/centerpoint_01_voxel_dcn.py b/configs/_base_/models/centerpoint_01_voxel_dcn.py index a71d1fe9e9..77ad0a28e3 100644 --- a/configs/_base_/models/centerpoint_01_voxel_dcn.py +++ b/configs/_base_/models/centerpoint_01_voxel_dcn.py @@ -64,7 +64,7 @@ voxel_size=voxel_size[:2], code_size=9), dcn_head=True, - loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( diff --git a/configs/_base_/models/centerpoint_01_voxel_dcn_circle_nms.py b/configs/_base_/models/centerpoint_01_voxel_dcn_circle_nms.py index 8954f87d9e..f17dc3a42f 100644 --- a/configs/_base_/models/centerpoint_01_voxel_dcn_circle_nms.py +++ b/configs/_base_/models/centerpoint_01_voxel_dcn_circle_nms.py @@ -64,7 +64,7 @@ voxel_size=voxel_size[:2], code_size=9), dcn_head=True, - loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( diff --git a/configs/_base_/models/centerpoint_pp.py b/configs/_base_/models/centerpoint_pp.py index 82113498e9..9a48ffd709 100644 --- a/configs/_base_/models/centerpoint_pp.py +++ b/configs/_base_/models/centerpoint_pp.py @@ -63,7 +63,7 @@ voxel_size=voxel_size[:2], code_size=9), dcn_head=False, - loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( diff --git a/configs/_base_/models/centerpoint_pp_circle_nms.py b/configs/_base_/models/centerpoint_pp_circle_nms.py index 9b368854b5..d3770a1570 100644 --- a/configs/_base_/models/centerpoint_pp_circle_nms.py +++ b/configs/_base_/models/centerpoint_pp_circle_nms.py @@ -63,7 +63,7 @@ voxel_size=voxel_size[:2], code_size=9), dcn_head=False, - loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( diff --git a/configs/_base_/models/centerpoint_pp_dcn.py b/configs/_base_/models/centerpoint_pp_dcn.py index 1b17c4f4e1..6987f1343b 100644 --- a/configs/_base_/models/centerpoint_pp_dcn.py +++ b/configs/_base_/models/centerpoint_pp_dcn.py @@ -63,7 +63,7 @@ voxel_size=voxel_size[:2], code_size=9), dcn_head=True, - loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( diff --git a/configs/_base_/models/centerpoint_pp_dcn_circle_nms.py b/configs/_base_/models/centerpoint_pp_dcn_circle_nms.py index c82f434a15..bcdfcd6dff 100644 --- a/configs/_base_/models/centerpoint_pp_dcn_circle_nms.py +++ b/configs/_base_/models/centerpoint_pp_dcn_circle_nms.py @@ -63,7 +63,7 @@ voxel_size=voxel_size[:2], code_size=9), dcn_head=True, - loss_cls=dict(type='GaussianFocalLoss', reduction='sum'), + loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( diff --git a/mmdet3d/models/detectors/centerpoint.py b/mmdet3d/models/detectors/centerpoint.py index b20fd78c1a..1f2e02432c 100644 --- a/mmdet3d/models/detectors/centerpoint.py +++ b/mmdet3d/models/detectors/centerpoint.py @@ -1,21 +1,10 @@ -import mmcv -import torch -from mmcv.parallel import DataContainer as DC -from os import path as osp -from torch import nn as nn -from torch.nn import functional as F - -from mmdet3d.core import (Box3DMode, bbox3d2result, merge_aug_bboxes_3d, - show_result) -from mmdet3d.ops import Voxelization -from mmdet.core import multi_apply +from mmdet3d.core import bbox3d2result from mmdet.models import DETECTORS -from .. import builder -from .base import Base3DDetector +from .mvx_two_stage import MVXTwoStageDetector @DETECTORS.register_module() -class CenterPoint(Base3DDetector): +class CenterPoint(MVXTwoStageDetector): """Base class of Multi-modality VoxelNet.""" def __init__(self, @@ -33,153 +22,12 @@ def __init__(self, train_cfg=None, test_cfg=None, pretrained=None): - super(CenterPoint, self).__init__() - - if pts_voxel_layer: - self.pts_voxel_layer = Voxelization(**pts_voxel_layer) - if pts_voxel_encoder: - self.pts_voxel_encoder = builder.build_voxel_encoder( - pts_voxel_encoder) - if pts_middle_encoder: - self.pts_middle_encoder = builder.build_middle_encoder( - pts_middle_encoder) - if pts_backbone: - self.pts_backbone = builder.build_backbone(pts_backbone) - if pts_fusion_layer: - self.pts_fusion_layer = builder.build_fusion_layer( - pts_fusion_layer) - if pts_neck is not None: - self.pts_neck = builder.build_neck(pts_neck) - if pts_bbox_head: - pts_train_cfg = train_cfg.pts if train_cfg else None - pts_bbox_head.update(train_cfg=pts_train_cfg) - pts_test_cfg = test_cfg.pts if test_cfg else None - pts_bbox_head.update(test_cfg=pts_test_cfg) - self.pts_bbox_head = builder.build_head(pts_bbox_head) - - if img_backbone: - self.img_backbone = builder.build_backbone(img_backbone) - if img_neck is not None: - self.img_neck = builder.build_neck(img_neck) - if img_rpn_head is not None: - self.img_rpn_head = builder.build_head(img_rpn_head) - if img_roi_head is not None: - self.img_roi_head = builder.build_head(img_roi_head) - - self.train_cfg = train_cfg - self.test_cfg = test_cfg - self.init_weights(pretrained=pretrained) - - def init_weights(self, pretrained=None): - """Initialize model weights.""" - super(CenterPoint, self).init_weights(pretrained) - if pretrained is None: - img_pretrained = None - pts_pretrained = None - elif isinstance(pretrained, dict): - img_pretrained = pretrained.get('img', None) - pts_pretrained = pretrained.get('pts', None) - else: - raise ValueError( - f'pretrained should be a dict, got {type(pretrained)}') - if self.with_img_backbone: - self.img_backbone.init_weights(pretrained=img_pretrained) - if self.with_pts_backbone: - self.pts_backbone.init_weights(pretrained=pts_pretrained) - if self.with_img_neck: - if isinstance(self.img_neck, nn.Sequential): - for m in self.img_neck: - m.init_weights() - else: - self.img_neck.init_weights() - - if self.with_img_roi_head: - self.img_roi_head.init_weights(img_pretrained) - if self.with_img_rpn: - self.img_rpn_head.init_weights() - if self.with_pts_bbox: - self.pts_bbox_head.init_weights() - - @property - def with_img_shared_head(self): - """bool: Whether the detector has a shared head in image branch.""" - return hasattr(self, - 'img_shared_head') and self.img_shared_head is not None - - @property - def with_pts_bbox(self): - """bool: Whether the detector has a 3D box head.""" - return hasattr(self, - 'pts_bbox_head') and self.pts_bbox_head is not None - - @property - def with_img_bbox(self): - """bool: Whether the detector has a 2D image box head.""" - return hasattr(self, - 'img_bbox_head') and self.img_bbox_head is not None - - @property - def with_img_backbone(self): - """bool: Whether the detector has a 2D image backbone.""" - return hasattr(self, 'img_backbone') and self.img_backbone is not None - - @property - def with_pts_backbone(self): - """bool: Whether the detector has a 3D backbone.""" - return hasattr(self, 'pts_backbone') and self.pts_backbone is not None - - @property - def with_fusion(self): - """bool: Whether the detector has a fusion layer.""" - return hasattr(self, - 'pts_fusion_layer') and self.fusion_layer is not None - - @property - def with_img_neck(self): - """bool: Whether the detector has a neck in image branch.""" - return hasattr(self, 'img_neck') and self.img_neck is not None - - @property - def with_pts_neck(self): - """bool: Whether the detector has a neck in 3D detector branch.""" - return hasattr(self, 'pts_neck') and self.pts_neck is not None - - @property - def with_img_rpn(self): - """bool: Whether the detector has a 2D RPN in image detector branch.""" - return hasattr(self, 'img_rpn_head') and self.img_rpn_head is not None - - @property - def with_img_roi_head(self): - """bool: Whether the detector has a RoI Head in image branch.""" - return hasattr(self, 'img_roi_head') and self.img_roi_head is not None - - @property - def with_voxel_encoder(self): - """bool: Whether the detector has a voxel encoder.""" - return hasattr(self, - 'voxel_encoder') and self.voxel_encoder is not None - - @property - def with_middle_encoder(self): - """bool: Whether the detector has a middle encoder.""" - return hasattr(self, - 'middle_encoder') and self.middle_encoder is not None - - def extract_img_feat(self, img, img_metas): - """Extract features of images.""" - if self.with_img_backbone: - if img.dim() == 5 and img.size(0) == 1: - img.squeeze_() - elif img.dim() == 5 and img.size(0) > 1: - B, N, C, H, W = img.size() - img = img.view(B * N, C, H, W) - img_feats = self.img_backbone(img) - else: - return None - if self.with_img_neck: - img_feats = self.img_neck(img_feats) - return img_feats + super(CenterPoint, + self).__init__(pts_voxel_layer, pts_voxel_encoder, + pts_middle_encoder, pts_fusion_layer, + img_backbone, pts_backbone, img_neck, pts_neck, + pts_bbox_head, img_roi_head, img_rpn_head, + train_cfg, test_cfg, pretrained) def extract_pts_feat(self, pts, img_feats, img_metas): """Extract features of points.""" @@ -195,92 +43,6 @@ def extract_pts_feat(self, pts, img_feats, img_metas): x = self.pts_neck(x) return x - def extract_feat(self, points, img, img_metas): - """Extract features from images and points.""" - img_feats = self.extract_img_feat(img, img_metas) - pts_feats = self.extract_pts_feat(points, img_feats, img_metas) - return (img_feats, pts_feats) - - @torch.no_grad() - def voxelize(self, points): - """Apply dynamic voxelization to points. - - Args: - points (list[torch.Tensor]): Points of each sample. - - Returns: - tuple[torch.Tensor]: Concatenated points, number of points - per voxel, and coordinates. - """ - voxels, coors, num_points = [], [], [] - for res in points: - res_voxels, res_coors, res_num_points = self.pts_voxel_layer(res) - voxels.append(res_voxels) - coors.append(res_coors) - num_points.append(res_num_points) - voxels = torch.cat(voxels, dim=0) - num_points = torch.cat(num_points, dim=0) - coors_batch = [] - for i, coor in enumerate(coors): - coor_pad = F.pad(coor, (1, 0), mode='constant', value=i) - coors_batch.append(coor_pad) - coors_batch = torch.cat(coors_batch, dim=0) - return voxels, num_points, coors_batch - - def forward_train(self, - points=None, - img_metas=None, - gt_bboxes_3d=None, - gt_labels_3d=None, - gt_labels=None, - gt_bboxes=None, - img=None, - proposals=None, - gt_bboxes_ignore=None): - """Forward training function. - - Args: - points (list[torch.Tensor], optional): Points of each sample. - Defaults to None. - img_metas (list[dict], optional): Meta information of each sample. - Defaults to None. - gt_bboxes_3d (list[:obj:`BaseInstance3DBoxes`], optional): - Ground truth 3D boxes. Defaults to None. - gt_labels_3d (list[torch.Tensor], optional): Ground truth labels - of 3D boxes. Defaults to None. - gt_labels (list[torch.Tensor], optional): Ground truth labels - of 2D boxes in images. Defaults to None. - gt_bboxes (list[torch.Tensor], optional): Ground truth 2D boxes in - images. Defaults to None. - img (torch.Tensor optional): Images of each sample with shape - (N, C, H, W). Defaults to None. - proposals ([list[torch.Tensor], optional): Predicted proposals - used for training Fast RCNN. Defaults to None. - gt_bboxes_ignore (list[torch.Tensor], optional): Ground truth - 2D boxes in images to be ignored. Defaults to None. - - Returns: - dict: Losses of different branches. - """ - img_feats, pts_feats = self.extract_feat( - points, img=img, img_metas=img_metas) - losses = dict() - if pts_feats: - losses_pts = self.forward_pts_train(pts_feats, gt_bboxes_3d, - gt_labels_3d, img_metas, - gt_bboxes_ignore) - losses.update(losses_pts) - if img_feats: - losses_img = self.forward_img_train( - img_feats, - img_metas=img_metas, - gt_bboxes=gt_bboxes, - gt_labels=gt_labels, - gt_bboxes_ignore=gt_bboxes_ignore, - proposals=proposals) - losses.update(losses_img) - return losses - def forward_pts_train(self, pts_feats, gt_bboxes_3d, @@ -307,78 +69,6 @@ def forward_pts_train(self, losses = self.pts_bbox_head.loss(*loss_inputs) return losses - def forward_img_train(self, - x, - img_metas, - gt_bboxes, - gt_labels, - gt_bboxes_ignore=None, - proposals=None, - **kwargs): - """Forward function for image branch. - - This function works similar to the forward function of Faster R-CNN. - - Args: - x (list[torch.Tensor]): Image features of shape (B, C, H, W) - of multiple levels. - img_metas (list[dict]): Meta information of images. - gt_bboxes (list[torch.Tensor]): Ground truth boxes of each image - sample. - gt_labels (list[torch.Tensor]): Ground truth labels of boxes. - gt_bboxes_ignore (list[torch.Tensor], optional): Ground truth - boxes to be ignored. Defaults to None. - proposals (list[torch.Tensor], optional): Proposals of each sample. - Defaults to None. - - Returns: - dict: Losses of each branch. - """ - losses = dict() - # RPN forward and loss - if self.with_img_rpn: - rpn_outs = self.img_rpn_head(x) - rpn_loss_inputs = rpn_outs + (gt_bboxes, img_metas, - self.train_cfg.img_rpn) - rpn_losses = self.img_rpn_head.loss( - *rpn_loss_inputs, gt_bboxes_ignore=gt_bboxes_ignore) - losses.update(rpn_losses) - - proposal_cfg = self.train_cfg.get('img_rpn_proposal', - self.test_cfg.img_rpn) - proposal_inputs = rpn_outs + (img_metas, proposal_cfg) - proposal_list = self.img_rpn_head.get_bboxes(*proposal_inputs) - else: - proposal_list = proposals - - # bbox head forward and loss - if self.with_img_bbox: - # bbox head forward and loss - img_roi_losses = self.img_roi_head.forward_train( - x, img_metas, proposal_list, gt_bboxes, gt_labels, - gt_bboxes_ignore, **kwargs) - losses.update(img_roi_losses) - - return losses - - def simple_test_img(self, x, img_metas, proposals=None, rescale=False): - """Test without augmentation.""" - if proposals is None: - proposal_list = self.simple_test_rpn(x, img_metas, - self.test_cfg.img_rpn) - else: - proposal_list = proposals - - return self.img_roi_head.simple_test( - x, proposal_list, img_metas, rescale=rescale) - - def simple_test_rpn(self, x, img_metas, rpn_test_cfg): - """RPN test function.""" - rpn_outs = self.img_rpn_head(x) - proposal_inputs = rpn_outs + (img_metas, rpn_test_cfg) - proposal_list = self.img_rpn_head.get_bboxes(*proposal_inputs) - return proposal_list - def simple_test_pts(self, x, img_metas, rescale=False): """Test function of point cloud branch.""" outs = self.pts_bbox_head(x) @@ -389,99 +79,3 @@ def simple_test_pts(self, x, img_metas, rescale=False): for bboxes, scores, labels in bbox_list ] return bbox_results[0] - - def simple_test(self, points, img_metas, img=None, rescale=False): - """Test function without augmentaiton.""" - img_feats, pts_feats = self.extract_feat( - points, img=img, img_metas=img_metas) - - bbox_list = dict() - if pts_feats and self.with_pts_bbox: - bbox_pts = self.simple_test_pts( - pts_feats, img_metas, rescale=rescale) - bbox_list.update(pts_bbox=bbox_pts) - if img_feats and self.with_img_bbox: - bbox_img = self.simple_test_img( - img_feats, img_metas, rescale=rescale) - bbox_list.update(img_bbox=bbox_img) - return bbox_list - - def aug_test(self, points, img_metas, imgs=None, rescale=False): - """Test function with augmentaiton.""" - img_feats, pts_feats = self.extract_feats(points, img_metas, imgs) - - bbox_list = dict() - if pts_feats and self.with_pts_bbox: - bbox_pts = self.aug_test_pts(pts_feats, img_metas, rescale) - bbox_list.update(pts_bbox=bbox_pts) - return bbox_list - - def extract_feats(self, points, img_metas, imgs=None): - """Extract point and image features of multiple samples.""" - if imgs is None: - imgs = [None] * len(img_metas) - img_feats, pts_feats = multi_apply(self.extract_feat, points, imgs, - img_metas) - return img_feats, pts_feats - - def aug_test_pts(self, feats, img_metas, rescale=False): - """Test function of point cloud branch with augmentaiton.""" - # only support aug_test for one sample - aug_bboxes = [] - for x, img_meta in zip(feats, img_metas): - outs = self.pts_bbox_head(x) - bbox_list = self.pts_bbox_head.get_bboxes( - *outs, img_meta, rescale=rescale) - bbox_list = [ - dict(boxes_3d=bboxes, scores_3d=scores, labels_3d=labels) - for bboxes, scores, labels in bbox_list - ] - aug_bboxes.append(bbox_list[0]) - - # after merging, bboxes will be rescaled to the original image size - merged_bboxes = merge_aug_bboxes_3d(aug_bboxes, img_metas, - self.pts_bbox_head.test_cfg) - return merged_bboxes - - def show_results(self, data, result, out_dir): - """Results visualization. - - Args: - data (dict): Input points and the information of the sample. - result (dict): Prediction results. - out_dir (str): Output directory of visualization result. - """ - if isinstance(data['points'][0], DC): - points = data['points'][0]._data[0][0].numpy() - elif mmcv.is_list_of(data['points'][0], torch.Tensor): - points = data['points'][0][0] - else: - ValueError(f"Unsupported data type {type(data['points'][0])} " - f'for visualization!') - if isinstance(data['img_metas'][0], DC): - pts_filename = data['img_metas'][0]._data[0][0]['pts_filename'] - box_mode_3d = data['img_metas'][0]._data[0][0]['box_mode_3d'] - elif mmcv.is_list_of(data['img_metas'][0], dict): - pts_filename = data['img_metas'][0][0]['pts_filename'] - box_mode_3d = data['img_metas'][0][0]['box_mode_3d'] - else: - ValueError(f"Unsupported data type {type(data['img_metas'][0])} " - f'for visualization!') - file_name = osp.split(pts_filename)[-1].split('.')[0] - - assert out_dir is not None, 'Expect out_dir, got none.' - inds = result['pts_bbox']['scores_3d'] > 0.1 - pred_bboxes = result['pts_bbox']['boxes_3d'][inds].tensor.numpy() - # for now we convert points into depth mode - if box_mode_3d == Box3DMode.DEPTH: - pred_bboxes[..., 2] += pred_bboxes[..., 5] / 2 - elif box_mode_3d == Box3DMode.CAM or box_mode_3d == Box3DMode.LIDAR: - points = points[..., [1, 0, 2]] - points[..., 0] *= -1 - pred_bboxes = Box3DMode.convert(pred_bboxes, box_mode_3d, - Box3DMode.DEPTH) - pred_bboxes[..., 2] += pred_bboxes[..., 5] / 2 - else: - ValueError( - f'Unsupported box_mode_3d {box_mode_3d} for convertion!') - show_result(points, None, pred_bboxes, out_dir, file_name) From adc7a4f97cdbbbb36dffce600583641a8ebd249e Mon Sep 17 00:00:00 2001 From: liyinhao Date: Sun, 13 Sep 2020 11:56:18 +0800 Subject: [PATCH 08/21] Change names of configs. --- ... => centerpoint_0075voxel_second_secfpn_circlenms_nus.py} | 2 +- ...centerpoint_0075voxel_second_secfpn_dcn_circlenms_nus.py} | 2 +- ...dcn.py => centerpoint_0075voxel_second_secfpn_dcn_nus.py} | 2 +- ...5_voxel.py => centerpoint_0075voxel_second_secfpn_nus.py} | 2 +- ...py => centerpoint_01voxel_second_secfpn_circlenms_nus.py} | 2 +- ...> centerpoint_01voxel_second_secfpn_dcn_circlenms_nus.py} | 2 +- ...l_dcn.py => centerpoint_01voxel_second_secfpn_dcn_nus.py} | 2 +- ..._01_voxel.py => centerpoint_01voxel_second_secfpn_nus.py} | 2 +- ....py => centerpoint_pillar_second_secfpn_circlenms_nus.py} | 2 +- ...=> centerpoint_pillar_second_secfpn_dcn_circlenms_nus.py} | 2 +- ...pp_dcn.py => centerpoint_pillar_second_secfpn_dcn_nus.py} | 2 +- ...erpoint_pp.py => centerpoint_pillar_second_secfpn_nus.py} | 2 +- ...enterpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py} | 2 +- ..._0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py} | 2 +- ...rpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py} | 2 +- ...5voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py} | 4 ++-- ... centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py} | 2 +- ...nt_01voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py} | 2 +- ...terpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py} | 2 +- ...1voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py} | 3 ++- ...> centerpoint_pillar_second_secfpn_4x8_cyclic_20e_nus.py} | 2 +- ...int_pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py} | 5 ++++- ...nterpoint_pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py} | 3 ++- ...pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py} | 2 +- 24 files changed, 30 insertions(+), 25 deletions(-) rename configs/_base_/models/{centerpoint_0075_voxel_circle_nms.py => centerpoint_0075voxel_second_secfpn_circlenms_nus.py} (97%) rename configs/_base_/models/{centerpoint_0075_voxel_dcn_circle_nms.py => centerpoint_0075voxel_second_secfpn_dcn_circlenms_nus.py} (97%) rename configs/_base_/models/{centerpoint_0075_voxel_dcn.py => centerpoint_0075voxel_second_secfpn_dcn_nus.py} (97%) rename configs/_base_/models/{centerpoint_0075_voxel.py => centerpoint_0075voxel_second_secfpn_nus.py} (97%) rename configs/_base_/models/{centerpoint_01_voxel_circle_nms.py => centerpoint_01voxel_second_secfpn_circlenms_nus.py} (97%) rename configs/_base_/models/{centerpoint_01_voxel_dcn_circle_nms.py => centerpoint_01voxel_second_secfpn_dcn_circlenms_nus.py} (97%) rename configs/_base_/models/{centerpoint_01_voxel_dcn.py => centerpoint_01voxel_second_secfpn_dcn_nus.py} (97%) rename configs/_base_/models/{centerpoint_01_voxel.py => centerpoint_01voxel_second_secfpn_nus.py} (97%) rename configs/_base_/models/{centerpoint_pp_circle_nms.py => centerpoint_pillar_second_secfpn_circlenms_nus.py} (97%) rename configs/_base_/models/{centerpoint_pp_dcn_circle_nms.py => centerpoint_pillar_second_secfpn_dcn_circlenms_nus.py} (97%) rename configs/_base_/models/{centerpoint_pp_dcn.py => centerpoint_pillar_second_secfpn_dcn_nus.py} (97%) rename configs/_base_/models/{centerpoint_pp.py => centerpoint_pillar_second_secfpn_nus.py} (97%) rename configs/centerpoint/{centerpoint_0075_voxel.py => centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py} (98%) rename configs/centerpoint/{centerpoint_0075_voxel_dcn.py => centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py} (98%) rename configs/centerpoint/{centerpoint_0075_voxel_circle_nms.py => centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py} (98%) rename configs/centerpoint/{centerpoint_0075_voxel_dcn_circle_nms.py => centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py} (97%) rename configs/centerpoint/{centerpoint_01_voxel_circle_nms.py => centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py} (98%) rename configs/centerpoint/{centerpoint_01_voxel_dcn_circle_nms.py => centerpoint_01voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py} (98%) rename configs/centerpoint/{centerpoint_01_voxel_dcn.py => centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py} (98%) rename configs/centerpoint/{centerpoint_01_voxel.py => centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py} (98%) rename configs/centerpoint/{centerpoint_pp_circle_nms.py => centerpoint_pillar_second_secfpn_4x8_cyclic_20e_nus.py} (98%) rename configs/centerpoint/{centerpoint_pp.py => centerpoint_pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py} (97%) rename configs/centerpoint/{centerpoint_pp_dcn.py => centerpoint_pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py} (98%) rename configs/centerpoint/{centerpoint_pp_dcn_circle_nms.py => centerpoint_pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py} (98%) diff --git a/configs/_base_/models/centerpoint_0075_voxel_circle_nms.py b/configs/_base_/models/centerpoint_0075voxel_second_secfpn_circlenms_nus.py similarity index 97% rename from configs/_base_/models/centerpoint_0075_voxel_circle_nms.py rename to configs/_base_/models/centerpoint_0075voxel_second_secfpn_circlenms_nus.py index a73c0060f6..12021026b7 100644 --- a/configs/_base_/models/centerpoint_0075_voxel_circle_nms.py +++ b/configs/_base_/models/centerpoint_0075voxel_second_secfpn_circlenms_nus.py @@ -65,7 +65,7 @@ code_size=9), dcn_head=False, loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) + loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( pts=dict( diff --git a/configs/_base_/models/centerpoint_0075_voxel_dcn_circle_nms.py b/configs/_base_/models/centerpoint_0075voxel_second_secfpn_dcn_circlenms_nus.py similarity index 97% rename from configs/_base_/models/centerpoint_0075_voxel_dcn_circle_nms.py rename to configs/_base_/models/centerpoint_0075voxel_second_secfpn_dcn_circlenms_nus.py index fcf6c37c11..52dfc71e2f 100644 --- a/configs/_base_/models/centerpoint_0075_voxel_dcn_circle_nms.py +++ b/configs/_base_/models/centerpoint_0075voxel_second_secfpn_dcn_circlenms_nus.py @@ -65,7 +65,7 @@ code_size=9), dcn_head=True, loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) + loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( pts=dict( diff --git a/configs/_base_/models/centerpoint_0075_voxel_dcn.py b/configs/_base_/models/centerpoint_0075voxel_second_secfpn_dcn_nus.py similarity index 97% rename from configs/_base_/models/centerpoint_0075_voxel_dcn.py rename to configs/_base_/models/centerpoint_0075voxel_second_secfpn_dcn_nus.py index c2e76b91ab..f3be59d732 100644 --- a/configs/_base_/models/centerpoint_0075_voxel_dcn.py +++ b/configs/_base_/models/centerpoint_0075voxel_second_secfpn_dcn_nus.py @@ -65,7 +65,7 @@ code_size=9), dcn_head=True, loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) + loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( pts=dict( diff --git a/configs/_base_/models/centerpoint_0075_voxel.py b/configs/_base_/models/centerpoint_0075voxel_second_secfpn_nus.py similarity index 97% rename from configs/_base_/models/centerpoint_0075_voxel.py rename to configs/_base_/models/centerpoint_0075voxel_second_secfpn_nus.py index 18d1c4ac8a..1ade2e00fb 100644 --- a/configs/_base_/models/centerpoint_0075_voxel.py +++ b/configs/_base_/models/centerpoint_0075voxel_second_secfpn_nus.py @@ -65,7 +65,7 @@ code_size=9), dcn_head=False, loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) + loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( pts=dict( diff --git a/configs/_base_/models/centerpoint_01_voxel_circle_nms.py b/configs/_base_/models/centerpoint_01voxel_second_secfpn_circlenms_nus.py similarity index 97% rename from configs/_base_/models/centerpoint_01_voxel_circle_nms.py rename to configs/_base_/models/centerpoint_01voxel_second_secfpn_circlenms_nus.py index c56280254e..5d19573f26 100644 --- a/configs/_base_/models/centerpoint_01_voxel_circle_nms.py +++ b/configs/_base_/models/centerpoint_01voxel_second_secfpn_circlenms_nus.py @@ -65,7 +65,7 @@ code_size=9), dcn_head=False, loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) + loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( pts=dict( diff --git a/configs/_base_/models/centerpoint_01_voxel_dcn_circle_nms.py b/configs/_base_/models/centerpoint_01voxel_second_secfpn_dcn_circlenms_nus.py similarity index 97% rename from configs/_base_/models/centerpoint_01_voxel_dcn_circle_nms.py rename to configs/_base_/models/centerpoint_01voxel_second_secfpn_dcn_circlenms_nus.py index f17dc3a42f..47444417e2 100644 --- a/configs/_base_/models/centerpoint_01_voxel_dcn_circle_nms.py +++ b/configs/_base_/models/centerpoint_01voxel_second_secfpn_dcn_circlenms_nus.py @@ -65,7 +65,7 @@ code_size=9), dcn_head=True, loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) + loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( pts=dict( diff --git a/configs/_base_/models/centerpoint_01_voxel_dcn.py b/configs/_base_/models/centerpoint_01voxel_second_secfpn_dcn_nus.py similarity index 97% rename from configs/_base_/models/centerpoint_01_voxel_dcn.py rename to configs/_base_/models/centerpoint_01voxel_second_secfpn_dcn_nus.py index 77ad0a28e3..b95ff5fd8f 100644 --- a/configs/_base_/models/centerpoint_01_voxel_dcn.py +++ b/configs/_base_/models/centerpoint_01voxel_second_secfpn_dcn_nus.py @@ -65,7 +65,7 @@ code_size=9), dcn_head=True, loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) + loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( pts=dict( diff --git a/configs/_base_/models/centerpoint_01_voxel.py b/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py similarity index 97% rename from configs/_base_/models/centerpoint_01_voxel.py rename to configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py index 263640cc3f..a823ad84f6 100644 --- a/configs/_base_/models/centerpoint_01_voxel.py +++ b/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py @@ -65,7 +65,7 @@ code_size=9), dcn_head=False, loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) + loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( pts=dict( diff --git a/configs/_base_/models/centerpoint_pp_circle_nms.py b/configs/_base_/models/centerpoint_pillar_second_secfpn_circlenms_nus.py similarity index 97% rename from configs/_base_/models/centerpoint_pp_circle_nms.py rename to configs/_base_/models/centerpoint_pillar_second_secfpn_circlenms_nus.py index d3770a1570..fe66f2a763 100644 --- a/configs/_base_/models/centerpoint_pp_circle_nms.py +++ b/configs/_base_/models/centerpoint_pillar_second_secfpn_circlenms_nus.py @@ -64,7 +64,7 @@ code_size=9), dcn_head=False, loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) + loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( pts=dict( diff --git a/configs/_base_/models/centerpoint_pp_dcn_circle_nms.py b/configs/_base_/models/centerpoint_pillar_second_secfpn_dcn_circlenms_nus.py similarity index 97% rename from configs/_base_/models/centerpoint_pp_dcn_circle_nms.py rename to configs/_base_/models/centerpoint_pillar_second_secfpn_dcn_circlenms_nus.py index bcdfcd6dff..7bf30247e2 100644 --- a/configs/_base_/models/centerpoint_pp_dcn_circle_nms.py +++ b/configs/_base_/models/centerpoint_pillar_second_secfpn_dcn_circlenms_nus.py @@ -64,7 +64,7 @@ code_size=9), dcn_head=True, loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) + loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( pts=dict( diff --git a/configs/_base_/models/centerpoint_pp_dcn.py b/configs/_base_/models/centerpoint_pillar_second_secfpn_dcn_nus.py similarity index 97% rename from configs/_base_/models/centerpoint_pp_dcn.py rename to configs/_base_/models/centerpoint_pillar_second_secfpn_dcn_nus.py index 6987f1343b..cd4383bed9 100644 --- a/configs/_base_/models/centerpoint_pp_dcn.py +++ b/configs/_base_/models/centerpoint_pillar_second_secfpn_dcn_nus.py @@ -64,7 +64,7 @@ code_size=9), dcn_head=True, loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) + loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( pts=dict( diff --git a/configs/_base_/models/centerpoint_pp.py b/configs/_base_/models/centerpoint_pillar_second_secfpn_nus.py similarity index 97% rename from configs/_base_/models/centerpoint_pp.py rename to configs/_base_/models/centerpoint_pillar_second_secfpn_nus.py index 9a48ffd709..7a6f459ed4 100644 --- a/configs/_base_/models/centerpoint_pp.py +++ b/configs/_base_/models/centerpoint_pillar_second_secfpn_nus.py @@ -64,7 +64,7 @@ code_size=9), dcn_head=False, loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_reg=dict(type='L1Loss', reduction='none', loss_weight=0.25))) + loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) # model training and testing settings train_cfg = dict( pts=dict( diff --git a/configs/centerpoint/centerpoint_0075_voxel.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py similarity index 98% rename from configs/centerpoint/centerpoint_0075_voxel.py rename to configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py index c0e40f84ab..910fc081ac 100644 --- a/configs/centerpoint/centerpoint_0075_voxel.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py @@ -1,5 +1,5 @@ _base_ = [ - '../_base_/models/centerpoint_0075_voxel.py', + '../_base_/models/centerpoint_0075voxel_second_secfpn_nus.py', '../_base_/default_runtime.py' ] diff --git a/configs/centerpoint/centerpoint_0075_voxel_dcn.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py similarity index 98% rename from configs/centerpoint/centerpoint_0075_voxel_dcn.py rename to configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py index b81fe491b1..2c282319bb 100644 --- a/configs/centerpoint/centerpoint_0075_voxel_dcn.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py @@ -1,5 +1,5 @@ _base_ = [ - '../_base_/models/centerpoint_0075_voxel_dcn.py', + '../_base_/models/centerpoint_0075voxel_second_secfpn_circlenms_nus.py', '../_base_/default_runtime.py' ] diff --git a/configs/centerpoint/centerpoint_0075_voxel_circle_nms.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py similarity index 98% rename from configs/centerpoint/centerpoint_0075_voxel_circle_nms.py rename to configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py index e8ca241e9c..3d5004a260 100644 --- a/configs/centerpoint/centerpoint_0075_voxel_circle_nms.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py @@ -1,5 +1,5 @@ _base_ = [ - '../_base_/models/centerpoint_0075_voxel_circle_nms.py', + '../_base_/models/centerpoint_0075voxel_second_secfpn_dcn_nus.py', '../_base_/default_runtime.py' ] diff --git a/configs/centerpoint/centerpoint_0075_voxel_dcn_circle_nms.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py similarity index 97% rename from configs/centerpoint/centerpoint_0075_voxel_dcn_circle_nms.py rename to configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py index 92da5b2273..ad63bac5df 100644 --- a/configs/centerpoint/centerpoint_0075_voxel_dcn_circle_nms.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py @@ -1,6 +1,6 @@ _base_ = [ - '../_base_/models/centerpoint_0075_voxel_dcn_circle_nms.py', - '../_base_/default_runtime.py' + '../_base_/models/centerpoint_0075voxel_second_secfpn_dcn' + '_circlenms_nus.py', '../_base_/default_runtime.py' ] # If point cloud range is changed, the models should also change their point diff --git a/configs/centerpoint/centerpoint_01_voxel_circle_nms.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py similarity index 98% rename from configs/centerpoint/centerpoint_01_voxel_circle_nms.py rename to configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py index 5a11128615..9989acec3d 100644 --- a/configs/centerpoint/centerpoint_01_voxel_circle_nms.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py @@ -1,5 +1,5 @@ _base_ = [ - '../_base_/models/centerpoint_01_voxel_circle_nms.py', + '../_base_/models/centerpoint_01voxel_second_secfpn_nus.py', '../_base_/default_runtime.py' ] diff --git a/configs/centerpoint/centerpoint_01_voxel_dcn_circle_nms.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py similarity index 98% rename from configs/centerpoint/centerpoint_01_voxel_dcn_circle_nms.py rename to configs/centerpoint/centerpoint_01voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py index 632fab353e..3180d0b0ba 100644 --- a/configs/centerpoint/centerpoint_01_voxel_dcn_circle_nms.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py @@ -1,5 +1,5 @@ _base_ = [ - '../_base_/models/centerpoint_01_voxel_dcn_circle_nms.py', + '../_base_/models/centerpoint_01voxel_second_secfpn_circlenms_nus.py', '../_base_/default_runtime.py' ] diff --git a/configs/centerpoint/centerpoint_01_voxel_dcn.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py similarity index 98% rename from configs/centerpoint/centerpoint_01_voxel_dcn.py rename to configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py index fb99d0e7c1..a592b9fc80 100644 --- a/configs/centerpoint/centerpoint_01_voxel_dcn.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py @@ -1,5 +1,5 @@ _base_ = [ - '../_base_/models/centerpoint_01_voxel_dcn.py', + '../_base_/models/centerpoint_01voxel_second_secfpn_dcn_nus.py', '../_base_/default_runtime.py' ] diff --git a/configs/centerpoint/centerpoint_01_voxel.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py similarity index 98% rename from configs/centerpoint/centerpoint_01_voxel.py rename to configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py index 8c2d4ef08e..23ea8adc5d 100644 --- a/configs/centerpoint/centerpoint_01_voxel.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py @@ -1,5 +1,6 @@ _base_ = [ - '../_base_/models/centerpoint_01_voxel.py', '../_base_/default_runtime.py' + '../_base_/models/centerpoint_01voxel_second_secfpn_dcn_circlenms_nus.py', + '../_base_/default_runtime.py' ] # If point cloud range is changed, the models should also change their point diff --git a/configs/centerpoint/centerpoint_pp_circle_nms.py b/configs/centerpoint/centerpoint_pillar_second_secfpn_4x8_cyclic_20e_nus.py similarity index 98% rename from configs/centerpoint/centerpoint_pp_circle_nms.py rename to configs/centerpoint/centerpoint_pillar_second_secfpn_4x8_cyclic_20e_nus.py index dabe345a4f..9f604ba83d 100644 --- a/configs/centerpoint/centerpoint_pp_circle_nms.py +++ b/configs/centerpoint/centerpoint_pillar_second_secfpn_4x8_cyclic_20e_nus.py @@ -1,5 +1,5 @@ _base_ = [ - '../_base_/models/centerpoint_pp_circle_nms.py', + '../_base_/models/centerpoint_pillar_second_secfpn_nus.py', '../_base_/default_runtime.py' ] diff --git a/configs/centerpoint/centerpoint_pp.py b/configs/centerpoint/centerpoint_pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py similarity index 97% rename from configs/centerpoint/centerpoint_pp.py rename to configs/centerpoint/centerpoint_pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py index 9f2e0fc824..70645e6dab 100644 --- a/configs/centerpoint/centerpoint_pp.py +++ b/configs/centerpoint/centerpoint_pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py @@ -1,4 +1,7 @@ -_base_ = ['../_base_/models/centerpoint_pp.py', '../_base_/default_runtime.py'] +_base_ = [ + '../_base_/models/centerpoint_pillar_second_secfpn_circlenms_nus.py', + '../_base_/default_runtime.py' +] # If point cloud range is changed, the models should also change their point # cloud range accordingly diff --git a/configs/centerpoint/centerpoint_pp_dcn.py b/configs/centerpoint/centerpoint_pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py similarity index 98% rename from configs/centerpoint/centerpoint_pp_dcn.py rename to configs/centerpoint/centerpoint_pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py index 4ba1e159e4..bc892a2929 100644 --- a/configs/centerpoint/centerpoint_pp_dcn.py +++ b/configs/centerpoint/centerpoint_pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py @@ -1,5 +1,6 @@ _base_ = [ - '../_base_/models/centerpoint_pp_dcn.py', '../_base_/default_runtime.py' + '../_base_/models/centerpoint_pillar_second_secfpn_dcn_nus.py', + '../_base_/default_runtime.py' ] # If point cloud range is changed, the models should also change their point diff --git a/configs/centerpoint/centerpoint_pp_dcn_circle_nms.py b/configs/centerpoint/centerpoint_pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py similarity index 98% rename from configs/centerpoint/centerpoint_pp_dcn_circle_nms.py rename to configs/centerpoint/centerpoint_pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py index 2d595aa24e..a414eb73d5 100644 --- a/configs/centerpoint/centerpoint_pp_dcn_circle_nms.py +++ b/configs/centerpoint/centerpoint_pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py @@ -1,5 +1,5 @@ _base_ = [ - '../_base_/models/centerpoint_pp_dcn_circle_nms.py', + '../_base_/models/centerpoint_pillar_second_secfpn_dcn_circlenms_nus.py', '../_base_/default_runtime.py' ] From 11b448c7efd5963eef077bf4116d27c4f3dfc98b Mon Sep 17 00:00:00 2001 From: liyinhao Date: Sun, 13 Sep 2020 20:31:35 +0800 Subject: [PATCH 09/21] Reduce configs. --- ...t_0075voxel_second_secfpn_circlenms_nus.py | 94 ------------------ ...75voxel_second_secfpn_dcn_circlenms_nus.py | 94 ------------------ ...erpoint_0075voxel_second_secfpn_dcn_nus.py | 97 ------------------- ...centerpoint_0075voxel_second_secfpn_nus.py | 97 ------------------- ...int_01voxel_second_secfpn_circlenms_nus.py | 94 ------------------ ...01voxel_second_secfpn_dcn_circlenms_nus.py | 94 ------------------ ...nterpoint_01voxel_second_secfpn_dcn_nus.py | 97 ------------------- ...centerpoint_02pillar_second_secfpn_nus.py} | 0 ...oint_pillar_second_secfpn_circlenms_nus.py | 93 ------------------ ..._pillar_second_secfpn_dcn_circlenms_nus.py | 93 ------------------ ...enterpoint_pillar_second_secfpn_dcn_nus.py | 96 ------------------ ...5voxel_second_secfpn_4x8_cyclic_20e_nus.py | 20 +++- ...ond_secfpn_circlenms_4x8_cyclic_20e_nus.py | 22 ++++- ...el_second_secfpn_dcn_4x8_cyclic_20e_nus.py | 21 +++- ...secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py | 23 +++++ ...ond_secfpn_circlenms_4x8_cyclic_20e_nus.py | 4 +- ...el_second_secfpn_dcn_4x8_cyclic_20e_nus.py | 4 +- ...secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py | 6 +- ...illar_second_secfpn_4x8_cyclic_20e_nus.py} | 2 +- ...nd_secfpn_circlenms_4x8_cyclic_20e_nus.py} | 4 +- ...r_second_secfpn_dcn_4x8_cyclic_20e_nus.py} | 11 ++- ...ecfpn_dcn_circlenms_4x8_cyclic_20e_nus.py} | 12 ++- 22 files changed, 115 insertions(+), 963 deletions(-) delete mode 100644 configs/_base_/models/centerpoint_0075voxel_second_secfpn_circlenms_nus.py delete mode 100644 configs/_base_/models/centerpoint_0075voxel_second_secfpn_dcn_circlenms_nus.py delete mode 100644 configs/_base_/models/centerpoint_0075voxel_second_secfpn_dcn_nus.py delete mode 100644 configs/_base_/models/centerpoint_0075voxel_second_secfpn_nus.py delete mode 100644 configs/_base_/models/centerpoint_01voxel_second_secfpn_circlenms_nus.py delete mode 100644 configs/_base_/models/centerpoint_01voxel_second_secfpn_dcn_circlenms_nus.py delete mode 100644 configs/_base_/models/centerpoint_01voxel_second_secfpn_dcn_nus.py rename configs/_base_/models/{centerpoint_pillar_second_secfpn_nus.py => centerpoint_02pillar_second_secfpn_nus.py} (100%) delete mode 100644 configs/_base_/models/centerpoint_pillar_second_secfpn_circlenms_nus.py delete mode 100644 configs/_base_/models/centerpoint_pillar_second_secfpn_dcn_circlenms_nus.py delete mode 100644 configs/_base_/models/centerpoint_pillar_second_secfpn_dcn_nus.py rename configs/centerpoint/{centerpoint_pillar_second_secfpn_4x8_cyclic_20e_nus.py => centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py} (98%) rename configs/centerpoint/{centerpoint_pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py => centerpoint_02pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py} (98%) rename configs/centerpoint/{centerpoint_pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py => centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py} (95%) rename configs/centerpoint/{centerpoint_pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py => centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py} (94%) diff --git a/configs/_base_/models/centerpoint_0075voxel_second_secfpn_circlenms_nus.py b/configs/_base_/models/centerpoint_0075voxel_second_secfpn_circlenms_nus.py deleted file mode 100644 index 12021026b7..0000000000 --- a/configs/_base_/models/centerpoint_0075voxel_second_secfpn_circlenms_nus.py +++ /dev/null @@ -1,94 +0,0 @@ -voxel_size = [0.075, 0.075, 0.2] -point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] -model = dict( - type='CenterPoint', - pts_voxel_layer=dict( - max_num_points=10, - point_cloud_range=point_cloud_range, - voxel_size=voxel_size, - max_voxels=(90000, 120000)), - pts_voxel_encoder=dict(type='HardSimpleVFE', num_features=5), - pts_middle_encoder=dict( - type='SparseEncoder', - in_channels=5, - sparse_shape=[41, 1440, 1440], - output_channels=128, - order=('conv', 'norm', 'act'), - encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, - 128)), - encoder_paddings=((0, 0, 1), (0, 0, 1), (0, 0, [0, 1, 1]), (0, 0)), - block_type='basicblock'), - pts_backbone=dict( - type='SECOND', - in_channels=256, - out_channels=[128, 256], - layer_nums=[5, 5], - layer_strides=[1, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - conv_cfg=dict(type='Conv2d', bias=False)), - pts_neck=dict( - type='SECONDFPN', - in_channels=[128, 256], - out_channels=[256, 256], - upsample_strides=[1, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - upsample_cfg=dict(type='deconv', bias=False), - use_conv_for_no_stride=True), - pts_bbox_head=dict( - type='CenterHead', - mode='3d', - in_channels=sum([256, 256]), - tasks=[ - dict(num_class=1, class_names=['car']), - dict(num_class=2, class_names=['truck', 'construction_vehicle']), - dict(num_class=2, class_names=['bus', 'trailer']), - dict(num_class=1, class_names=['barrier']), - dict(num_class=2, class_names=['motorcycle', 'bicycle']), - dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), - ], - common_heads={ - 'reg': (2, 2), - 'height': (1, 2), - 'dim': (3, 2), - 'rot': (2, 2), - 'vel': (2, 2) - }, - share_conv_channel=64, - bbox_coder=dict( - type='CenterPointBBoxCoder', - post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_num=500, - score_threshold=0.1, - pc_range=point_cloud_range[:2], - out_size_factor=8, - voxel_size=voxel_size[:2], - code_size=9), - dcn_head=False, - loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) -# model training and testing settings -train_cfg = dict( - pts=dict( - grid_size=[1440, 1440, 40], - point_cloud_range=point_cloud_range, - voxel_size=voxel_size, - out_size_factor=8, - dense_reg=1, - gaussian_overlap=0.1, - max_objs=500, - min_radius=2, - code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0], - no_log=False)) -test_cfg = dict( - pts=dict( - post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_per_img=500, - max_pool_nms=False, - min_radius=[4, 12, 10, 1, 0.85, 0.175], - post_max_size=83, - score_threshold=0.1, - pc_range=point_cloud_range[:2], - out_size_factor=8, - voxel_size=voxel_size[:2], - nms_type='circle', - no_log=False)) diff --git a/configs/_base_/models/centerpoint_0075voxel_second_secfpn_dcn_circlenms_nus.py b/configs/_base_/models/centerpoint_0075voxel_second_secfpn_dcn_circlenms_nus.py deleted file mode 100644 index 52dfc71e2f..0000000000 --- a/configs/_base_/models/centerpoint_0075voxel_second_secfpn_dcn_circlenms_nus.py +++ /dev/null @@ -1,94 +0,0 @@ -voxel_size = [0.075, 0.075, 0.2] -point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] -model = dict( - type='CenterPoint', - pts_voxel_layer=dict( - max_num_points=10, - point_cloud_range=point_cloud_range, - voxel_size=voxel_size, - max_voxels=(90000, 120000)), - pts_voxel_encoder=dict(type='HardSimpleVFE', num_features=5), - pts_middle_encoder=dict( - type='SparseEncoder', - in_channels=5, - sparse_shape=[41, 1440, 1440], - output_channels=128, - order=('conv', 'norm', 'act'), - encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, - 128)), - encoder_paddings=((0, 0, 1), (0, 0, 1), (0, 0, [0, 1, 1]), (0, 0)), - block_type='basicblock'), - pts_backbone=dict( - type='SECOND', - in_channels=256, - out_channels=[128, 256], - layer_nums=[5, 5], - layer_strides=[1, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - conv_cfg=dict(type='Conv2d', bias=False)), - pts_neck=dict( - type='SECONDFPN', - in_channels=[128, 256], - out_channels=[256, 256], - upsample_strides=[1, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - upsample_cfg=dict(type='deconv', bias=False), - use_conv_for_no_stride=True), - pts_bbox_head=dict( - type='CenterHead', - mode='3d', - in_channels=sum([256, 256]), - tasks=[ - dict(num_class=1, class_names=['car']), - dict(num_class=2, class_names=['truck', 'construction_vehicle']), - dict(num_class=2, class_names=['bus', 'trailer']), - dict(num_class=1, class_names=['barrier']), - dict(num_class=2, class_names=['motorcycle', 'bicycle']), - dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), - ], - common_heads={ - 'reg': (2, 2), - 'height': (1, 2), - 'dim': (3, 2), - 'rot': (2, 2), - 'vel': (2, 2) - }, - share_conv_channel=64, - bbox_coder=dict( - type='CenterPointBBoxCoder', - post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_num=500, - score_threshold=0.1, - pc_range=point_cloud_range[:2], - out_size_factor=8, - voxel_size=voxel_size[:2], - code_size=9), - dcn_head=True, - loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) -# model training and testing settings -train_cfg = dict( - pts=dict( - grid_size=[1440, 1440, 40], - point_cloud_range=point_cloud_range, - voxel_size=voxel_size, - out_size_factor=8, - dense_reg=1, - gaussian_overlap=0.1, - max_objs=500, - min_radius=2, - code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0], - no_log=False)) -test_cfg = dict( - pts=dict( - post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_per_img=500, - max_pool_nms=False, - min_radius=[4, 12, 10, 1, 0.85, 0.175], - post_max_size=83, - score_threshold=0.1, - pc_range=point_cloud_range[:2], - out_size_factor=8, - voxel_size=voxel_size[:2], - nms_type='circle', - no_log=False)) diff --git a/configs/_base_/models/centerpoint_0075voxel_second_secfpn_dcn_nus.py b/configs/_base_/models/centerpoint_0075voxel_second_secfpn_dcn_nus.py deleted file mode 100644 index f3be59d732..0000000000 --- a/configs/_base_/models/centerpoint_0075voxel_second_secfpn_dcn_nus.py +++ /dev/null @@ -1,97 +0,0 @@ -voxel_size = [0.075, 0.075, 0.2] -point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] -model = dict( - type='CenterPoint', - pts_voxel_layer=dict( - max_num_points=10, - point_cloud_range=point_cloud_range, - voxel_size=voxel_size, - max_voxels=(90000, 120000)), - pts_voxel_encoder=dict(type='HardSimpleVFE', num_features=5), - pts_middle_encoder=dict( - type='SparseEncoder', - in_channels=5, - sparse_shape=[41, 1440, 1440], - output_channels=128, - order=('conv', 'norm', 'act'), - encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, - 128)), - encoder_paddings=((0, 0, 1), (0, 0, 1), (0, 0, [0, 1, 1]), (0, 0)), - block_type='basicblock'), - pts_backbone=dict( - type='SECOND', - in_channels=256, - out_channels=[128, 256], - layer_nums=[5, 5], - layer_strides=[1, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - conv_cfg=dict(type='Conv2d', bias=False)), - pts_neck=dict( - type='SECONDFPN', - in_channels=[128, 256], - out_channels=[256, 256], - upsample_strides=[1, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - upsample_cfg=dict(type='deconv', bias=False), - use_conv_for_no_stride=True), - pts_bbox_head=dict( - type='CenterHead', - mode='3d', - in_channels=sum([256, 256]), - tasks=[ - dict(num_class=1, class_names=['car']), - dict(num_class=2, class_names=['truck', 'construction_vehicle']), - dict(num_class=2, class_names=['bus', 'trailer']), - dict(num_class=1, class_names=['barrier']), - dict(num_class=2, class_names=['motorcycle', 'bicycle']), - dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), - ], - common_heads={ - 'reg': (2, 2), - 'height': (1, 2), - 'dim': (3, 2), - 'rot': (2, 2), - 'vel': (2, 2) - }, - share_conv_channel=64, - bbox_coder=dict( - type='CenterPointBBoxCoder', - post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_num=500, - score_threshold=0.1, - pc_range=point_cloud_range[:2], - out_size_factor=8, - voxel_size=voxel_size[:2], - code_size=9), - dcn_head=True, - loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) -# model training and testing settings -train_cfg = dict( - pts=dict( - grid_size=[1440, 1440, 40], - point_cloud_range=point_cloud_range, - voxel_size=voxel_size, - out_size_factor=8, - dense_reg=1, - gaussian_overlap=0.1, - max_objs=500, - min_radius=2, - code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0], - no_log=False)) -test_cfg = dict( - pts=dict( - post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_per_img=500, - max_pool_nms=False, - min_radius=[4, 12, 10, 1, 0.85, 0.175], - post_max_size=83, - score_threshold=0.1, - pc_range=point_cloud_range[:2], - out_size_factor=8, - voxel_size=voxel_size[:2], - nms_type='rotate', - nms_pre_max_size=1000, - nms_post_max_size=83, - nms_iou_threshold=0.2, - no_log=False)) diff --git a/configs/_base_/models/centerpoint_0075voxel_second_secfpn_nus.py b/configs/_base_/models/centerpoint_0075voxel_second_secfpn_nus.py deleted file mode 100644 index 1ade2e00fb..0000000000 --- a/configs/_base_/models/centerpoint_0075voxel_second_secfpn_nus.py +++ /dev/null @@ -1,97 +0,0 @@ -voxel_size = [0.075, 0.075, 0.2] -point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] -model = dict( - type='CenterPoint', - pts_voxel_layer=dict( - max_num_points=10, - point_cloud_range=point_cloud_range, - voxel_size=voxel_size, - max_voxels=(90000, 120000)), - pts_voxel_encoder=dict(type='HardSimpleVFE', num_features=5), - pts_middle_encoder=dict( - type='SparseEncoder', - in_channels=5, - sparse_shape=[41, 1440, 1440], - output_channels=128, - order=('conv', 'norm', 'act'), - encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, - 128)), - encoder_paddings=((0, 0, 1), (0, 0, 1), (0, 0, [0, 1, 1]), (0, 0)), - block_type='basicblock'), - pts_backbone=dict( - type='SECOND', - in_channels=256, - out_channels=[128, 256], - layer_nums=[5, 5], - layer_strides=[1, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - conv_cfg=dict(type='Conv2d', bias=False)), - pts_neck=dict( - type='SECONDFPN', - in_channels=[128, 256], - out_channels=[256, 256], - upsample_strides=[1, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - upsample_cfg=dict(type='deconv', bias=False), - use_conv_for_no_stride=True), - pts_bbox_head=dict( - type='CenterHead', - mode='3d', - in_channels=sum([256, 256]), - tasks=[ - dict(num_class=1, class_names=['car']), - dict(num_class=2, class_names=['truck', 'construction_vehicle']), - dict(num_class=2, class_names=['bus', 'trailer']), - dict(num_class=1, class_names=['barrier']), - dict(num_class=2, class_names=['motorcycle', 'bicycle']), - dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), - ], - common_heads={ - 'reg': (2, 2), - 'height': (1, 2), - 'dim': (3, 2), - 'rot': (2, 2), - 'vel': (2, 2) - }, - share_conv_channel=64, - bbox_coder=dict( - type='CenterPointBBoxCoder', - post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_num=500, - score_threshold=0.1, - pc_range=point_cloud_range[:2], - out_size_factor=8, - voxel_size=voxel_size[:2], - code_size=9), - dcn_head=False, - loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) -# model training and testing settings -train_cfg = dict( - pts=dict( - grid_size=[1440, 1440, 40], - point_cloud_range=point_cloud_range, - voxel_size=voxel_size, - out_size_factor=8, - dense_reg=1, - gaussian_overlap=0.1, - max_objs=500, - min_radius=2, - code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0], - no_log=False)) -test_cfg = dict( - pts=dict( - post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_per_img=500, - max_pool_nms=False, - min_radius=[4, 12, 10, 1, 0.85, 0.175], - post_max_size=83, - score_threshold=0.1, - pc_range=point_cloud_range[:2], - out_size_factor=8, - voxel_size=voxel_size[:2], - nms_type='rotate', - nms_pre_max_size=1000, - nms_post_max_size=83, - nms_iou_threshold=0.2, - no_log=False)) diff --git a/configs/_base_/models/centerpoint_01voxel_second_secfpn_circlenms_nus.py b/configs/_base_/models/centerpoint_01voxel_second_secfpn_circlenms_nus.py deleted file mode 100644 index 5d19573f26..0000000000 --- a/configs/_base_/models/centerpoint_01voxel_second_secfpn_circlenms_nus.py +++ /dev/null @@ -1,94 +0,0 @@ -voxel_size = [0.1, 0.1, 0.2] -point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] -model = dict( - type='CenterPoint', - pts_voxel_layer=dict( - max_num_points=10, - point_cloud_range=point_cloud_range, - voxel_size=voxel_size, - max_voxels=(90000, 120000)), - pts_voxel_encoder=dict(type='HardSimpleVFE', num_features=5), - pts_middle_encoder=dict( - type='SparseEncoder', - in_channels=5, - sparse_shape=[41, 1024, 1024], - output_channels=128, - order=('conv', 'norm', 'act'), - encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, - 128)), - encoder_paddings=((0, 0, 1), (0, 0, 1), (0, 0, [0, 1, 1]), (0, 0)), - block_type='basicblock'), - pts_backbone=dict( - type='SECOND', - in_channels=256, - out_channels=[128, 256], - layer_nums=[5, 5], - layer_strides=[1, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - conv_cfg=dict(type='Conv2d', bias=False)), - pts_neck=dict( - type='SECONDFPN', - in_channels=[128, 256], - out_channels=[256, 256], - upsample_strides=[1, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - upsample_cfg=dict(type='deconv', bias=False), - use_conv_for_no_stride=True), - pts_bbox_head=dict( - type='CenterHead', - mode='3d', - in_channels=sum([256, 256]), - tasks=[ - dict(num_class=1, class_names=['car']), - dict(num_class=2, class_names=['truck', 'construction_vehicle']), - dict(num_class=2, class_names=['bus', 'trailer']), - dict(num_class=1, class_names=['barrier']), - dict(num_class=2, class_names=['motorcycle', 'bicycle']), - dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), - ], - common_heads={ - 'reg': (2, 2), - 'height': (1, 2), - 'dim': (3, 2), - 'rot': (2, 2), - 'vel': (2, 2) - }, - share_conv_channel=64, - bbox_coder=dict( - type='CenterPointBBoxCoder', - post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_num=500, - score_threshold=0.1, - pc_range=point_cloud_range[:2], - out_size_factor=8, - voxel_size=voxel_size[:2], - code_size=9), - dcn_head=False, - loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) -# model training and testing settings -train_cfg = dict( - pts=dict( - grid_size=[1024, 1024, 40], - point_cloud_range=point_cloud_range, - voxel_size=voxel_size, - out_size_factor=8, - dense_reg=1, - gaussian_overlap=0.1, - max_objs=500, - min_radius=2, - code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0], - no_log=False)) -test_cfg = dict( - pts=dict( - post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_per_img=500, - max_pool_nms=False, - min_radius=[4, 12, 10, 1, 0.85, 0.175], - post_max_size=83, - score_threshold=0.1, - pc_range=point_cloud_range[:2], - out_size_factor=8, - voxel_size=voxel_size[:2], - nms_type='circle', - no_log=False)) diff --git a/configs/_base_/models/centerpoint_01voxel_second_secfpn_dcn_circlenms_nus.py b/configs/_base_/models/centerpoint_01voxel_second_secfpn_dcn_circlenms_nus.py deleted file mode 100644 index 47444417e2..0000000000 --- a/configs/_base_/models/centerpoint_01voxel_second_secfpn_dcn_circlenms_nus.py +++ /dev/null @@ -1,94 +0,0 @@ -voxel_size = [0.1, 0.1, 0.2] -point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] -model = dict( - type='CenterPoint', - pts_voxel_layer=dict( - max_num_points=10, - point_cloud_range=point_cloud_range, - voxel_size=voxel_size, - max_voxels=(90000, 120000)), - pts_voxel_encoder=dict(type='HardSimpleVFE', num_features=5), - pts_middle_encoder=dict( - type='SparseEncoder', - in_channels=5, - sparse_shape=[41, 1024, 1024], - output_channels=128, - order=('conv', 'norm', 'act'), - encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, - 128)), - encoder_paddings=((0, 0, 1), (0, 0, 1), (0, 0, [0, 1, 1]), (0, 0)), - block_type='basicblock'), - pts_backbone=dict( - type='SECOND', - in_channels=256, - out_channels=[128, 256], - layer_nums=[5, 5], - layer_strides=[1, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - conv_cfg=dict(type='Conv2d', bias=False)), - pts_neck=dict( - type='SECONDFPN', - in_channels=[128, 256], - out_channels=[256, 256], - upsample_strides=[1, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - upsample_cfg=dict(type='deconv', bias=False), - use_conv_for_no_stride=True), - pts_bbox_head=dict( - type='CenterHead', - mode='3d', - in_channels=sum([256, 256]), - tasks=[ - dict(num_class=1, class_names=['car']), - dict(num_class=2, class_names=['truck', 'construction_vehicle']), - dict(num_class=2, class_names=['bus', 'trailer']), - dict(num_class=1, class_names=['barrier']), - dict(num_class=2, class_names=['motorcycle', 'bicycle']), - dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), - ], - common_heads={ - 'reg': (2, 2), - 'height': (1, 2), - 'dim': (3, 2), - 'rot': (2, 2), - 'vel': (2, 2) - }, - share_conv_channel=64, - bbox_coder=dict( - type='CenterPointBBoxCoder', - post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_num=500, - score_threshold=0.1, - pc_range=point_cloud_range[:2], - out_size_factor=8, - voxel_size=voxel_size[:2], - code_size=9), - dcn_head=True, - loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) -# model training and testing settings -train_cfg = dict( - pts=dict( - grid_size=[1024, 1024, 40], - point_cloud_range=point_cloud_range, - voxel_size=voxel_size, - out_size_factor=8, - dense_reg=1, - gaussian_overlap=0.1, - max_objs=500, - min_radius=2, - code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0], - no_log=False)) -test_cfg = dict( - pts=dict( - post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_per_img=500, - max_pool_nms=False, - min_radius=[4, 12, 10, 1, 0.85, 0.175], - post_max_size=83, - score_threshold=0.1, - pc_range=point_cloud_range[:2], - out_size_factor=8, - voxel_size=voxel_size[:2], - nms_type='circle', - no_log=False)) diff --git a/configs/_base_/models/centerpoint_01voxel_second_secfpn_dcn_nus.py b/configs/_base_/models/centerpoint_01voxel_second_secfpn_dcn_nus.py deleted file mode 100644 index b95ff5fd8f..0000000000 --- a/configs/_base_/models/centerpoint_01voxel_second_secfpn_dcn_nus.py +++ /dev/null @@ -1,97 +0,0 @@ -voxel_size = [0.1, 0.1, 0.2] -point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] -model = dict( - type='CenterPoint', - pts_voxel_layer=dict( - max_num_points=10, - point_cloud_range=point_cloud_range, - voxel_size=voxel_size, - max_voxels=(90000, 120000)), - pts_voxel_encoder=dict(type='HardSimpleVFE', num_features=5), - pts_middle_encoder=dict( - type='SparseEncoder', - in_channels=5, - sparse_shape=[41, 1024, 1024], - output_channels=128, - order=('conv', 'norm', 'act'), - encoder_channels=((16, 16, 32), (32, 32, 64), (64, 64, 128), (128, - 128)), - encoder_paddings=((0, 0, 1), (0, 0, 1), (0, 0, [0, 1, 1]), (0, 0)), - block_type='basicblock'), - pts_backbone=dict( - type='SECOND', - in_channels=256, - out_channels=[128, 256], - layer_nums=[5, 5], - layer_strides=[1, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - conv_cfg=dict(type='Conv2d', bias=False)), - pts_neck=dict( - type='SECONDFPN', - in_channels=[128, 256], - out_channels=[256, 256], - upsample_strides=[1, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - upsample_cfg=dict(type='deconv', bias=False), - use_conv_for_no_stride=True), - pts_bbox_head=dict( - type='CenterHead', - mode='3d', - in_channels=sum([256, 256]), - tasks=[ - dict(num_class=1, class_names=['car']), - dict(num_class=2, class_names=['truck', 'construction_vehicle']), - dict(num_class=2, class_names=['bus', 'trailer']), - dict(num_class=1, class_names=['barrier']), - dict(num_class=2, class_names=['motorcycle', 'bicycle']), - dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), - ], - common_heads={ - 'reg': (2, 2), - 'height': (1, 2), - 'dim': (3, 2), - 'rot': (2, 2), - 'vel': (2, 2) - }, - share_conv_channel=64, - bbox_coder=dict( - type='CenterPointBBoxCoder', - post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_num=500, - score_threshold=0.1, - pc_range=point_cloud_range[:2], - out_size_factor=8, - voxel_size=voxel_size[:2], - code_size=9), - dcn_head=True, - loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) -# model training and testing settings -train_cfg = dict( - pts=dict( - grid_size=[1024, 1024, 40], - point_cloud_range=point_cloud_range, - voxel_size=voxel_size, - out_size_factor=8, - dense_reg=1, - gaussian_overlap=0.1, - max_objs=500, - min_radius=2, - code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0], - no_log=False)) -test_cfg = dict( - pts=dict( - post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_per_img=500, - max_pool_nms=False, - min_radius=[4, 12, 10, 1, 0.85, 0.175], - post_max_size=83, - score_threshold=0.1, - pc_range=point_cloud_range[:2], - out_size_factor=8, - voxel_size=voxel_size[:2], - nms_type='rotate', - nms_pre_max_size=1000, - nms_post_max_size=83, - nms_iou_threshold=0.2, - no_log=False)) diff --git a/configs/_base_/models/centerpoint_pillar_second_secfpn_nus.py b/configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py similarity index 100% rename from configs/_base_/models/centerpoint_pillar_second_secfpn_nus.py rename to configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py diff --git a/configs/_base_/models/centerpoint_pillar_second_secfpn_circlenms_nus.py b/configs/_base_/models/centerpoint_pillar_second_secfpn_circlenms_nus.py deleted file mode 100644 index fe66f2a763..0000000000 --- a/configs/_base_/models/centerpoint_pillar_second_secfpn_circlenms_nus.py +++ /dev/null @@ -1,93 +0,0 @@ -voxel_size = [0.2, 0.2, 8] -model = dict( - type='CenterPoint', - pts_voxel_layer=dict( - max_num_points=20, - point_cloud_range=[-51.2, -51.2, -5.0, 51.2, 51.2, 3.0], - voxel_size=voxel_size, - max_voxels=(30000, 40000)), - pts_voxel_encoder=dict( - type='PillarFeatureNet', - in_channels=5, - feat_channels=[64], - with_distance=False, - voxel_size=(0.2, 0.2, 8), - point_cloud_range=(-51.2, -51.2, -5.0, 51.2, 51.2, 3.0), - norm_cfg=dict(type='BN1d', eps=1e-3, momentum=0.01), - legacy=False), - pts_middle_encoder=dict( - type='PointPillarsScatter', in_channels=64, output_shape=(512, 512)), - pts_backbone=dict( - type='SECOND', - in_channels=64, - out_channels=[64, 128, 256], - layer_nums=[3, 5, 5], - layer_strides=[2, 2, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - conv_cfg=dict(type='Conv2d', bias=False)), - pts_neck=dict( - type='SECONDFPN', - in_channels=[64, 128, 256], - out_channels=[128, 128, 128], - upsample_strides=[0.5, 1, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - upsample_cfg=dict(type='deconv', bias=False), - use_conv_for_no_stride=True), - pts_bbox_head=dict( - type='CenterHead', - mode='3d', - in_channels=sum([128, 128, 128]), - tasks=[ - dict(num_class=1, class_names=['car']), - dict(num_class=2, class_names=['truck', 'construction_vehicle']), - dict(num_class=2, class_names=['bus', 'trailer']), - dict(num_class=1, class_names=['barrier']), - dict(num_class=2, class_names=['motorcycle', 'bicycle']), - dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), - ], - common_heads={ - 'reg': (2, 2), - 'height': (1, 2), - 'dim': (3, 2), - 'rot': (2, 2), - 'vel': (2, 2) - }, - share_conv_channel=64, - bbox_coder=dict( - type='CenterPointBBoxCoder', - post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_num=500, - score_threshold=0.1, - pc_range=[-51.2, -51.2], - out_size_factor=4, - voxel_size=voxel_size[:2], - code_size=9), - dcn_head=False, - loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) -# model training and testing settings -train_cfg = dict( - pts=dict( - grid_size=[512, 512, 1], - point_cloud_range=[-51.2, -51.2, -5., 51.2, 51.2, 3.], - voxel_size=voxel_size, - out_size_factor=4, - dense_reg=1, - gaussian_overlap=0.1, - max_objs=500, - min_radius=2, - no_log=False, - code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0])) -test_cfg = dict( - pts=dict( - post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_per_img=500, - max_pool_nms=False, - min_radius=[4, 12, 10, 1, 0.85, 0.175], - post_max_size=83, - score_threshold=0.1, - pc_range=[-51.2, -51.2], - out_size_factor=4, - voxel_size=voxel_size[:2], - nms_type='circle', - no_log=False)) diff --git a/configs/_base_/models/centerpoint_pillar_second_secfpn_dcn_circlenms_nus.py b/configs/_base_/models/centerpoint_pillar_second_secfpn_dcn_circlenms_nus.py deleted file mode 100644 index 7bf30247e2..0000000000 --- a/configs/_base_/models/centerpoint_pillar_second_secfpn_dcn_circlenms_nus.py +++ /dev/null @@ -1,93 +0,0 @@ -voxel_size = [0.2, 0.2, 8] -model = dict( - type='CenterPoint', - pts_voxel_layer=dict( - max_num_points=20, - point_cloud_range=[-51.2, -51.2, -5.0, 51.2, 51.2, 3.0], - voxel_size=voxel_size, - max_voxels=(30000, 40000)), - pts_voxel_encoder=dict( - type='PillarFeatureNet', - in_channels=5, - feat_channels=[64], - with_distance=False, - voxel_size=(0.2, 0.2, 8), - point_cloud_range=(-51.2, -51.2, -5.0, 51.2, 51.2, 3.0), - norm_cfg=dict(type='BN1d', eps=1e-3, momentum=0.01), - legacy=False), - pts_middle_encoder=dict( - type='PointPillarsScatter', in_channels=64, output_shape=(512, 512)), - pts_backbone=dict( - type='SECOND', - in_channels=64, - out_channels=[64, 128, 256], - layer_nums=[3, 5, 5], - layer_strides=[2, 2, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - conv_cfg=dict(type='Conv2d', bias=False)), - pts_neck=dict( - type='SECONDFPN', - in_channels=[64, 128, 256], - out_channels=[128, 128, 128], - upsample_strides=[0.5, 1, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - upsample_cfg=dict(type='deconv', bias=False), - use_conv_for_no_stride=True), - pts_bbox_head=dict( - type='CenterHead', - mode='3d', - in_channels=sum([128, 128, 128]), - tasks=[ - dict(num_class=1, class_names=['car']), - dict(num_class=2, class_names=['truck', 'construction_vehicle']), - dict(num_class=2, class_names=['bus', 'trailer']), - dict(num_class=1, class_names=['barrier']), - dict(num_class=2, class_names=['motorcycle', 'bicycle']), - dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), - ], - common_heads={ - 'reg': (2, 2), - 'height': (1, 2), - 'dim': (3, 2), - 'rot': (2, 2), - 'vel': (2, 2) - }, - share_conv_channel=64, - bbox_coder=dict( - type='CenterPointBBoxCoder', - post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_num=500, - score_threshold=0.1, - pc_range=[-51.2, -51.2], - out_size_factor=4, - voxel_size=voxel_size[:2], - code_size=9), - dcn_head=True, - loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) -# model training and testing settings -train_cfg = dict( - pts=dict( - grid_size=[512, 512, 1], - point_cloud_range=[-51.2, -51.2, -5., 51.2, 51.2, 3.], - voxel_size=voxel_size, - out_size_factor=4, - dense_reg=1, - gaussian_overlap=0.1, - max_objs=500, - min_radius=2, - no_log=False, - code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0])) -test_cfg = dict( - pts=dict( - post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_per_img=500, - max_pool_nms=False, - min_radius=[4, 12, 10, 1, 0.85, 0.175], - post_max_size=83, - score_threshold=0.1, - pc_range=[-51.2, -51.2], - out_size_factor=4, - voxel_size=voxel_size[:2], - nms_type='circle', - no_log=False)) diff --git a/configs/_base_/models/centerpoint_pillar_second_secfpn_dcn_nus.py b/configs/_base_/models/centerpoint_pillar_second_secfpn_dcn_nus.py deleted file mode 100644 index cd4383bed9..0000000000 --- a/configs/_base_/models/centerpoint_pillar_second_secfpn_dcn_nus.py +++ /dev/null @@ -1,96 +0,0 @@ -voxel_size = [0.2, 0.2, 8] -model = dict( - type='CenterPoint', - pts_voxel_layer=dict( - max_num_points=20, - point_cloud_range=[-51.2, -51.2, -5.0, 51.2, 51.2, 3.0], - voxel_size=voxel_size, - max_voxels=(30000, 40000)), - pts_voxel_encoder=dict( - type='PillarFeatureNet', - in_channels=5, - feat_channels=[64], - with_distance=False, - voxel_size=(0.2, 0.2, 8), - point_cloud_range=(-51.2, -51.2, -5.0, 51.2, 51.2, 3.0), - norm_cfg=dict(type='BN1d', eps=1e-3, momentum=0.01), - legacy=False), - pts_middle_encoder=dict( - type='PointPillarsScatter', in_channels=64, output_shape=(512, 512)), - pts_backbone=dict( - type='SECOND', - in_channels=64, - out_channels=[64, 128, 256], - layer_nums=[3, 5, 5], - layer_strides=[2, 2, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - conv_cfg=dict(type='Conv2d', bias=False)), - pts_neck=dict( - type='SECONDFPN', - in_channels=[64, 128, 256], - out_channels=[128, 128, 128], - upsample_strides=[0.5, 1, 2], - norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), - upsample_cfg=dict(type='deconv', bias=False), - use_conv_for_no_stride=True), - pts_bbox_head=dict( - type='CenterHead', - mode='3d', - in_channels=sum([128, 128, 128]), - tasks=[ - dict(num_class=1, class_names=['car']), - dict(num_class=2, class_names=['truck', 'construction_vehicle']), - dict(num_class=2, class_names=['bus', 'trailer']), - dict(num_class=1, class_names=['barrier']), - dict(num_class=2, class_names=['motorcycle', 'bicycle']), - dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), - ], - common_heads={ - 'reg': (2, 2), - 'height': (1, 2), - 'dim': (3, 2), - 'rot': (2, 2), - 'vel': (2, 2) - }, - share_conv_channel=64, - bbox_coder=dict( - type='CenterPointBBoxCoder', - post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_num=500, - score_threshold=0.1, - pc_range=[-51.2, -51.2], - out_size_factor=4, - voxel_size=voxel_size[:2], - code_size=9), - dcn_head=True, - loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) -# model training and testing settings -train_cfg = dict( - pts=dict( - grid_size=[512, 512, 1], - point_cloud_range=[-51.2, -51.2, -5., 51.2, 51.2, 3.], - voxel_size=voxel_size, - out_size_factor=4, - dense_reg=1, - gaussian_overlap=0.1, - max_objs=500, - min_radius=2, - no_log=False, - code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0])) -test_cfg = dict( - pts=dict( - post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], - max_per_img=500, - max_pool_nms=False, - min_radius=[4, 12, 10, 1, 0.85, 0.175], - post_max_size=83, - score_threshold=0.1, - pc_range=[-51.2, -51.2], - out_size_factor=4, - voxel_size=voxel_size[:2], - nms_type='rotate', - nms_pre_max_size=1000, - nms_post_max_size=83, - nms_iou_threshold=0.2, - no_log=False)) diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py index 910fc081ac..64d6209220 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py @@ -1,10 +1,11 @@ _base_ = [ - '../_base_/models/centerpoint_0075voxel_second_secfpn_nus.py', + '../_base_/models/centerpoint_01voxel_second_secfpn_nus.py', '../_base_/default_runtime.py' ] # If point cloud range is changed, the models should also change their point # cloud range accordingly +voxel_size = [0.075, 0.075, 0.2] point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] # For nuScenes we usually do 10-class detection class_names = [ @@ -162,6 +163,23 @@ modality=input_modality, test_mode=True, box_type_3d='LiDAR')) + +model = dict( + pts_voxel_layer=dict(voxel_size=voxel_size), + pts_middle_encoder=dict(sparse_shape=[41, 1440, 1440]), + pts_bbox_head=dict( + bbox_coder=dict( + voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2]))) + +train_cfg = dict( + pts=dict( + grid_size=[1440, 1440, 40], + voxel_size=voxel_size, + point_cloud_range=point_cloud_range)) + +test_cfg = dict( + pts=dict(voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2])) + # For nuScenes dataset, we usually evaluate the model at the end of training. # Since the models are trained by 24 epochs by default, we set evaluation # interval to be 24. Please change the interval accordingly if you do not diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py index 2c282319bb..882bef41b6 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py @@ -1,10 +1,11 @@ _base_ = [ - '../_base_/models/centerpoint_0075voxel_second_secfpn_circlenms_nus.py', + '../_base_/models/centerpoint_01voxel_second_secfpn_nus.py', '../_base_/default_runtime.py' ] # If point cloud range is changed, the models should also change their point # cloud range accordingly +voxel_size = [0.075, 0.075, 0.2] point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] # For nuScenes we usually do 10-class detection class_names = [ @@ -162,6 +163,25 @@ modality=input_modality, test_mode=True, box_type_3d='LiDAR')) + +model = dict( + pts_voxel_layer=dict(voxel_size=voxel_size), + pts_middle_encoder=dict(sparse_shape=[41, 1440, 1440]), + pts_bbox_head=dict( + bbox_coder=dict( + voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2]))) + +train_cfg = dict( + pts=dict( + grid_size=[1440, 1440, 40], + voxel_size=voxel_size, + point_cloud_range=point_cloud_range)) + +test_cfg = dict( + pts=dict( + nms_type='circle', + voxel_size=voxel_size[:2], + pc_range=point_cloud_range[:2])) # For nuScenes dataset, we usually evaluate the model at the end of training. # Since the models are trained by 24 epochs by default, we set evaluation # interval to be 24. Please change the interval accordingly if you do not diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py index 3d5004a260..679e4119ec 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py @@ -1,10 +1,11 @@ _base_ = [ - '../_base_/models/centerpoint_0075voxel_second_secfpn_dcn_nus.py', + '../_base_/models/centerpoint_01voxel_second_secfpn_nus.py', '../_base_/default_runtime.py' ] # If point cloud range is changed, the models should also change their point # cloud range accordingly +voxel_size = [0.075, 0.075, 0.2] point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] # For nuScenes we usually do 10-class detection class_names = [ @@ -162,6 +163,24 @@ modality=input_modality, test_mode=True, box_type_3d='LiDAR')) + +model = dict( + pts_voxel_layer=dict(voxel_size=voxel_size), + pts_middle_encoder=dict(sparse_shape=[41, 1440, 1440]), + pts_bbox_head=dict( + bbox_coder=dict( + voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2]), + dcn_head=True)) + +train_cfg = dict( + pts=dict( + grid_size=[1440, 1440, 40], + voxel_size=voxel_size, + point_cloud_range=point_cloud_range)) + +test_cfg = dict( + pts=dict(voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2])) + # For nuScenes dataset, we usually evaluate the model at the end of training. # Since the models are trained by 24 epochs by default, we set evaluation # interval to be 24. Please change the interval accordingly if you do not diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py index ad63bac5df..7f4c8f0e0a 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py @@ -5,6 +5,7 @@ # If point cloud range is changed, the models should also change their point # cloud range accordingly +voxel_size = [0.075, 0.075, 0.2] point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] # For nuScenes we usually do 10-class detection class_names = [ @@ -162,6 +163,28 @@ modality=input_modality, test_mode=True, box_type_3d='LiDAR')) + +test_cfg = dict(pts=dict(nms_type='circle')) + +model = dict( + pts_voxel_layer=dict(voxel_size=voxel_size), + pts_middle_encoder=dict(sparse_shape=[41, 1440, 1440]), + pts_bbox_head=dict( + bbox_coder=dict( + voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2]), + dcn_head=True)) + +train_cfg = dict( + pts=dict( + grid_size=[1440, 1440, 40], + voxel_size=voxel_size, + point_cloud_range=point_cloud_range)) + +test_cfg = dict( + pts=dict( + nms_type='circle', + voxel_size=voxel_size[:2], + pc_range=point_cloud_range[:2])) # For nuScenes dataset, we usually evaluate the model at the end of training. # Since the models are trained by 24 epochs by default, we set evaluation # interval to be 24. Please change the interval accordingly if you do not diff --git a/configs/centerpoint/centerpoint_01voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py index 3180d0b0ba..97d14df72d 100644 --- a/configs/centerpoint/centerpoint_01voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py @@ -1,5 +1,5 @@ _base_ = [ - '../_base_/models/centerpoint_01voxel_second_secfpn_circlenms_nus.py', + '../_base_/models/centerpoint_01voxel_second_secfpn_nus.py', '../_base_/default_runtime.py' ] @@ -162,6 +162,8 @@ modality=input_modality, test_mode=True, box_type_3d='LiDAR')) + +test_cfg = dict(pts=dict(nms_type='circle')) # For nuScenes dataset, we usually evaluate the model at the end of training. # Since the models are trained by 24 epochs by default, we set evaluation # interval to be 24. Please change the interval accordingly if you do not diff --git a/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py index a592b9fc80..2cdd6ad9ac 100644 --- a/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py @@ -1,5 +1,5 @@ _base_ = [ - '../_base_/models/centerpoint_01voxel_second_secfpn_dcn_nus.py', + '../_base_/models/centerpoint_01voxel_second_secfpn_nus.py', '../_base_/default_runtime.py' ] @@ -162,6 +162,8 @@ modality=input_modality, test_mode=True, box_type_3d='LiDAR')) + +model = dict(pts_bbox_head=dict(dcn_head=True)) # For nuScenes dataset, we usually evaluate the model at the end of training. # Since the models are trained by 24 epochs by default, we set evaluation # interval to be 24. Please change the interval accordingly if you do not diff --git a/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py index 23ea8adc5d..2f886064a6 100644 --- a/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py @@ -1,5 +1,5 @@ _base_ = [ - '../_base_/models/centerpoint_01voxel_second_secfpn_dcn_circlenms_nus.py', + '../_base_/models/centerpoint_01voxel_second_secfpn_nus.py', '../_base_/default_runtime.py' ] @@ -162,6 +162,10 @@ modality=input_modality, test_mode=True, box_type_3d='LiDAR')) + +model = dict(pts_bbox_head=dict(dcn_head=True)) + +test_cfg = dict(pts=dict(nms_type='circle')) # For nuScenes dataset, we usually evaluate the model at the end of training. # Since the models are trained by 24 epochs by default, we set evaluation # interval to be 24. Please change the interval accordingly if you do not diff --git a/configs/centerpoint/centerpoint_pillar_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py similarity index 98% rename from configs/centerpoint/centerpoint_pillar_second_secfpn_4x8_cyclic_20e_nus.py rename to configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py index 9f604ba83d..bdbb07c06f 100644 --- a/configs/centerpoint/centerpoint_pillar_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py @@ -1,5 +1,5 @@ _base_ = [ - '../_base_/models/centerpoint_pillar_second_secfpn_nus.py', + '../_base_/models/centerpoint_02pillar_second_secfpn_nus.py', '../_base_/default_runtime.py' ] diff --git a/configs/centerpoint/centerpoint_pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_02pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py similarity index 98% rename from configs/centerpoint/centerpoint_pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py rename to configs/centerpoint/centerpoint_02pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py index 70645e6dab..e6f1282d32 100644 --- a/configs/centerpoint/centerpoint_pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_02pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py @@ -1,5 +1,5 @@ _base_ = [ - '../_base_/models/centerpoint_pillar_second_secfpn_circlenms_nus.py', + '../_base_/models/centerpoint_02pillar_second_secfpn_nus.py', '../_base_/default_runtime.py' ] @@ -160,6 +160,8 @@ modality=input_modality, test_mode=True, box_type_3d='LiDAR')) + +test_cfg = dict(pts=dict(nms_type='circle')) # For nuScenes dataset, we usually evaluate the model at the end of training. # Since the models are trained by 24 epochs by default, we set evaluation # interval to be 24. Please change the interval accordingly if you do not diff --git a/configs/centerpoint/centerpoint_pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py similarity index 95% rename from configs/centerpoint/centerpoint_pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py rename to configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py index bc892a2929..d44af965cb 100644 --- a/configs/centerpoint/centerpoint_pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py @@ -1,5 +1,5 @@ _base_ = [ - '../_base_/models/centerpoint_pillar_second_secfpn_dcn_nus.py', + '../_base_/models/centerpoint_02pillar_second_secfpn_dcn_nus.py', '../_base_/default_runtime.py' ] @@ -54,8 +54,11 @@ pedestrian=2, traffic_cone=2, ), - load_dim=5, - use_dim=[0, 1, 2, 3, 4]) + points_loader=dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args)) train_pipeline = [ dict( @@ -157,6 +160,8 @@ modality=input_modality, test_mode=True, box_type_3d='LiDAR')) + +model = dict(pts_bbox_head=dict(dcn_head=True)) # For nuScenes dataset, we usually evaluate the model at the end of training. # Since the models are trained by 24 epochs by default, we set evaluation # interval to be 24. Please change the interval accordingly if you do not diff --git a/configs/centerpoint/centerpoint_pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py similarity index 94% rename from configs/centerpoint/centerpoint_pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py rename to configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py index a414eb73d5..67159f3626 100644 --- a/configs/centerpoint/centerpoint_pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py @@ -1,5 +1,5 @@ _base_ = [ - '../_base_/models/centerpoint_pillar_second_secfpn_dcn_circlenms_nus.py', + '../_base_/models/centerpoint_02pillar_second_secfpn_nus.py', '../_base_/default_runtime.py' ] @@ -54,8 +54,11 @@ pedestrian=2, traffic_cone=2, ), - load_dim=5, - use_dim=[0, 1, 2, 3, 4]) + points_loader=dict( + type='LoadPointsFromFile', + load_dim=5, + use_dim=[0, 1, 2, 3, 4], + file_client_args=file_client_args)) train_pipeline = [ dict( @@ -157,6 +160,9 @@ modality=input_modality, test_mode=True, box_type_3d='LiDAR')) + +test_cfg = dict(pts=dict(nms_type='circle')) +model = dict(pts_bbox_head=dict(dcn_head=True)) # For nuScenes dataset, we usually evaluate the model at the end of training. # Since the models are trained by 24 epochs by default, we set evaluation # interval to be 24. Please change the interval accordingly if you do not From cbeb06c4cfee661e9f11672ae070f4ef072e7609 Mon Sep 17 00:00:00 2001 From: liyinhao Date: Mon, 14 Sep 2020 08:52:16 +0800 Subject: [PATCH 10/21] Fix pillar config can't use bug. --- ...centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py index d44af965cb..829521e66a 100644 --- a/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py @@ -1,5 +1,5 @@ _base_ = [ - '../_base_/models/centerpoint_02pillar_second_secfpn_dcn_nus.py', + '../_base_/models/centerpoint_02pillar_second_secfpn_nus.py', '../_base_/default_runtime.py' ] From 0a9a2c4e346c9b2e67b68413d1fe5b66c3085f9b Mon Sep 17 00:00:00 2001 From: liyinhao Date: Mon, 14 Sep 2020 19:55:31 +0800 Subject: [PATCH 11/21] Add readme for centerpoint. --- configs/centerpoint/README.md | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 configs/centerpoint/README.md diff --git a/configs/centerpoint/README.md b/configs/centerpoint/README.md new file mode 100644 index 0000000000..41126dc845 --- /dev/null +++ b/configs/centerpoint/README.md @@ -0,0 +1,53 @@ +# Center-based 3D Object Detection and Tracking + +## Introduction + +We implement CenterPoint and provide the result and checkpoints on nuScenes dataset. + +We follow the below style to name config files. Contributors are advised to follow the same style. +`{xxx}` is required field and `[yyy]` is optional. + +`{model}`: model type like `centerpoint`. + +`{model setting}`: voxel size and voxel type like `01voxel`, `02pillar`. + +`{backbone}`: backbone type like `second`. + +`{neck}`: neck type like `secfpn`. + +`[dcn]`: Whether to use deformable convolution. + +`[circle]`: Whether to use circular nms. + +`[batch_per_gpu x gpu]`: GPUs and samples per GPU, 4x8 is used by default. + +`{schedule}`: training schedule, options are 1x, 2x, 20e, etc. 1x and 2x means 12 epochs and 24 epochs respectively. 20e is adopted in cascade models, which denotes 20 epochs. For 1x/2x, initial learning rate decays by a factor of 10 at the 8/16th and 11/22th epochs. For 20e, initial learning rate decays by a factor of 10 at the 16th and 19th epochs. + +`{dataset}`: dataset like nus-3d, kitti-3d, lyft-3d, scannet-3d, sunrgbd-3d. We also indicate the number of classes we are using if there exist multiple settings, e.g., kitti-3d-3class and kitti-3d-car means training on KITTI dataset with 3 classes and single class, respectively. +``` +@article{yin2020center, + title={Center-based 3d object detection and tracking}, + author={Yin, Tianwei and Zhou, Xingyi and Kr{\"a}henb{\"u}hl, Philipp}, + journal={arXiv preprint arXiv:2006.11275}, + year={2020} +} +``` + +## Results + +### CenterPoint + +|Backbone| Voxel type |Dcn|Circular nms| Mem (GB) | Inf time (fps) | mAP |NDS| Download | +| :---------: |:-----: |:-----: | :------: | :------------: | :----: |:----: | :------: |:------: | +|[SECFPN](./centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py)|01voxel|✗|✗|||||| +|[SECFPN](./centerpoint_01voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py)|01voxel|✗|✓|||||| +|[SECFPN](./centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py)|01voxel|✓|✗|||||| +|[SECFPN](./centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py)|01voxel|✓|✓|||||| +|[SECFPN](./centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py)|0075voxel|✗|✗|||||| +|[SECFPN](./centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py)|0075voxel|✗|✓|||||| +|[SECFPN](./centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py)|0075voxel|✓|✗|||||| +|[SECFPN](./centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py)|0075voxel|✓|✓|||||| +|[SECFPN](./centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py)|02pillar|✗|✗|||||| +|[SECFPN](./centerpoint_02pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py)|02pillar|✗|✓|||||| +|[SECFPN](./centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py)|02pillar|✓|✗|||||| +|[SECFPN](./centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py)|02pillar|✓|✓|||||| From ecf2ac0201f6a75c012814d87d6cbbef0d995bd6 Mon Sep 17 00:00:00 2001 From: liyinhao Date: Mon, 14 Sep 2020 23:30:02 +0800 Subject: [PATCH 12/21] Streamline the code in configs. --- ...5voxel_second_secfpn_4x8_cyclic_20e_nus.py | 67 +------ ...ond_secfpn_circlenms_4x8_cyclic_20e_nus.py | 66 +----- ...el_second_secfpn_dcn_4x8_cyclic_20e_nus.py | 67 +------ ...secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py | 66 +----- ...ond_secfpn_circlenms_4x8_cyclic_20e_nus.py | 189 +----------------- ...el_second_secfpn_dcn_4x8_cyclic_20e_nus.py | 189 +----------------- ...secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py | 189 +----------------- ...ond_secfpn_circlenms_4x8_cyclic_20e_nus.py | 186 +---------------- ...ar_second_secfpn_dcn_4x8_cyclic_20e_nus.py | 186 +---------------- ...secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py | 186 +---------------- 10 files changed, 22 insertions(+), 1369 deletions(-) diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py index 64d6209220..1607727a3d 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py @@ -1,7 +1,4 @@ -_base_ = [ - '../_base_/models/centerpoint_01voxel_second_secfpn_nus.py', - '../_base_/default_runtime.py' -] +_base_ = ['./centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py'] # If point cloud range is changed, the models should also change their point # cloud range accordingly @@ -129,40 +126,9 @@ ] data = dict( - samples_per_gpu=4, - workers_per_gpu=4, - train=dict( - type='CBGSDataset', - dataset=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_train.pkl', - pipeline=train_pipeline, - classes=class_names, - modality=input_modality, - test_mode=False, - use_valid_flag=True, - # 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')), - val=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR'), - test=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR')) + train=dict(dataset=dict(pipeline=train_pipeline)), + val=dict(pipeline=test_pipeline), + test=dict(pipeline=test_pipeline)) model = dict( pts_voxel_layer=dict(voxel_size=voxel_size), @@ -179,28 +145,3 @@ test_cfg = dict( pts=dict(voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2])) - -# For nuScenes dataset, we usually evaluate the model at the end of training. -# Since the models are trained by 24 epochs by default, we set evaluation -# interval to be 24. Please change the interval accordingly if you do not -# use a default schedule. -# optimizer -# This schedule is mainly used by models on nuScenes dataset -optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) -# max_norm=10 is better for SECOND -optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) -lr_config = dict( - policy='cyclic', - target_ratio=(10, 1e-4), - cyclic_times=1, - step_ratio_up=0.4, -) -momentum_config = dict( - policy='cyclic', - target_ratio=(0.85 / 0.95, 1), - cyclic_times=1, - step_ratio_up=0.4, -) - -# runtime settings -total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py index 882bef41b6..c87f849ebe 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py @@ -1,7 +1,4 @@ -_base_ = [ - '../_base_/models/centerpoint_01voxel_second_secfpn_nus.py', - '../_base_/default_runtime.py' -] +_base_ = ['./centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py'] # If point cloud range is changed, the models should also change their point # cloud range accordingly @@ -129,40 +126,9 @@ ] data = dict( - samples_per_gpu=4, - workers_per_gpu=4, - train=dict( - type='CBGSDataset', - dataset=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_train.pkl', - pipeline=train_pipeline, - classes=class_names, - modality=input_modality, - test_mode=False, - use_valid_flag=True, - # 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')), - val=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR'), - test=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR')) + train=dict(dataset=dict(pipeline=train_pipeline)), + val=dict(pipeline=test_pipeline), + test=dict(pipeline=test_pipeline)) model = dict( pts_voxel_layer=dict(voxel_size=voxel_size), @@ -182,27 +148,3 @@ nms_type='circle', voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2])) -# For nuScenes dataset, we usually evaluate the model at the end of training. -# Since the models are trained by 24 epochs by default, we set evaluation -# interval to be 24. Please change the interval accordingly if you do not -# use a default schedule. -# optimizer -# This schedule is mainly used by models on nuScenes dataset -optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) -# max_norm=10 is better for SECOND -optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) -lr_config = dict( - policy='cyclic', - target_ratio=(10, 1e-4), - cyclic_times=1, - step_ratio_up=0.4, -) -momentum_config = dict( - policy='cyclic', - target_ratio=(0.85 / 0.95, 1), - cyclic_times=1, - step_ratio_up=0.4, -) - -# runtime settings -total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py index 679e4119ec..0985d90d3e 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py @@ -1,7 +1,4 @@ -_base_ = [ - '../_base_/models/centerpoint_01voxel_second_secfpn_nus.py', - '../_base_/default_runtime.py' -] +_base_ = ['./centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py'] # If point cloud range is changed, the models should also change their point # cloud range accordingly @@ -129,40 +126,9 @@ ] data = dict( - samples_per_gpu=4, - workers_per_gpu=4, - train=dict( - type='CBGSDataset', - dataset=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_train.pkl', - pipeline=train_pipeline, - classes=class_names, - modality=input_modality, - test_mode=False, - use_valid_flag=True, - # 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')), - val=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR'), - test=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR')) + train=dict(dataset=dict(pipeline=train_pipeline)), + val=dict(pipeline=test_pipeline), + test=dict(pipeline=test_pipeline)) model = dict( pts_voxel_layer=dict(voxel_size=voxel_size), @@ -180,28 +146,3 @@ test_cfg = dict( pts=dict(voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2])) - -# For nuScenes dataset, we usually evaluate the model at the end of training. -# Since the models are trained by 24 epochs by default, we set evaluation -# interval to be 24. Please change the interval accordingly if you do not -# use a default schedule. -# optimizer -# This schedule is mainly used by models on nuScenes dataset -optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) -# max_norm=10 is better for SECOND -optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) -lr_config = dict( - policy='cyclic', - target_ratio=(10, 1e-4), - cyclic_times=1, - step_ratio_up=0.4, -) -momentum_config = dict( - policy='cyclic', - target_ratio=(0.85 / 0.95, 1), - cyclic_times=1, - step_ratio_up=0.4, -) - -# runtime settings -total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py index 7f4c8f0e0a..ad06729cba 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py @@ -1,7 +1,4 @@ -_base_ = [ - '../_base_/models/centerpoint_0075voxel_second_secfpn_dcn' - '_circlenms_nus.py', '../_base_/default_runtime.py' -] +_base_ = ['./centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py'] # If point cloud range is changed, the models should also change their point # cloud range accordingly @@ -129,40 +126,9 @@ ] data = dict( - samples_per_gpu=4, - workers_per_gpu=4, - train=dict( - type='CBGSDataset', - dataset=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_train.pkl', - pipeline=train_pipeline, - classes=class_names, - modality=input_modality, - test_mode=False, - use_valid_flag=True, - # 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')), - val=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR'), - test=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR')) + train=dict(dataset=dict(pipeline=train_pipeline)), + val=dict(pipeline=test_pipeline), + test=dict(pipeline=test_pipeline)) test_cfg = dict(pts=dict(nms_type='circle')) @@ -185,27 +151,3 @@ nms_type='circle', voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2])) -# For nuScenes dataset, we usually evaluate the model at the end of training. -# Since the models are trained by 24 epochs by default, we set evaluation -# interval to be 24. Please change the interval accordingly if you do not -# use a default schedule. -# optimizer -# This schedule is mainly used by models on nuScenes dataset -optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) -# max_norm=10 is better for SECOND -optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) -lr_config = dict( - policy='cyclic', - target_ratio=(10, 1e-4), - cyclic_times=1, - step_ratio_up=0.4, -) -momentum_config = dict( - policy='cyclic', - target_ratio=(0.85 / 0.95, 1), - cyclic_times=1, - step_ratio_up=0.4, -) - -# runtime settings -total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_01voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py index 97d14df72d..240f948837 100644 --- a/configs/centerpoint/centerpoint_01voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py @@ -1,190 +1,3 @@ -_base_ = [ - '../_base_/models/centerpoint_01voxel_second_secfpn_nus.py', - '../_base_/default_runtime.py' -] - -# If point cloud range is changed, the models should also change their point -# cloud range accordingly -point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] -# For nuScenes we usually do 10-class detection -class_names = [ - 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', - 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' -] -dataset_type = 'NuScenesDataset' -data_root = 'data/nuscenes/' -# Input modality for nuScenes dataset, this is consistent with the submission -# format which requires the information in input_modality. -input_modality = dict( - use_lidar=True, - use_camera=False, - use_radar=False, - use_map=False, - use_external=False) -file_client_args = dict(backend='disk') - -db_sampler = dict( - data_root=data_root, - info_path=data_root + 'nuscenes_dbinfos_train.pkl', - rate=1.0, - prepare=dict( - filter_by_difficulty=[-1], - filter_by_min_points=dict( - car=5, - truck=5, - bus=5, - trailer=5, - construction_vehicle=5, - traffic_cone=5, - barrier=5, - motorcycle=5, - bicycle=5, - pedestrian=5, - )), - classes=class_names, - sample_groups=dict( - car=2, - truck=3, - construction_vehicle=7, - bus=4, - trailer=6, - barrier=2, - motorcycle=6, - bicycle=6, - pedestrian=2, - traffic_cone=2, - ), - points_loader=dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args)) - -train_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), - dict(type='ObjectSample', db_sampler=db_sampler), - dict( - type='GlobalRotScaleTrans', - rot_range=[-0.3925, 0.3925], - scale_ratio_range=[0.95, 1.05], - translation_std=[0, 0, 0]), - dict( - type='RandomFlip3D', - sync_2d=False, - flip_ratio_bev_horizontal=0.5, - flip_ratio_bev_vertical=0.5), - dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectNameFilter', classes=class_names), - dict(type='PointShuffle'), - dict(type='DefaultFormatBundle3D', class_names=class_names), - dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) -] -test_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict( - type='MultiScaleFlipAug3D', - img_scale=(1333, 800), - pts_scale_ratio=1, - flip=False, - transforms=[ - dict( - type='GlobalRotScaleTrans', - rot_range=[0, 0], - scale_ratio_range=[1., 1.], - translation_std=[0, 0, 0]), - dict(type='RandomFlip3D'), - dict( - type='PointsRangeFilter', point_cloud_range=point_cloud_range), - dict( - type='DefaultFormatBundle3D', - class_names=class_names, - with_label=False), - dict(type='Collect3D', keys=['points']) - ]) -] - -data = dict( - samples_per_gpu=4, - workers_per_gpu=4, - train=dict( - type='CBGSDataset', - dataset=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_train.pkl', - pipeline=train_pipeline, - classes=class_names, - modality=input_modality, - test_mode=False, - use_valid_flag=True, - # 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')), - val=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR'), - test=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR')) +_base_ = ['./centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py'] test_cfg = dict(pts=dict(nms_type='circle')) -# For nuScenes dataset, we usually evaluate the model at the end of training. -# Since the models are trained by 24 epochs by default, we set evaluation -# interval to be 24. Please change the interval accordingly if you do not -# use a default schedule. -# optimizer -# This schedule is mainly used by models on nuScenes dataset -optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) -# max_norm=10 is better for SECOND -optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) -lr_config = dict( - policy='cyclic', - target_ratio=(10, 1e-4), - cyclic_times=1, - step_ratio_up=0.4, -) -momentum_config = dict( - policy='cyclic', - target_ratio=(0.85 / 0.95, 1), - cyclic_times=1, - step_ratio_up=0.4, -) - -# runtime settings -total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py index 2cdd6ad9ac..315c7b79f6 100644 --- a/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py @@ -1,190 +1,3 @@ -_base_ = [ - '../_base_/models/centerpoint_01voxel_second_secfpn_nus.py', - '../_base_/default_runtime.py' -] - -# If point cloud range is changed, the models should also change their point -# cloud range accordingly -point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] -# For nuScenes we usually do 10-class detection -class_names = [ - 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', - 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' -] -dataset_type = 'NuScenesDataset' -data_root = 'data/nuscenes/' -# Input modality for nuScenes dataset, this is consistent with the submission -# format which requires the information in input_modality. -input_modality = dict( - use_lidar=True, - use_camera=False, - use_radar=False, - use_map=False, - use_external=False) -file_client_args = dict(backend='disk') - -db_sampler = dict( - data_root=data_root, - info_path=data_root + 'nuscenes_dbinfos_train.pkl', - rate=1.0, - prepare=dict( - filter_by_difficulty=[-1], - filter_by_min_points=dict( - car=5, - truck=5, - bus=5, - trailer=5, - construction_vehicle=5, - traffic_cone=5, - barrier=5, - motorcycle=5, - bicycle=5, - pedestrian=5, - )), - classes=class_names, - sample_groups=dict( - car=2, - truck=3, - construction_vehicle=7, - bus=4, - trailer=6, - barrier=2, - motorcycle=6, - bicycle=6, - pedestrian=2, - traffic_cone=2, - ), - points_loader=dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args)) - -train_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), - dict(type='ObjectSample', db_sampler=db_sampler), - dict( - type='GlobalRotScaleTrans', - rot_range=[-0.3925, 0.3925], - scale_ratio_range=[0.95, 1.05], - translation_std=[0, 0, 0]), - dict( - type='RandomFlip3D', - sync_2d=False, - flip_ratio_bev_horizontal=0.5, - flip_ratio_bev_vertical=0.5), - dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectNameFilter', classes=class_names), - dict(type='PointShuffle'), - dict(type='DefaultFormatBundle3D', class_names=class_names), - dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) -] -test_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict( - type='MultiScaleFlipAug3D', - img_scale=(1333, 800), - pts_scale_ratio=1, - flip=False, - transforms=[ - dict( - type='GlobalRotScaleTrans', - rot_range=[0, 0], - scale_ratio_range=[1., 1.], - translation_std=[0, 0, 0]), - dict(type='RandomFlip3D'), - dict( - type='PointsRangeFilter', point_cloud_range=point_cloud_range), - dict( - type='DefaultFormatBundle3D', - class_names=class_names, - with_label=False), - dict(type='Collect3D', keys=['points']) - ]) -] - -data = dict( - samples_per_gpu=4, - workers_per_gpu=4, - train=dict( - type='CBGSDataset', - dataset=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_train.pkl', - pipeline=train_pipeline, - classes=class_names, - modality=input_modality, - test_mode=False, - use_valid_flag=True, - # 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')), - val=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR'), - test=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR')) +_base_ = ['./centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py'] model = dict(pts_bbox_head=dict(dcn_head=True)) -# For nuScenes dataset, we usually evaluate the model at the end of training. -# Since the models are trained by 24 epochs by default, we set evaluation -# interval to be 24. Please change the interval accordingly if you do not -# use a default schedule. -# optimizer -# This schedule is mainly used by models on nuScenes dataset -optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) -# max_norm=10 is better for SECOND -optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) -lr_config = dict( - policy='cyclic', - target_ratio=(10, 1e-4), - cyclic_times=1, - step_ratio_up=0.4, -) -momentum_config = dict( - policy='cyclic', - target_ratio=(0.85 / 0.95, 1), - cyclic_times=1, - step_ratio_up=0.4, -) - -# runtime settings -total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py index 2f886064a6..8e58bdaaf2 100644 --- a/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py @@ -1,192 +1,5 @@ -_base_ = [ - '../_base_/models/centerpoint_01voxel_second_secfpn_nus.py', - '../_base_/default_runtime.py' -] - -# If point cloud range is changed, the models should also change their point -# cloud range accordingly -point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] -# For nuScenes we usually do 10-class detection -class_names = [ - 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', - 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' -] -dataset_type = 'NuScenesDataset' -data_root = 'data/nuscenes/' -# Input modality for nuScenes dataset, this is consistent with the submission -# format which requires the information in input_modality. -input_modality = dict( - use_lidar=True, - use_camera=False, - use_radar=False, - use_map=False, - use_external=False) -file_client_args = dict(backend='disk') - -db_sampler = dict( - data_root=data_root, - info_path=data_root + 'nuscenes_dbinfos_train.pkl', - rate=1.0, - prepare=dict( - filter_by_difficulty=[-1], - filter_by_min_points=dict( - car=5, - truck=5, - bus=5, - trailer=5, - construction_vehicle=5, - traffic_cone=5, - barrier=5, - motorcycle=5, - bicycle=5, - pedestrian=5, - )), - classes=class_names, - sample_groups=dict( - car=2, - truck=3, - construction_vehicle=7, - bus=4, - trailer=6, - barrier=2, - motorcycle=6, - bicycle=6, - pedestrian=2, - traffic_cone=2, - ), - points_loader=dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args)) - -train_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), - dict(type='ObjectSample', db_sampler=db_sampler), - dict( - type='GlobalRotScaleTrans', - rot_range=[-0.3925, 0.3925], - scale_ratio_range=[0.95, 1.05], - translation_std=[0, 0, 0]), - dict( - type='RandomFlip3D', - sync_2d=False, - flip_ratio_bev_horizontal=0.5, - flip_ratio_bev_vertical=0.5), - dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectNameFilter', classes=class_names), - dict(type='PointShuffle'), - dict(type='DefaultFormatBundle3D', class_names=class_names), - dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) -] -test_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict( - type='MultiScaleFlipAug3D', - img_scale=(1333, 800), - pts_scale_ratio=1, - flip=False, - transforms=[ - dict( - type='GlobalRotScaleTrans', - rot_range=[0, 0], - scale_ratio_range=[1., 1.], - translation_std=[0, 0, 0]), - dict(type='RandomFlip3D'), - dict( - type='PointsRangeFilter', point_cloud_range=point_cloud_range), - dict( - type='DefaultFormatBundle3D', - class_names=class_names, - with_label=False), - dict(type='Collect3D', keys=['points']) - ]) -] - -data = dict( - samples_per_gpu=4, - workers_per_gpu=4, - train=dict( - type='CBGSDataset', - dataset=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_train.pkl', - pipeline=train_pipeline, - classes=class_names, - modality=input_modality, - test_mode=False, - use_valid_flag=True, - # 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')), - val=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR'), - test=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR')) +_base_ = ['./centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py'] model = dict(pts_bbox_head=dict(dcn_head=True)) test_cfg = dict(pts=dict(nms_type='circle')) -# For nuScenes dataset, we usually evaluate the model at the end of training. -# Since the models are trained by 24 epochs by default, we set evaluation -# interval to be 24. Please change the interval accordingly if you do not -# use a default schedule. -# optimizer -# This schedule is mainly used by models on nuScenes dataset -optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) -# max_norm=10 is better for SECOND -optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) -lr_config = dict( - policy='cyclic', - target_ratio=(10, 1e-4), - cyclic_times=1, - step_ratio_up=0.4, -) -momentum_config = dict( - policy='cyclic', - target_ratio=(0.85 / 0.95, 1), - cyclic_times=1, - step_ratio_up=0.4, -) - -# runtime settings -total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_02pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_02pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py index e6f1282d32..9ae815c31d 100644 --- a/configs/centerpoint/centerpoint_02pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_02pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py @@ -1,187 +1,3 @@ -_base_ = [ - '../_base_/models/centerpoint_02pillar_second_secfpn_nus.py', - '../_base_/default_runtime.py' -] - -# If point cloud range is changed, the models should also change their point -# cloud range accordingly -point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] -# For nuScenes we usually do 10-class detection -class_names = [ - 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', - 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' -] -dataset_type = 'NuScenesDataset' -data_root = 'data/nuscenes/' -# Input modality for nuScenes dataset, this is consistent with the submission -# format which requires the information in input_modality. -input_modality = dict( - use_lidar=True, - use_camera=False, - use_radar=False, - use_map=False, - use_external=False) -file_client_args = dict(backend='disk') - -db_sampler = dict( - data_root=data_root, - info_path=data_root + 'nuscenes_dbinfos_train.pkl', - rate=1.0, - prepare=dict( - filter_by_difficulty=[-1], - filter_by_min_points=dict( - car=5, - truck=5, - bus=5, - trailer=5, - construction_vehicle=5, - traffic_cone=5, - barrier=5, - motorcycle=5, - bicycle=5, - pedestrian=5, - )), - classes=class_names, - sample_groups=dict( - car=2, - truck=3, - construction_vehicle=7, - bus=4, - trailer=6, - barrier=2, - motorcycle=6, - bicycle=6, - pedestrian=2, - traffic_cone=2, - ), - points_loader=dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args)) - -train_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), - dict(type='ObjectSample', db_sampler=db_sampler), - dict( - type='GlobalRotScaleTrans', - rot_range=[-0.3925, 0.3925], - scale_ratio_range=[0.95, 1.05], - translation_std=[0, 0, 0]), - dict( - type='RandomFlip3D', - sync_2d=False, - flip_ratio_bev_horizontal=0.5, - flip_ratio_bev_vertical=0.5), - dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectNameFilter', classes=class_names), - dict(type='PointShuffle'), - dict(type='DefaultFormatBundle3D', class_names=class_names), - dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) -] -test_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict( - type='MultiScaleFlipAug3D', - img_scale=(1333, 800), - pts_scale_ratio=1, - flip=False, - transforms=[ - dict( - type='GlobalRotScaleTrans', - rot_range=[0, 0], - scale_ratio_range=[1., 1.], - translation_std=[0, 0, 0]), - dict(type='RandomFlip3D'), - dict( - type='DefaultFormatBundle3D', - class_names=class_names, - with_label=False), - dict(type='Collect3D', keys=['points']) - ]) -] - -data = dict( - samples_per_gpu=4, - workers_per_gpu=4, - train=dict( - type='CBGSDataset', - dataset=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_train.pkl', - pipeline=train_pipeline, - classes=class_names, - modality=input_modality, - test_mode=False, - use_valid_flag=True, - # 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')), - val=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR'), - test=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR')) +_base_ = ['./centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py'] test_cfg = dict(pts=dict(nms_type='circle')) -# For nuScenes dataset, we usually evaluate the model at the end of training. -# Since the models are trained by 24 epochs by default, we set evaluation -# interval to be 24. Please change the interval accordingly if you do not -# use a default schedule. - -optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) -# max_norm=10 is better for SECOND -optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) -lr_config = dict( - policy='cyclic', - target_ratio=(10, 1e-4), - cyclic_times=1, - step_ratio_up=0.4, -) -momentum_config = dict( - policy='cyclic', - target_ratio=(0.85 / 0.95, 1), - cyclic_times=1, - step_ratio_up=0.4, -) - -# runtime settings -total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py index 829521e66a..a684f99554 100644 --- a/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py @@ -1,187 +1,3 @@ -_base_ = [ - '../_base_/models/centerpoint_02pillar_second_secfpn_nus.py', - '../_base_/default_runtime.py' -] - -# If point cloud range is changed, the models should also change their point -# cloud range accordingly -point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] -# For nuScenes we usually do 10-class detection -class_names = [ - 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', - 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' -] -dataset_type = 'NuScenesDataset' -data_root = 'data/nuscenes/' -# Input modality for nuScenes dataset, this is consistent with the submission -# format which requires the information in input_modality. -input_modality = dict( - use_lidar=True, - use_camera=False, - use_radar=False, - use_map=False, - use_external=False) -file_client_args = dict(backend='disk') - -db_sampler = dict( - data_root=data_root, - info_path=data_root + 'nuscenes_dbinfos_train.pkl', - rate=1.0, - prepare=dict( - filter_by_difficulty=[-1], - filter_by_min_points=dict( - car=5, - truck=5, - bus=5, - trailer=5, - construction_vehicle=5, - traffic_cone=5, - barrier=5, - motorcycle=5, - bicycle=5, - pedestrian=5, - )), - classes=class_names, - sample_groups=dict( - car=2, - truck=3, - construction_vehicle=7, - bus=4, - trailer=6, - barrier=2, - motorcycle=6, - bicycle=6, - pedestrian=2, - traffic_cone=2, - ), - points_loader=dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args)) - -train_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), - # dict(type='ObjectSample', db_sampler=db_sampler), - dict( - type='GlobalRotScaleTrans', - rot_range=[-0.3925, 0.3925], - scale_ratio_range=[0.95, 1.05], - translation_std=[0, 0, 0]), - dict( - type='RandomFlip3D', - sync_2d=False, - flip_ratio_bev_horizontal=0.5, - flip_ratio_bev_vertical=0.5), - dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectNameFilter', classes=class_names), - dict(type='PointShuffle'), - dict(type='DefaultFormatBundle3D', class_names=class_names), - dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) -] -test_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict( - type='MultiScaleFlipAug3D', - img_scale=(1333, 800), - pts_scale_ratio=1, - flip=False, - transforms=[ - dict( - type='GlobalRotScaleTrans', - rot_range=[0, 0], - scale_ratio_range=[1., 1.], - translation_std=[0, 0, 0]), - dict(type='RandomFlip3D'), - dict( - type='DefaultFormatBundle3D', - class_names=class_names, - with_label=False), - dict(type='Collect3D', keys=['points']) - ]) -] - -data = dict( - samples_per_gpu=4, - workers_per_gpu=4, - train=dict( - type='CBGSDataset', - dataset=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_train.pkl', - pipeline=train_pipeline, - classes=class_names, - modality=input_modality, - test_mode=False, - use_valid_flag=True, - # 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')), - val=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR'), - test=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR')) +_base_ = ['./centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py'] model = dict(pts_bbox_head=dict(dcn_head=True)) -# For nuScenes dataset, we usually evaluate the model at the end of training. -# Since the models are trained by 24 epochs by default, we set evaluation -# interval to be 24. Please change the interval accordingly if you do not -# use a default schedule. - -optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) -# max_norm=10 is better for SECOND -optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) -lr_config = dict( - policy='cyclic', - target_ratio=(10, 1e-4), - cyclic_times=1, - step_ratio_up=0.4, -) -momentum_config = dict( - policy='cyclic', - target_ratio=(0.85 / 0.95, 1), - cyclic_times=1, - step_ratio_up=0.4, -) - -# runtime settings -total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py index 67159f3626..08a70e04dd 100644 --- a/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py @@ -1,188 +1,4 @@ -_base_ = [ - '../_base_/models/centerpoint_02pillar_second_secfpn_nus.py', - '../_base_/default_runtime.py' -] - -# If point cloud range is changed, the models should also change their point -# cloud range accordingly -point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] -# For nuScenes we usually do 10-class detection -class_names = [ - 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', - 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' -] -dataset_type = 'NuScenesDataset' -data_root = 'data/nuscenes/' -# Input modality for nuScenes dataset, this is consistent with the submission -# format which requires the information in input_modality. -input_modality = dict( - use_lidar=True, - use_camera=False, - use_radar=False, - use_map=False, - use_external=False) -file_client_args = dict(backend='disk') - -db_sampler = dict( - data_root=data_root, - info_path=data_root + 'nuscenes_dbinfos_train.pkl', - rate=1.0, - prepare=dict( - filter_by_difficulty=[-1], - filter_by_min_points=dict( - car=5, - truck=5, - bus=5, - trailer=5, - construction_vehicle=5, - traffic_cone=5, - barrier=5, - motorcycle=5, - bicycle=5, - pedestrian=5, - )), - classes=class_names, - sample_groups=dict( - car=2, - truck=3, - construction_vehicle=7, - bus=4, - trailer=6, - barrier=2, - motorcycle=6, - bicycle=6, - pedestrian=2, - traffic_cone=2, - ), - points_loader=dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args)) - -train_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), - dict(type='ObjectSample', db_sampler=db_sampler), - dict( - type='GlobalRotScaleTrans', - rot_range=[-0.3925, 0.3925], - scale_ratio_range=[0.95, 1.05], - translation_std=[0, 0, 0]), - dict( - type='RandomFlip3D', - sync_2d=False, - flip_ratio_bev_horizontal=0.5, - flip_ratio_bev_vertical=0.5), - dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectNameFilter', classes=class_names), - dict(type='PointShuffle'), - dict(type='DefaultFormatBundle3D', class_names=class_names), - dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) -] -test_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict( - type='MultiScaleFlipAug3D', - img_scale=(1333, 800), - pts_scale_ratio=1, - flip=False, - transforms=[ - dict( - type='GlobalRotScaleTrans', - rot_range=[0, 0], - scale_ratio_range=[1., 1.], - translation_std=[0, 0, 0]), - dict(type='RandomFlip3D'), - dict( - type='DefaultFormatBundle3D', - class_names=class_names, - with_label=False), - dict(type='Collect3D', keys=['points']) - ]) -] - -data = dict( - samples_per_gpu=4, - workers_per_gpu=4, - train=dict( - type='CBGSDataset', - dataset=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_train.pkl', - pipeline=train_pipeline, - classes=class_names, - modality=input_modality, - test_mode=False, - use_valid_flag=True, - # 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')), - val=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR'), - test=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR')) +_base_ = ['./centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py'] test_cfg = dict(pts=dict(nms_type='circle')) model = dict(pts_bbox_head=dict(dcn_head=True)) -# For nuScenes dataset, we usually evaluate the model at the end of training. -# Since the models are trained by 24 epochs by default, we set evaluation -# interval to be 24. Please change the interval accordingly if you do not -# use a default schedule. - -optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) -# max_norm=10 is better for SECOND -optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) -lr_config = dict( - policy='cyclic', - target_ratio=(10, 1e-4), - cyclic_times=1, - step_ratio_up=0.4, -) -momentum_config = dict( - policy='cyclic', - target_ratio=(0.85 / 0.95, 1), - cyclic_times=1, - step_ratio_up=0.4, -) - -# runtime settings -total_epochs = 20 From b3e3ccfa17763a5b74261117cf4ee2ba26db5e58 Mon Sep 17 00:00:00 2001 From: liyinhao Date: Wed, 16 Sep 2020 06:42:51 +0800 Subject: [PATCH 13/21] Change readme, add nus-3d in base config --- .../centerpoint_01voxel_second_secfpn_nus.py | 18 ++--------- .../centerpoint_02pillar_second_secfpn_nus.py | 17 ++-------- configs/centerpoint/README.md | 26 ++++++++-------- ...1voxel_second_secfpn_4x8_cyclic_20e_nus.py | 30 ++++++------------ ...pillar_second_secfpn_4x8_cyclic_20e_nus.py | 31 +++++++------------ 5 files changed, 40 insertions(+), 82 deletions(-) diff --git a/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py b/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py index a823ad84f6..62c2b2be92 100644 --- a/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py +++ b/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py @@ -1,12 +1,8 @@ voxel_size = [0.1, 0.1, 0.2] -point_cloud_range = [-51.2, -51.2, -5.0, 51.2, 51.2, 3.0] model = dict( type='CenterPoint', pts_voxel_layer=dict( - max_num_points=10, - point_cloud_range=point_cloud_range, - voxel_size=voxel_size, - max_voxels=(90000, 120000)), + max_num_points=10, voxel_size=voxel_size, max_voxels=(90000, 120000)), pts_voxel_encoder=dict(type='HardSimpleVFE', num_features=5), pts_middle_encoder=dict( type='SparseEncoder', @@ -46,20 +42,14 @@ dict(num_class=2, class_names=['motorcycle', 'bicycle']), dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), ], - common_heads={ - 'reg': (2, 2), - 'height': (1, 2), - 'dim': (3, 2), - 'rot': (2, 2), - 'vel': (2, 2) - }, + common_heads=dict( + reg=(2, 2), height=(1, 2), dim=(3, 2), rot=(2, 2), vel=(2, 2)), share_conv_channel=64, bbox_coder=dict( type='CenterPointBBoxCoder', post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], max_num=500, score_threshold=0.1, - pc_range=point_cloud_range[:2], out_size_factor=8, voxel_size=voxel_size[:2], code_size=9), @@ -70,7 +60,6 @@ train_cfg = dict( pts=dict( grid_size=[1024, 1024, 40], - point_cloud_range=point_cloud_range, voxel_size=voxel_size, out_size_factor=8, dense_reg=1, @@ -87,7 +76,6 @@ min_radius=[4, 12, 10, 1, 0.85, 0.175], post_max_size=83, score_threshold=0.1, - pc_range=point_cloud_range[:2], out_size_factor=8, voxel_size=voxel_size[:2], nms_type='rotate', diff --git a/configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py b/configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py index 7a6f459ed4..a816f6a1e6 100644 --- a/configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py +++ b/configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py @@ -2,17 +2,13 @@ model = dict( type='CenterPoint', pts_voxel_layer=dict( - max_num_points=20, - point_cloud_range=[-51.2, -51.2, -5.0, 51.2, 51.2, 3.0], - voxel_size=voxel_size, - max_voxels=(30000, 40000)), + max_num_points=20, voxel_size=voxel_size, max_voxels=(30000, 40000)), pts_voxel_encoder=dict( type='PillarFeatureNet', in_channels=5, feat_channels=[64], with_distance=False, voxel_size=(0.2, 0.2, 8), - point_cloud_range=(-51.2, -51.2, -5.0, 51.2, 51.2, 3.0), norm_cfg=dict(type='BN1d', eps=1e-3, momentum=0.01), legacy=False), pts_middle_encoder=dict( @@ -45,20 +41,14 @@ dict(num_class=2, class_names=['motorcycle', 'bicycle']), dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), ], - common_heads={ - 'reg': (2, 2), - 'height': (1, 2), - 'dim': (3, 2), - 'rot': (2, 2), - 'vel': (2, 2) - }, + common_heads=dict( + reg=(2, 2), height=(1, 2), dim=(3, 2), rot=(2, 2), vel=(2, 2)), share_conv_channel=64, bbox_coder=dict( type='CenterPointBBoxCoder', post_center_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], max_num=500, score_threshold=0.1, - pc_range=[-51.2, -51.2], out_size_factor=4, voxel_size=voxel_size[:2], code_size=9), @@ -69,7 +59,6 @@ train_cfg = dict( pts=dict( grid_size=[512, 512, 1], - point_cloud_range=[-51.2, -51.2, -5., 51.2, 51.2, 3.], voxel_size=voxel_size, out_size_factor=4, dense_reg=1, diff --git a/configs/centerpoint/README.md b/configs/centerpoint/README.md index 41126dc845..56a1e06951 100644 --- a/configs/centerpoint/README.md +++ b/configs/centerpoint/README.md @@ -37,17 +37,17 @@ We follow the below style to name config files. Contributors are advised to foll ### CenterPoint -|Backbone| Voxel type |Dcn|Circular nms| Mem (GB) | Inf time (fps) | mAP |NDS| Download | +|Backbone| Voxel type (voxel size) |Dcn|Circular nms| Mem (GB) | Inf time (fps) | mAP |NDS| Download | | :---------: |:-----: |:-----: | :------: | :------------: | :----: |:----: | :------: |:------: | -|[SECFPN](./centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py)|01voxel|✗|✗|||||| -|[SECFPN](./centerpoint_01voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py)|01voxel|✗|✓|||||| -|[SECFPN](./centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py)|01voxel|✓|✗|||||| -|[SECFPN](./centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py)|01voxel|✓|✓|||||| -|[SECFPN](./centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py)|0075voxel|✗|✗|||||| -|[SECFPN](./centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py)|0075voxel|✗|✓|||||| -|[SECFPN](./centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py)|0075voxel|✓|✗|||||| -|[SECFPN](./centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py)|0075voxel|✓|✓|||||| -|[SECFPN](./centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py)|02pillar|✗|✗|||||| -|[SECFPN](./centerpoint_02pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py)|02pillar|✗|✓|||||| -|[SECFPN](./centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py)|02pillar|✓|✗|||||| -|[SECFPN](./centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py)|02pillar|✓|✓|||||| +|[SECFPN](./centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py)|voxel (0.1)|✗|✗|||||| +|[SECFPN](./centerpoint_01voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py)|voxel (0.1)|✗|✓|||||| +|[SECFPN](./centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py)|voxel (0.1)|✓|✗|||||| +|[SECFPN](./centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py)|voxel (0.1)|✓|✓|||||| +|[SECFPN](./centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py)|voxel (0.075)|✗|✗|||||| +|[SECFPN](./centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py)|voxel (0.075)|✗|✓|||||| +|[SECFPN](./centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py)|voxel (0.075)|✓|✗|||||| +|[SECFPN](./centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py)|voxel (0.075)|✓|✓|||||| +|[SECFPN](./centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py)|pillar (0.2)|✗|✗|||||| +|[SECFPN](./centerpoint_02pillar_second_secfpn_circlenms_4x8_cyclic_20e_nus.py)|pillar (0.2)|✗|✓|||||| +|[SECFPN](./centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py)|pillar (0.2)|✓|✗|||||| +|[SECFPN](./centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py)|pillar (0.2)|✓|✓|||||| diff --git a/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py index 9989acec3d..388c580929 100644 --- a/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py @@ -1,4 +1,5 @@ _base_ = [ + '../_base_/datasets/nus-3d.py', '../_base_/models/centerpoint_01voxel_second_secfpn_nus.py', '../_base_/default_runtime.py' ] @@ -128,8 +129,6 @@ ] data = dict( - samples_per_gpu=4, - workers_per_gpu=4, train=dict( type='CBGSDataset', dataset=dict( @@ -144,24 +143,15 @@ # 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')), - val=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR'), - test=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR')) + val=dict(pipeline=test_pipeline, classes=class_names), + test=dict(pipeline=test_pipeline, classes=class_names)) + +model = dict( + pts_voxel_layer=dict(point_cloud_range=point_cloud_range), + pts_bbox_head=dict(bbox_coder=dict(pc_range=point_cloud_range[:2]))) +# model training and testing settings +train_cfg = dict(pts=dict(point_cloud_range=point_cloud_range)) +test_cfg = dict(pts=dict(pc_range=point_cloud_range[:2])) # For nuScenes dataset, we usually evaluate the model at the end of training. # Since the models are trained by 24 epochs by default, we set evaluation # interval to be 24. Please change the interval accordingly if you do not diff --git a/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py index bdbb07c06f..dfb9cf65de 100644 --- a/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py @@ -1,4 +1,5 @@ _base_ = [ + '../_base_/datasets/nus-3d.py', '../_base_/models/centerpoint_02pillar_second_secfpn_nus.py', '../_base_/default_runtime.py' ] @@ -126,8 +127,6 @@ ] data = dict( - samples_per_gpu=4, - workers_per_gpu=4, train=dict( type='CBGSDataset', dataset=dict( @@ -142,24 +141,16 @@ # 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')), - val=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR'), - test=dict( - type=dataset_type, - data_root=data_root, - ann_file=data_root + 'nuscenes_infos_val.pkl', - pipeline=test_pipeline, - classes=class_names, - modality=input_modality, - test_mode=True, - box_type_3d='LiDAR')) + val=dict(pipeline=test_pipeline, classes=class_names), + test=dict(pipeline=test_pipeline, classes=class_names)) + +model = dict( + pts_voxel_layer=dict(point_cloud_range=point_cloud_range), + pts_voxel_encoder=dict(point_cloud_range=point_cloud_range), + pts_bbox_head=dict(bbox_coder=dict(pc_range=point_cloud_range[:2]))) +# model training and testing settings +train_cfg = dict(pts=dict(point_cloud_range=point_cloud_range)) +test_cfg = dict(pts=dict(pc_range=point_cloud_range[:2])) # For nuScenes dataset, we usually evaluate the model at the end of training. # Since the models are trained by 24 epochs by default, we set evaluation # interval to be 24. Please change the interval accordingly if you do not From a150bb148d72bec7b2c42930191c61bda0c3e4b3 Mon Sep 17 00:00:00 2001 From: liyinhao Date: Fri, 18 Sep 2020 08:25:24 +0800 Subject: [PATCH 14/21] Use seperate_head config to build seperate head, remove '[0]' in simple_test_pts --- .../centerpoint_01voxel_second_secfpn_nus.py | 12 ++++++------ .../centerpoint_02pillar_second_secfpn_nus.py | 10 +++++----- ...0075voxel_second_secfpn_4x8_cyclic_20e_nus.py | 3 ++- ...second_secfpn_circlenms_4x8_cyclic_20e_nus.py | 3 ++- ...voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py | 16 ++++++++++++++-- ...nd_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py | 16 ++++++++++++++-- ...voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py | 15 ++++++++++++++- ...nd_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py | 15 ++++++++++++++- ...illar_second_secfpn_dcn_4x8_cyclic_20e_nus.py | 15 ++++++++++++++- ...nd_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py | 15 ++++++++++++++- mmdet3d/models/detectors/centerpoint.py | 2 +- 11 files changed, 100 insertions(+), 22 deletions(-) diff --git a/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py b/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py index 62c2b2be92..a2ec26a402 100644 --- a/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py +++ b/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py @@ -53,9 +53,11 @@ out_size_factor=8, voxel_size=voxel_size[:2], code_size=9), - dcn_head=False, + seperate_head=dict( + type='SeparateHead', init_bias=-2.19, final_kernel=3), loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) + loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25), + norm_bbox=True)) # model training and testing settings train_cfg = dict( pts=dict( @@ -66,8 +68,7 @@ gaussian_overlap=0.1, max_objs=500, min_radius=2, - code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0], - no_log=False)) + code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0])) test_cfg = dict( pts=dict( post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], @@ -81,5 +82,4 @@ nms_type='rotate', nms_pre_max_size=1000, nms_post_max_size=83, - nms_iou_threshold=0.2, - no_log=False)) + nms_iou_threshold=0.2)) diff --git a/configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py b/configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py index a816f6a1e6..1916d1411e 100644 --- a/configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py +++ b/configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py @@ -52,9 +52,11 @@ out_size_factor=4, voxel_size=voxel_size[:2], code_size=9), - dcn_head=False, + seperate_head=dict( + type='SeparateHead', init_bias=-2.19, final_kernel=3), loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25))) + loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25), + norm_bbox=True)) # model training and testing settings train_cfg = dict( pts=dict( @@ -65,7 +67,6 @@ gaussian_overlap=0.1, max_objs=500, min_radius=2, - no_log=False, code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0])) test_cfg = dict( pts=dict( @@ -81,5 +82,4 @@ nms_type='rotate', nms_pre_max_size=1000, nms_post_max_size=83, - nms_iou_threshold=0.2, - no_log=False)) + nms_iou_threshold=0.2)) diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py index 1607727a3d..3f5a0a48c4 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py @@ -131,7 +131,8 @@ test=dict(pipeline=test_pipeline)) model = dict( - pts_voxel_layer=dict(voxel_size=voxel_size), + pts_voxel_layer=dict( + voxel_size=voxel_size, point_cloud_range=point_cloud_range), pts_middle_encoder=dict(sparse_shape=[41, 1440, 1440]), pts_bbox_head=dict( bbox_coder=dict( diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py index c87f849ebe..a20c01a5b7 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py @@ -131,7 +131,8 @@ test=dict(pipeline=test_pipeline)) model = dict( - pts_voxel_layer=dict(voxel_size=voxel_size), + pts_voxel_layer=dict( + voxel_size=voxel_size, point_cloud_range=point_cloud_range), pts_middle_encoder=dict(sparse_shape=[41, 1440, 1440]), pts_bbox_head=dict( bbox_coder=dict( diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py index 0985d90d3e..18b9bf45d1 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py @@ -131,12 +131,24 @@ test=dict(pipeline=test_pipeline)) model = dict( - pts_voxel_layer=dict(voxel_size=voxel_size), + pts_voxel_layer=dict( + voxel_size=voxel_size, point_cloud_range=point_cloud_range), pts_middle_encoder=dict(sparse_shape=[41, 1440, 1440]), pts_bbox_head=dict( bbox_coder=dict( voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2]), - dcn_head=True)) + seperate_head=dict( + type='DCNSeperateHead', + dcn_config=dict( + type='DCN', + in_channels=64, + out_channels=64, + kernel_size=3, + padding=1, + groups=4, + bias=True), + init_bias=-2.19, + final_kernel=3))) train_cfg = dict( pts=dict( diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py index ad06729cba..5a000a7b81 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py @@ -133,12 +133,24 @@ test_cfg = dict(pts=dict(nms_type='circle')) model = dict( - pts_voxel_layer=dict(voxel_size=voxel_size), + pts_voxel_layer=dict( + voxel_size=voxel_size, point_cloud_range=point_cloud_range), pts_middle_encoder=dict(sparse_shape=[41, 1440, 1440]), pts_bbox_head=dict( bbox_coder=dict( voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2]), - dcn_head=True)) + seperate_head=dict( + type='DCNSeperateHead', + dcn_config=dict( + type='DCN', + in_channels=64, + out_channels=64, + kernel_size=3, + padding=1, + groups=4, + bias=True), + init_bias=-2.19, + final_kernel=3))) train_cfg = dict( pts=dict( diff --git a/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py index 315c7b79f6..e08aad24b6 100644 --- a/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py @@ -1,3 +1,16 @@ _base_ = ['./centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py'] -model = dict(pts_bbox_head=dict(dcn_head=True)) +model = dict( + pts_bbox_head=dict( + seperate_head=dict( + type='DCNSeperateHead', + dcn_config=dict( + type='DCN', + in_channels=64, + out_channels=64, + kernel_size=3, + padding=1, + groups=4, + bias=True), + init_bias=-2.19, + final_kernel=3))) diff --git a/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py index 8e58bdaaf2..295f545142 100644 --- a/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py @@ -1,5 +1,18 @@ _base_ = ['./centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py'] -model = dict(pts_bbox_head=dict(dcn_head=True)) +model = dict( + pts_bbox_head=dict( + seperate_head=dict( + type='DCNSeperateHead', + dcn_config=dict( + type='DCN', + in_channels=64, + out_channels=64, + kernel_size=3, + padding=1, + groups=4, + bias=True), + init_bias=-2.19, + final_kernel=3))) test_cfg = dict(pts=dict(nms_type='circle')) diff --git a/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py index a684f99554..d98223b6da 100644 --- a/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_4x8_cyclic_20e_nus.py @@ -1,3 +1,16 @@ _base_ = ['./centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py'] -model = dict(pts_bbox_head=dict(dcn_head=True)) +model = dict( + pts_bbox_head=dict( + seperate_head=dict( + type='DCNSeperateHead', + dcn_config=dict( + type='DCN', + in_channels=64, + out_channels=64, + kernel_size=3, + padding=1, + groups=4, + bias=True), + init_bias=-2.19, + final_kernel=3))) diff --git a/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py index 08a70e04dd..578c061e99 100644 --- a/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py @@ -1,4 +1,17 @@ _base_ = ['./centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py'] test_cfg = dict(pts=dict(nms_type='circle')) -model = dict(pts_bbox_head=dict(dcn_head=True)) +model = dict( + pts_bbox_head=dict( + seperate_head=dict( + type='DCNSeperateHead', + dcn_config=dict( + type='DCN', + in_channels=64, + out_channels=64, + kernel_size=3, + padding=1, + groups=4, + bias=True), + init_bias=-2.19, + final_kernel=3))) diff --git a/mmdet3d/models/detectors/centerpoint.py b/mmdet3d/models/detectors/centerpoint.py index 1f2e02432c..f43c8968ed 100644 --- a/mmdet3d/models/detectors/centerpoint.py +++ b/mmdet3d/models/detectors/centerpoint.py @@ -78,4 +78,4 @@ def simple_test_pts(self, x, img_metas, rescale=False): bbox3d2result(bboxes, scores, labels) for bboxes, scores, labels in bbox_list ] - return bbox_results[0] + return bbox_results From 56e6a7082dc095d421a1f2378da8a237ba7f131e Mon Sep 17 00:00:00 2001 From: liyinhao Date: Fri, 18 Sep 2020 15:02:30 +0800 Subject: [PATCH 15/21] Remove input_modality --- ...erpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py | 8 -------- ...75voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py | 8 -------- ...int_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py | 8 -------- ...xel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py | 8 -------- ...nterpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py | 9 --------- ...terpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py | 9 --------- 6 files changed, 50 deletions(-) diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py index 3f5a0a48c4..dbeea378bc 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py @@ -11,14 +11,6 @@ ] dataset_type = 'NuScenesDataset' data_root = 'data/nuscenes/' -# Input modality for nuScenes dataset, this is consistent with the submission -# format which requires the information in input_modality. -input_modality = dict( - use_lidar=True, - use_camera=False, - use_radar=False, - use_map=False, - use_external=False) file_client_args = dict(backend='disk') db_sampler = dict( diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py index a20c01a5b7..68fba5fe41 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py @@ -11,14 +11,6 @@ ] dataset_type = 'NuScenesDataset' data_root = 'data/nuscenes/' -# Input modality for nuScenes dataset, this is consistent with the submission -# format which requires the information in input_modality. -input_modality = dict( - use_lidar=True, - use_camera=False, - use_radar=False, - use_map=False, - use_external=False) file_client_args = dict(backend='disk') db_sampler = dict( diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py index 18b9bf45d1..5c080ef9ad 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py @@ -11,14 +11,6 @@ ] dataset_type = 'NuScenesDataset' data_root = 'data/nuscenes/' -# Input modality for nuScenes dataset, this is consistent with the submission -# format which requires the information in input_modality. -input_modality = dict( - use_lidar=True, - use_camera=False, - use_radar=False, - use_map=False, - use_external=False) file_client_args = dict(backend='disk') db_sampler = dict( diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py index 5a000a7b81..60c392447f 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py @@ -11,14 +11,6 @@ ] dataset_type = 'NuScenesDataset' data_root = 'data/nuscenes/' -# Input modality for nuScenes dataset, this is consistent with the submission -# format which requires the information in input_modality. -input_modality = dict( - use_lidar=True, - use_camera=False, - use_radar=False, - use_map=False, - use_external=False) file_client_args = dict(backend='disk') db_sampler = dict( diff --git a/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py index 388c580929..7a08a562be 100644 --- a/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py @@ -14,14 +14,6 @@ ] dataset_type = 'NuScenesDataset' data_root = 'data/nuscenes/' -# Input modality for nuScenes dataset, this is consistent with the submission -# format which requires the information in input_modality. -input_modality = dict( - use_lidar=True, - use_camera=False, - use_radar=False, - use_map=False, - use_external=False) file_client_args = dict(backend='disk') db_sampler = dict( @@ -137,7 +129,6 @@ ann_file=data_root + 'nuscenes_infos_train.pkl', pipeline=train_pipeline, classes=class_names, - modality=input_modality, test_mode=False, use_valid_flag=True, # we use box_type_3d='LiDAR' in kitti and nuscenes dataset diff --git a/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py index dfb9cf65de..cd58af30ea 100644 --- a/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py @@ -14,14 +14,6 @@ ] dataset_type = 'NuScenesDataset' data_root = 'data/nuscenes/' -# Input modality for nuScenes dataset, this is consistent with the submission -# format which requires the information in input_modality. -input_modality = dict( - use_lidar=True, - use_camera=False, - use_radar=False, - use_map=False, - use_external=False) file_client_args = dict(backend='disk') db_sampler = dict( @@ -135,7 +127,6 @@ ann_file=data_root + 'nuscenes_infos_train.pkl', pipeline=train_pipeline, classes=class_names, - modality=input_modality, test_mode=False, use_valid_flag=True, # we use box_type_3d='LiDAR' in kitti and nuscenes dataset From 25c0adff42ddf8866784ed8816cc597256ad36f7 Mon Sep 17 00:00:00 2001 From: liyinhao Date: Fri, 18 Sep 2020 21:48:05 +0800 Subject: [PATCH 16/21] Change coder weights for configs. --- configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py | 2 +- configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py b/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py index a2ec26a402..97011a820f 100644 --- a/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py +++ b/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py @@ -68,7 +68,7 @@ gaussian_overlap=0.1, max_objs=500, min_radius=2, - code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0])) + code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2])) test_cfg = dict( pts=dict( post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], diff --git a/configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py b/configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py index 1916d1411e..1ad15055f8 100644 --- a/configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py +++ b/configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py @@ -67,7 +67,7 @@ gaussian_overlap=0.1, max_objs=500, min_radius=2, - code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, 1.0, 1.0])) + code_weights=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2])) test_cfg = dict( pts=dict( post_center_limit_range=[-61.2, -61.2, -10.0, 61.2, 61.2, 10.0], From 475223786704602afcbf0b58aa8ccb3d06d94c50 Mon Sep 17 00:00:00 2001 From: liyinhao Date: Fri, 18 Sep 2020 22:23:21 +0800 Subject: [PATCH 17/21] Change 0075 config, change order of modules in config. --- ...5voxel_second_secfpn_4x8_cyclic_20e_nus.py | 35 ++--- ...ond_secfpn_circlenms_4x8_cyclic_20e_nus.py | 144 +----------------- ...el_second_secfpn_dcn_4x8_cyclic_20e_nus.py | 138 +---------------- ...secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py | 143 +---------------- ...1voxel_second_secfpn_4x8_cyclic_20e_nus.py | 14 +- ...pillar_second_secfpn_4x8_cyclic_20e_nus.py | 16 +- ...secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py | 3 +- 7 files changed, 42 insertions(+), 451 deletions(-) diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py index dbeea378bc..616a93db81 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py @@ -9,6 +9,24 @@ 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' ] + +model = dict( + pts_voxel_layer=dict( + voxel_size=voxel_size, point_cloud_range=point_cloud_range), + pts_middle_encoder=dict(sparse_shape=[41, 1440, 1440]), + pts_bbox_head=dict( + bbox_coder=dict( + voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2]))) + +train_cfg = dict( + pts=dict( + grid_size=[1440, 1440, 40], + voxel_size=voxel_size, + point_cloud_range=point_cloud_range)) + +test_cfg = dict( + pts=dict(voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2])) + dataset_type = 'NuScenesDataset' data_root = 'data/nuscenes/' file_client_args = dict(backend='disk') @@ -121,20 +139,3 @@ train=dict(dataset=dict(pipeline=train_pipeline)), val=dict(pipeline=test_pipeline), test=dict(pipeline=test_pipeline)) - -model = dict( - pts_voxel_layer=dict( - voxel_size=voxel_size, point_cloud_range=point_cloud_range), - pts_middle_encoder=dict(sparse_shape=[41, 1440, 1440]), - pts_bbox_head=dict( - bbox_coder=dict( - voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2]))) - -train_cfg = dict( - pts=dict( - grid_size=[1440, 1440, 40], - voxel_size=voxel_size, - point_cloud_range=point_cloud_range)) - -test_cfg = dict( - pts=dict(voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2])) diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py index 68fba5fe41..140d6bc857 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_circlenms_4x8_cyclic_20e_nus.py @@ -1,143 +1,3 @@ -_base_ = ['./centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py'] +_base_ = ['./centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py'] -# If point cloud range is changed, the models should also change their point -# cloud range accordingly -voxel_size = [0.075, 0.075, 0.2] -point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] -# For nuScenes we usually do 10-class detection -class_names = [ - 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', - 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' -] -dataset_type = 'NuScenesDataset' -data_root = 'data/nuscenes/' -file_client_args = dict(backend='disk') - -db_sampler = dict( - data_root=data_root, - info_path=data_root + 'nuscenes_dbinfos_train.pkl', - rate=1.0, - prepare=dict( - filter_by_difficulty=[-1], - filter_by_min_points=dict( - car=5, - truck=5, - bus=5, - trailer=5, - construction_vehicle=5, - traffic_cone=5, - barrier=5, - motorcycle=5, - bicycle=5, - pedestrian=5, - )), - classes=class_names, - sample_groups=dict( - car=2, - truck=3, - construction_vehicle=7, - bus=4, - trailer=6, - barrier=2, - motorcycle=6, - bicycle=6, - pedestrian=2, - traffic_cone=2, - ), - points_loader=dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args)) - -train_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), - dict(type='ObjectSample', db_sampler=db_sampler), - dict( - type='GlobalRotScaleTrans', - rot_range=[-0.3925, 0.3925], - scale_ratio_range=[0.95, 1.05], - translation_std=[0, 0, 0]), - dict( - type='RandomFlip3D', - sync_2d=False, - flip_ratio_bev_horizontal=0.5, - flip_ratio_bev_vertical=0.5), - dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectNameFilter', classes=class_names), - dict(type='PointShuffle'), - dict(type='DefaultFormatBundle3D', class_names=class_names), - dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) -] -test_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict( - type='MultiScaleFlipAug3D', - img_scale=(1333, 800), - pts_scale_ratio=1, - flip=False, - transforms=[ - dict( - type='GlobalRotScaleTrans', - rot_range=[0, 0], - scale_ratio_range=[1., 1.], - translation_std=[0, 0, 0]), - dict(type='RandomFlip3D'), - dict( - type='PointsRangeFilter', point_cloud_range=point_cloud_range), - dict( - type='DefaultFormatBundle3D', - class_names=class_names, - with_label=False), - dict(type='Collect3D', keys=['points']) - ]) -] - -data = dict( - train=dict(dataset=dict(pipeline=train_pipeline)), - val=dict(pipeline=test_pipeline), - test=dict(pipeline=test_pipeline)) - -model = dict( - pts_voxel_layer=dict( - voxel_size=voxel_size, point_cloud_range=point_cloud_range), - pts_middle_encoder=dict(sparse_shape=[41, 1440, 1440]), - pts_bbox_head=dict( - bbox_coder=dict( - voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2]))) - -train_cfg = dict( - pts=dict( - grid_size=[1440, 1440, 40], - voxel_size=voxel_size, - point_cloud_range=point_cloud_range)) - -test_cfg = dict( - pts=dict( - nms_type='circle', - voxel_size=voxel_size[:2], - pc_range=point_cloud_range[:2])) +test_cfg = dict(pts=dict(nms_type='circle')) diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py index 5c080ef9ad..84b32c6908 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_4x8_cyclic_20e_nus.py @@ -1,134 +1,7 @@ -_base_ = ['./centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py'] - -# If point cloud range is changed, the models should also change their point -# cloud range accordingly -voxel_size = [0.075, 0.075, 0.2] -point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] -# For nuScenes we usually do 10-class detection -class_names = [ - 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', - 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' -] -dataset_type = 'NuScenesDataset' -data_root = 'data/nuscenes/' -file_client_args = dict(backend='disk') - -db_sampler = dict( - data_root=data_root, - info_path=data_root + 'nuscenes_dbinfos_train.pkl', - rate=1.0, - prepare=dict( - filter_by_difficulty=[-1], - filter_by_min_points=dict( - car=5, - truck=5, - bus=5, - trailer=5, - construction_vehicle=5, - traffic_cone=5, - barrier=5, - motorcycle=5, - bicycle=5, - pedestrian=5, - )), - classes=class_names, - sample_groups=dict( - car=2, - truck=3, - construction_vehicle=7, - bus=4, - trailer=6, - barrier=2, - motorcycle=6, - bicycle=6, - pedestrian=2, - traffic_cone=2, - ), - points_loader=dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args)) - -train_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), - dict(type='ObjectSample', db_sampler=db_sampler), - dict( - type='GlobalRotScaleTrans', - rot_range=[-0.3925, 0.3925], - scale_ratio_range=[0.95, 1.05], - translation_std=[0, 0, 0]), - dict( - type='RandomFlip3D', - sync_2d=False, - flip_ratio_bev_horizontal=0.5, - flip_ratio_bev_vertical=0.5), - dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectNameFilter', classes=class_names), - dict(type='PointShuffle'), - dict(type='DefaultFormatBundle3D', class_names=class_names), - dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) -] -test_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict( - type='MultiScaleFlipAug3D', - img_scale=(1333, 800), - pts_scale_ratio=1, - flip=False, - transforms=[ - dict( - type='GlobalRotScaleTrans', - rot_range=[0, 0], - scale_ratio_range=[1., 1.], - translation_std=[0, 0, 0]), - dict(type='RandomFlip3D'), - dict( - type='PointsRangeFilter', point_cloud_range=point_cloud_range), - dict( - type='DefaultFormatBundle3D', - class_names=class_names, - with_label=False), - dict(type='Collect3D', keys=['points']) - ]) -] - -data = dict( - train=dict(dataset=dict(pipeline=train_pipeline)), - val=dict(pipeline=test_pipeline), - test=dict(pipeline=test_pipeline)) +_base_ = ['./centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py'] model = dict( - pts_voxel_layer=dict( - voxel_size=voxel_size, point_cloud_range=point_cloud_range), - pts_middle_encoder=dict(sparse_shape=[41, 1440, 1440]), pts_bbox_head=dict( - bbox_coder=dict( - voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2]), seperate_head=dict( type='DCNSeperateHead', dcn_config=dict( @@ -141,12 +14,3 @@ bias=True), init_bias=-2.19, final_kernel=3))) - -train_cfg = dict( - pts=dict( - grid_size=[1440, 1440, 40], - voxel_size=voxel_size, - point_cloud_range=point_cloud_range)) - -test_cfg = dict( - pts=dict(voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2])) diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py index 60c392447f..8937773d6d 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py @@ -1,136 +1,7 @@ -_base_ = ['./centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py'] - -# If point cloud range is changed, the models should also change their point -# cloud range accordingly -voxel_size = [0.075, 0.075, 0.2] -point_cloud_range = [-54, -54, -5.0, 54, 54, 3.0] -# For nuScenes we usually do 10-class detection -class_names = [ - 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', - 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' -] -dataset_type = 'NuScenesDataset' -data_root = 'data/nuscenes/' -file_client_args = dict(backend='disk') - -db_sampler = dict( - data_root=data_root, - info_path=data_root + 'nuscenes_dbinfos_train.pkl', - rate=1.0, - prepare=dict( - filter_by_difficulty=[-1], - filter_by_min_points=dict( - car=5, - truck=5, - bus=5, - trailer=5, - construction_vehicle=5, - traffic_cone=5, - barrier=5, - motorcycle=5, - bicycle=5, - pedestrian=5, - )), - classes=class_names, - sample_groups=dict( - car=2, - truck=3, - construction_vehicle=7, - bus=4, - trailer=6, - barrier=2, - motorcycle=6, - bicycle=6, - pedestrian=2, - traffic_cone=2, - ), - points_loader=dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args)) - -train_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), - dict(type='ObjectSample', db_sampler=db_sampler), - dict( - type='GlobalRotScaleTrans', - rot_range=[-0.3925, 0.3925], - scale_ratio_range=[0.95, 1.05], - translation_std=[0, 0, 0]), - dict( - type='RandomFlip3D', - sync_2d=False, - flip_ratio_bev_horizontal=0.5, - flip_ratio_bev_vertical=0.5), - dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), - dict(type='ObjectNameFilter', classes=class_names), - dict(type='PointShuffle'), - dict(type='DefaultFormatBundle3D', class_names=class_names), - dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) -] -test_pipeline = [ - dict( - type='LoadPointsFromFile', - load_dim=5, - use_dim=5, - file_client_args=file_client_args), - dict( - type='LoadPointsFromMultiSweeps', - sweeps_num=9, - use_dim=[0, 1, 2, 3, 4], - file_client_args=file_client_args, - pad_empty_sweeps=True, - remove_close=True), - dict( - type='MultiScaleFlipAug3D', - img_scale=(1333, 800), - pts_scale_ratio=1, - flip=False, - transforms=[ - dict( - type='GlobalRotScaleTrans', - rot_range=[0, 0], - scale_ratio_range=[1., 1.], - translation_std=[0, 0, 0]), - dict(type='RandomFlip3D'), - dict( - type='PointsRangeFilter', point_cloud_range=point_cloud_range), - dict( - type='DefaultFormatBundle3D', - class_names=class_names, - with_label=False), - dict(type='Collect3D', keys=['points']) - ]) -] - -data = dict( - train=dict(dataset=dict(pipeline=train_pipeline)), - val=dict(pipeline=test_pipeline), - test=dict(pipeline=test_pipeline)) - -test_cfg = dict(pts=dict(nms_type='circle')) +_base_ = ['./centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py'] model = dict( - pts_voxel_layer=dict( - voxel_size=voxel_size, point_cloud_range=point_cloud_range), - pts_middle_encoder=dict(sparse_shape=[41, 1440, 1440]), pts_bbox_head=dict( - bbox_coder=dict( - voxel_size=voxel_size[:2], pc_range=point_cloud_range[:2]), seperate_head=dict( type='DCNSeperateHead', dcn_config=dict( @@ -144,14 +15,4 @@ init_bias=-2.19, final_kernel=3))) -train_cfg = dict( - pts=dict( - grid_size=[1440, 1440, 40], - voxel_size=voxel_size, - point_cloud_range=point_cloud_range)) - -test_cfg = dict( - pts=dict( - nms_type='circle', - voxel_size=voxel_size[:2], - pc_range=point_cloud_range[:2])) +test_cfg = dict(pts=dict(nms_type='circle')) diff --git a/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py index 7a08a562be..715da7d6aa 100644 --- a/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py @@ -12,6 +12,14 @@ 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' ] + +model = dict( + pts_voxel_layer=dict(point_cloud_range=point_cloud_range), + pts_bbox_head=dict(bbox_coder=dict(pc_range=point_cloud_range[:2]))) +# model training and testing settings +train_cfg = dict(pts=dict(point_cloud_range=point_cloud_range)) +test_cfg = dict(pts=dict(pc_range=point_cloud_range[:2])) + dataset_type = 'NuScenesDataset' data_root = 'data/nuscenes/' file_client_args = dict(backend='disk') @@ -137,12 +145,6 @@ val=dict(pipeline=test_pipeline, classes=class_names), test=dict(pipeline=test_pipeline, classes=class_names)) -model = dict( - pts_voxel_layer=dict(point_cloud_range=point_cloud_range), - pts_bbox_head=dict(bbox_coder=dict(pc_range=point_cloud_range[:2]))) -# model training and testing settings -train_cfg = dict(pts=dict(point_cloud_range=point_cloud_range)) -test_cfg = dict(pts=dict(pc_range=point_cloud_range[:2])) # For nuScenes dataset, we usually evaluate the model at the end of training. # Since the models are trained by 24 epochs by default, we set evaluation # interval to be 24. Please change the interval accordingly if you do not diff --git a/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py index cd58af30ea..7975157877 100644 --- a/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py @@ -12,6 +12,15 @@ 'car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone' ] + +model = dict( + pts_voxel_layer=dict(point_cloud_range=point_cloud_range), + pts_voxel_encoder=dict(point_cloud_range=point_cloud_range), + pts_bbox_head=dict(bbox_coder=dict(pc_range=point_cloud_range[:2]))) +# model training and testing settings +train_cfg = dict(pts=dict(point_cloud_range=point_cloud_range)) +test_cfg = dict(pts=dict(pc_range=point_cloud_range[:2])) + dataset_type = 'NuScenesDataset' data_root = 'data/nuscenes/' file_client_args = dict(backend='disk') @@ -135,13 +144,6 @@ val=dict(pipeline=test_pipeline, classes=class_names), test=dict(pipeline=test_pipeline, classes=class_names)) -model = dict( - pts_voxel_layer=dict(point_cloud_range=point_cloud_range), - pts_voxel_encoder=dict(point_cloud_range=point_cloud_range), - pts_bbox_head=dict(bbox_coder=dict(pc_range=point_cloud_range[:2]))) -# model training and testing settings -train_cfg = dict(pts=dict(point_cloud_range=point_cloud_range)) -test_cfg = dict(pts=dict(pc_range=point_cloud_range[:2])) # For nuScenes dataset, we usually evaluate the model at the end of training. # Since the models are trained by 24 epochs by default, we set evaluation # interval to be 24. Please change the interval accordingly if you do not diff --git a/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py index 578c061e99..5ea666a7cc 100644 --- a/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_02pillar_second_secfpn_dcn_circlenms_4x8_cyclic_20e_nus.py @@ -1,6 +1,5 @@ _base_ = ['./centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py'] -test_cfg = dict(pts=dict(nms_type='circle')) model = dict( pts_bbox_head=dict( seperate_head=dict( @@ -15,3 +14,5 @@ bias=True), init_bias=-2.19, final_kernel=3))) + +test_cfg = dict(pts=dict(nms_type='circle')) From 48c505bbf3ceed970cbb99809de43f5618af1d60 Mon Sep 17 00:00:00 2001 From: liyinhao Date: Fri, 18 Sep 2020 23:35:41 +0800 Subject: [PATCH 18/21] Change loss_bbox config, remove unnecessary things. --- .../_base_/models/centerpoint_01voxel_second_secfpn_nus.py | 3 +-- .../_base_/models/centerpoint_02pillar_second_secfpn_nus.py | 3 +-- ...enterpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py | 6 ++---- .../centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py | 6 ++---- ...centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py | 6 ++---- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py b/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py index 97011a820f..b797c5158f 100644 --- a/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py +++ b/configs/_base_/models/centerpoint_01voxel_second_secfpn_nus.py @@ -32,7 +32,6 @@ use_conv_for_no_stride=True), pts_bbox_head=dict( type='CenterHead', - mode='3d', in_channels=sum([256, 256]), tasks=[ dict(num_class=1, class_names=['car']), @@ -56,7 +55,7 @@ seperate_head=dict( type='SeparateHead', init_bias=-2.19, final_kernel=3), loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25), + loss_bbox=dict(type='L1Loss', reduction='mean', loss_weight=0.25), norm_bbox=True)) # model training and testing settings train_cfg = dict( diff --git a/configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py b/configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py index 1ad15055f8..451b209365 100644 --- a/configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py +++ b/configs/_base_/models/centerpoint_02pillar_second_secfpn_nus.py @@ -31,7 +31,6 @@ use_conv_for_no_stride=True), pts_bbox_head=dict( type='CenterHead', - mode='3d', in_channels=sum([128, 128, 128]), tasks=[ dict(num_class=1, class_names=['car']), @@ -55,7 +54,7 @@ seperate_head=dict( type='SeparateHead', init_bias=-2.19, final_kernel=3), loss_cls=dict(type='GaussianFocalLoss', reduction='mean'), - loss_bbox=dict(type='L1Loss', reduction='none', loss_weight=0.25), + loss_bbox=dict(type='L1Loss', reduction='mean', loss_weight=0.25), norm_bbox=True)) # model training and testing settings train_cfg = dict( diff --git a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py index 616a93db81..2dc58e0560 100644 --- a/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py @@ -47,8 +47,7 @@ barrier=5, motorcycle=5, bicycle=5, - pedestrian=5, - )), + pedestrian=5)), classes=class_names, sample_groups=dict( car=2, @@ -60,8 +59,7 @@ motorcycle=6, bicycle=6, pedestrian=2, - traffic_cone=2, - ), + traffic_cone=2), points_loader=dict( type='LoadPointsFromFile', load_dim=5, diff --git a/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py index 715da7d6aa..a0e9e9a2b4 100644 --- a/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py @@ -40,8 +40,7 @@ barrier=5, motorcycle=5, bicycle=5, - pedestrian=5, - )), + pedestrian=5)), classes=class_names, sample_groups=dict( car=2, @@ -53,8 +52,7 @@ motorcycle=6, bicycle=6, pedestrian=2, - traffic_cone=2, - ), + traffic_cone=2), points_loader=dict( type='LoadPointsFromFile', load_dim=5, diff --git a/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py index 7975157877..ace5818438 100644 --- a/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py @@ -41,8 +41,7 @@ barrier=5, motorcycle=5, bicycle=5, - pedestrian=5, - )), + pedestrian=5)), classes=class_names, sample_groups=dict( car=2, @@ -54,8 +53,7 @@ motorcycle=6, bicycle=6, pedestrian=2, - traffic_cone=2, - ), + traffic_cone=2), points_loader=dict( type='LoadPointsFromFile', load_dim=5, From 1bc57c8b374273049b77de4fb2886c8bdf1a9196 Mon Sep 17 00:00:00 2001 From: liyinhao Date: Sat, 19 Sep 2020 10:51:35 +0800 Subject: [PATCH 19/21] Add cyclic_20e.py --- configs/_base_/schedules/cyclic_20e.py | 24 +++++++++++++++++++ ...1voxel_second_secfpn_4x8_cyclic_20e_nus.py | 2 +- ...pillar_second_secfpn_4x8_cyclic_20e_nus.py | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 configs/_base_/schedules/cyclic_20e.py diff --git a/configs/_base_/schedules/cyclic_20e.py b/configs/_base_/schedules/cyclic_20e.py new file mode 100644 index 0000000000..aa5d83927b --- /dev/null +++ b/configs/_base_/schedules/cyclic_20e.py @@ -0,0 +1,24 @@ +# For nuScenes dataset, we usually evaluate the model at the end of training. +# Since the models are trained by 24 epochs by default, we set evaluation +# interval to be 24. Please change the interval accordingly if you do not +# use a default schedule. +# optimizer +# This schedule is mainly used by models on nuScenes dataset +optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) +# max_norm=10 is better for SECOND +optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) +lr_config = dict( + policy='cyclic', + target_ratio=(10, 1e-4), + cyclic_times=1, + step_ratio_up=0.4, +) +momentum_config = dict( + policy='cyclic', + target_ratio=(0.85 / 0.95, 1), + cyclic_times=1, + step_ratio_up=0.4, +) + +# runtime settings +total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py index a0e9e9a2b4..23af6ecdf2 100644 --- a/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py @@ -1,7 +1,7 @@ _base_ = [ '../_base_/datasets/nus-3d.py', '../_base_/models/centerpoint_01voxel_second_secfpn_nus.py', - '../_base_/default_runtime.py' + '../_base_/schedules/cyclic_20e.py', '../_base_/default_runtime.py' ] # If point cloud range is changed, the models should also change their point diff --git a/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py index ace5818438..b62e35ac48 100644 --- a/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py @@ -1,7 +1,7 @@ _base_ = [ '../_base_/datasets/nus-3d.py', '../_base_/models/centerpoint_02pillar_second_secfpn_nus.py', - '../_base_/default_runtime.py' + '../_base_/schedules/cyclic_20e.py', '../_base_/default_runtime.py' ] # If point cloud range is changed, the models should also change their point From 0b85a10bdaa1b77a295241e86478227b30a58a35 Mon Sep 17 00:00:00 2001 From: liyinhao Date: Sat, 19 Sep 2020 22:59:00 +0800 Subject: [PATCH 20/21] Rename centerhead, move centerhead, --- mmdet3d/models/dense_heads/__init__.py | 3 ++- .../multi_group_head.py => dense_heads/centerpoint_head.py} | 4 ++-- mmdet3d/models/roi_heads/bbox_heads/__init__.py | 3 +-- 3 files changed, 5 insertions(+), 5 deletions(-) rename mmdet3d/models/{roi_heads/bbox_heads/multi_group_head.py => dense_heads/centerpoint_head.py} (99%) diff --git a/mmdet3d/models/dense_heads/__init__.py b/mmdet3d/models/dense_heads/__init__.py index a6b91ec7d6..2cf9407677 100644 --- a/mmdet3d/models/dense_heads/__init__.py +++ b/mmdet3d/models/dense_heads/__init__.py @@ -1,5 +1,6 @@ from .anchor3d_head import Anchor3DHead from .base_conv_bbox_head import BaseConvBboxHead +from .centerpoint_head import CenterHead from .free_anchor3d_head import FreeAnchor3DHead from .parta2_rpn_head import PartA2RPNHead from .ssd_3d_head import SSD3DHead @@ -7,5 +8,5 @@ __all__ = [ 'Anchor3DHead', 'FreeAnchor3DHead', 'PartA2RPNHead', 'VoteHead', - 'SSD3DHead', 'BaseConvBboxHead' + 'SSD3DHead', 'BaseConvBboxHead', 'CenterHead' ] diff --git a/mmdet3d/models/roi_heads/bbox_heads/multi_group_head.py b/mmdet3d/models/dense_heads/centerpoint_head.py similarity index 99% rename from mmdet3d/models/roi_heads/bbox_heads/multi_group_head.py rename to mmdet3d/models/dense_heads/centerpoint_head.py index cc2ce05914..33eb80f7da 100644 --- a/mmdet3d/models/roi_heads/bbox_heads/multi_group_head.py +++ b/mmdet3d/models/dense_heads/centerpoint_head.py @@ -6,11 +6,11 @@ from mmdet3d.core import (circle_nms, draw_heatmap_gaussian, gaussian_radius, xywhr2xyxyr) +from mmdet3d.models import builder +from mmdet3d.models.builder import HEADS, build_loss from mmdet3d.models.utils import clip_sigmoid from mmdet3d.ops.iou3d.iou3d_utils import nms_gpu from mmdet.core import build_bbox_coder, multi_apply -from ... import builder -from ...builder import HEADS, build_loss @HEADS.register_module() diff --git a/mmdet3d/models/roi_heads/bbox_heads/__init__.py b/mmdet3d/models/roi_heads/bbox_heads/__init__.py index 38a9d4824f..1005cf614c 100644 --- a/mmdet3d/models/roi_heads/bbox_heads/__init__.py +++ b/mmdet3d/models/roi_heads/bbox_heads/__init__.py @@ -3,11 +3,10 @@ Shared2FCBBoxHead, Shared4Conv1FCBBoxHead) from .h3d_bbox_head import H3DBboxHead -from .multi_group_head import CenterHead from .parta2_bbox_head import PartA2BboxHead __all__ = [ 'BBoxHead', 'ConvFCBBoxHead', 'Shared2FCBBoxHead', 'Shared4Conv1FCBBoxHead', 'DoubleConvFCBBoxHead', 'PartA2BboxHead', - 'H3DBboxHead', 'CenterHead' + 'H3DBboxHead' ] From 7e53439b52dc3f0d930b1f2d641862820cb41bcc Mon Sep 17 00:00:00 2001 From: liyinhao Date: Sat, 19 Sep 2020 23:19:40 +0800 Subject: [PATCH 21/21] Change cyclic_20e --- configs/_base_/schedules/cyclic_20e.py | 2 +- ...1voxel_second_secfpn_4x8_cyclic_20e_nus.py | 25 ------------------- ...pillar_second_secfpn_4x8_cyclic_20e_nus.py | 24 ------------------ 3 files changed, 1 insertion(+), 50 deletions(-) diff --git a/configs/_base_/schedules/cyclic_20e.py b/configs/_base_/schedules/cyclic_20e.py index aa5d83927b..c7df532525 100644 --- a/configs/_base_/schedules/cyclic_20e.py +++ b/configs/_base_/schedules/cyclic_20e.py @@ -1,6 +1,6 @@ # For nuScenes dataset, we usually evaluate the model at the end of training. # Since the models are trained by 24 epochs by default, we set evaluation -# interval to be 24. Please change the interval accordingly if you do not +# interval to be 20. Please change the interval accordingly if you do not # use a default schedule. # optimizer # This schedule is mainly used by models on nuScenes dataset diff --git a/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py index 23af6ecdf2..8a714f2630 100644 --- a/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py @@ -142,28 +142,3 @@ box_type_3d='LiDAR')), val=dict(pipeline=test_pipeline, classes=class_names), test=dict(pipeline=test_pipeline, classes=class_names)) - -# For nuScenes dataset, we usually evaluate the model at the end of training. -# Since the models are trained by 24 epochs by default, we set evaluation -# interval to be 24. Please change the interval accordingly if you do not -# use a default schedule. -# optimizer -# This schedule is mainly used by models on nuScenes dataset -optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) -# max_norm=10 is better for SECOND -optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) -lr_config = dict( - policy='cyclic', - target_ratio=(10, 1e-4), - cyclic_times=1, - step_ratio_up=0.4, -) -momentum_config = dict( - policy='cyclic', - target_ratio=(0.85 / 0.95, 1), - cyclic_times=1, - step_ratio_up=0.4, -) - -# runtime settings -total_epochs = 20 diff --git a/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py b/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py index b62e35ac48..e71210906a 100644 --- a/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py +++ b/configs/centerpoint/centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py @@ -141,27 +141,3 @@ box_type_3d='LiDAR')), val=dict(pipeline=test_pipeline, classes=class_names), test=dict(pipeline=test_pipeline, classes=class_names)) - -# For nuScenes dataset, we usually evaluate the model at the end of training. -# Since the models are trained by 24 epochs by default, we set evaluation -# interval to be 24. Please change the interval accordingly if you do not -# use a default schedule. - -optimizer = dict(type='AdamW', lr=1e-4, weight_decay=0.01) -# max_norm=10 is better for SECOND -optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) -lr_config = dict( - policy='cyclic', - target_ratio=(10, 1e-4), - cyclic_times=1, - step_ratio_up=0.4, -) -momentum_config = dict( - policy='cyclic', - target_ratio=(0.85 / 0.95, 1), - cyclic_times=1, - step_ratio_up=0.4, -) - -# runtime settings -total_epochs = 20