second
SECOND detection models.

Classes:
-
VoxelBackbone8xβSparse 3D convolutional voxel backbone (
VoxelBackBone8x), \(8\times\) downsampling. -
SECONDDetectionβSECOND 3D object detector (packed point format).
-
VoxelResBackbone8xβResidual sparse 3D voxel backbone (
VoxelResBackBone8x), \(8\times\) downsampling. -
SECONDMultiHeadDetectionβSECOND with a multi-group anchor head (nuScenes 10-class, packed point format).
VoxelBackbone8x [source] ΒΆ
VoxelBackbone8x(
in_channels: int,
*,
act: Union[str, Callable, None] = "relu",
act_kwargs: Optional[Dict[str, Any]] = None,
norm: Union[str, Callable, None] = "batch_norm",
norm_kwargs: Optional[Dict[str, Any]] = None,
)
Bases: Module
Sparse 3D convolutional voxel backbone (VoxelBackBone8x), \(8\times\) downsampling.
Four sparse conv stages downsample the voxel grid by \(2\times\) in \(x\)/\(y\) (stages 2-4) while a final \((3, 1, 1)\) sparse conv squeezes the height to 2, yielding a dense BEV tensor after height compression.
Parameters:
-
in_channels(int) βInput voxel feature channels (e.g. \(4\) for mean \(x, y, z, \text{intensity}\)).
-
act(Union[str, Callable, None], default:'relu') βActivation type or callable.
-
act_kwargs(Optional[Dict[str, Any]], default:None) βExtra activation arguments.
-
norm(Union[str, Callable, None], default:'batch_norm') βNormalization type or callable.
-
norm_kwargs(Optional[Dict[str, Any]], default:None) βExtra normalization arguments.
SECONDDetection [source] ΒΆ
SECONDDetection(
in_channels: int = 4,
num_classes: int = 3,
*,
voxel_size: Sequence[float] = (0.05, 0.05, 0.1),
point_cloud_range: Sequence[float] = (
0.0,
-40.0,
-3.0,
70.4,
40.0,
1.0,
),
anchor_sizes: Sequence[Sequence[float]],
anchor_bottom_heights: Sequence[float],
feature_map_stride: int,
anchor_rotations: Sequence[float] = (0.0, 1.57),
layer_nums: Sequence[int] = (5, 5),
layer_strides: Sequence[int] = (1, 2),
num_filters: Sequence[int] = (128, 256),
upsample_strides: Sequence[int] = (1, 2),
num_upsample_filters: Sequence[int] = (256, 256),
num_dir_bins: int = 2,
dir_offset: float = 0.78539,
dir_limit_offset: float = 0.0,
act: Union[str, Callable, None] = "relu",
act_kwargs: Optional[Dict[str, Any]] = None,
norm: Union[str, Callable, None] = "batch_norm",
norm_kwargs: Optional[Dict[str, Any]] = None,
)
Bases: DetectionModel
SECOND 3D object detector (packed point format).
Reference: SECOND: Sparsely Embedded Convolutional Detection (Yan et al., 2018). Reference implementation: open-mmlab/OpenPCDet.
Parameters:
-
in_channels(int, default:4) βRaw point feature channels including xyz (e.g. \(4\) for \(x, y, z, \text{intensity}\)).
-
num_classes(int, default:3) βNumber of foreground classes.
-
voxel_size(Sequence[float], default:(0.05, 0.05, 0.1)) βVoxel size \((v_x, v_y, v_z)\).
-
point_cloud_range(Sequence[float], default:(0.0, -40.0, -3.0, 70.4, 40.0, 1.0)) βRange \((x_\min, y_\min, z_\min, x_\max, y_\max, z_\max)\).
-
anchor_sizes(Sequence[Sequence[float]]) βPer-class box size \((d_x, d_y, d_z)\), one row per class.
-
anchor_bottom_heights(Sequence[float]) βPer-class anchor bottom \(z\), one per class.
-
anchor_rotations(Sequence[float], default:(0.0, 1.57)) βYaw angles (radians) shared by all classes.
-
feature_map_stride(int) βBEV feature-map stride of the head.
-
layer_nums(Sequence[int], default:(5, 5)) β2D backbone conv counts per level.
-
layer_strides(Sequence[int], default:(1, 2)) β2D backbone downsample strides per level.
-
num_filters(Sequence[int], default:(128, 256)) β2D backbone channel widths per level.
-
upsample_strides(Sequence[int], default:(1, 2)) β2D backbone upsample strides per level.
-
num_upsample_filters(Sequence[int], default:(256, 256)) β2D backbone upsample channels per level.
-
num_dir_bins(int, default:2) βNumber of direction bins in the head.
-
dir_offset(float, default:0.78539) βDirection-classifier angle offset.
-
dir_limit_offset(float, default:0.0) βHeading wrap offset used during decoding.
-
act(Union[str, Callable, None], default:'relu') βActivation type or callable for the 3D/2D backbones.
-
act_kwargs(Optional[Dict[str, Any]], default:None) βExtra activation arguments.
-
norm(Union[str, Callable, None], default:'batch_norm') βNormalization type or callable for the 3D/2D backbones.
-
norm_kwargs(Optional[Dict[str, Any]], default:None) βExtra normalization arguments.
Methods:
-
configure_backbone_3dβBuild the sparse 3D voxel backbone.
-
configure_backboneβBuild the 2D BEV backbone.
-
configure_headβBuild the single-group anchor head.
-
decodeβDecode a forward output into raw per-anchor detections (see
AnchorHead.decode). -
reset_classifierβReplace the classification branch of the detection head for
num_classesoutputs.
Attributes:
-
num_features(int) βChannel count \(C\) of the BEV feature map entering the head.
num_features property ΒΆ
Channel count \(C\) of the BEV feature map entering the head.
configure_backbone_3d [source] ΒΆ
configure_backbone_3d() -> VoxelBackbone8x
Build the sparse 3D voxel backbone.
decode [source] ΒΆ
decode(out: AnchorHeadOutput) -> Detection3D
Decode a forward output into raw per-anchor detections (see AnchorHead.decode).
VoxelResBackbone8x [source] ΒΆ
VoxelResBackbone8x(
in_channels: int,
*,
act: Union[str, Callable, None] = "relu",
act_kwargs: Optional[Dict[str, Any]] = None,
norm: Union[str, Callable, None] = "batch_norm",
norm_kwargs: Optional[Dict[str, Any]] = None,
)
Bases: Module
Residual sparse 3D voxel backbone (VoxelResBackBone8x), \(8\times\) downsampling.
Like VoxelBackbone8x but with SparseBasicBlock residual stages and a 128-channel stage 4 (used by the nuScenes SECOND multihead detector).
Parameters:
-
in_channels(int) βInput voxel feature channels (e.g. \(5\) for nuScenes).
-
act(Union[str, Callable, None], default:'relu') βActivation type or callable.
-
act_kwargs(Optional[Dict[str, Any]], default:None) βExtra activation arguments.
-
norm(Union[str, Callable, None], default:'batch_norm') βNormalization type or callable.
-
norm_kwargs(Optional[Dict[str, Any]], default:None) βExtra normalization arguments.
SECONDMultiHeadDetection [source] ΒΆ
SECONDMultiHeadDetection(
in_channels: int = 5,
num_classes: int = 10,
*,
voxel_size: Sequence[float] = (0.1, 0.1, 0.2),
point_cloud_range: Sequence[float] = (
-51.2,
-51.2,
-5.0,
51.2,
51.2,
3.0,
),
anchor_sizes: Sequence[Sequence[float]],
anchor_bottom_heights: Sequence[float],
head_class_groups: Sequence[Sequence[int]],
feature_map_stride: int,
anchor_rotations: Sequence[float] = (0.0, 1.57),
layer_nums: Sequence[int] = (5, 5),
layer_strides: Sequence[int] = (1, 2),
num_filters: Sequence[int] = (128, 256),
upsample_strides: Sequence[float] = (1, 2),
num_upsample_filters: Sequence[int] = (256, 256),
shared_conv_num_filter: int = 64,
act: Union[str, Callable, None] = "relu",
act_kwargs: Optional[Dict[str, Any]] = None,
norm: Union[str, Callable, None] = "batch_norm",
norm_kwargs: Optional[Dict[str, Any]] = None,
)
Bases: DetectionModel
SECOND with a multi-group anchor head (nuScenes 10-class, packed point format).
Reference implementation: open-mmlab/OpenPCDet (cbgs_second_multihead). A residual sparse 3D backbone (VoxelResBackbone8x) feeds the shared 2D BEV backbone and an MultiGroupAnchorHead head. Input points carry 5 features (\(x, y, z, \text{intensity}, \Delta t\)).
Parameters:
-
in_channels(int, default:5) βRaw point feature channels including xyz (5 for nuScenes).
-
num_classes(int, default:10) βNumber of foreground classes (10 for nuScenes).
-
voxel_size(Sequence[float], default:(0.1, 0.1, 0.2)) βVoxel size \((v_x, v_y, v_z)\).
-
point_cloud_range(Sequence[float], default:(-51.2, -51.2, -5.0, 51.2, 51.2, 3.0)) βRange \((x_\min, y_\min, z_\min, x_\max, y_\max, z_\max)\).
-
anchor_sizes(Sequence[Sequence[float]]) βPer-class box size \((d_x, d_y, d_z)\), one row per class.
-
anchor_bottom_heights(Sequence[float]) βPer-class anchor bottom \(z\), one per class.
-
head_class_groups(Sequence[Sequence[int]]) βClass-index groups, one per RPN head (e.g.
[[0], [1, 2], ...]). -
anchor_rotations(Sequence[float], default:(0.0, 1.57)) βYaw angles (radians) shared by all classes.
-
feature_map_stride(int) βBEV feature-map stride of the head.
-
layer_nums(Sequence[int], default:(5, 5)) β2D backbone conv counts per level.
-
layer_strides(Sequence[int], default:(1, 2)) β2D backbone downsample strides per level.
-
num_filters(Sequence[int], default:(128, 256)) β2D backbone channel widths per level.
-
upsample_strides(Sequence[float], default:(1, 2)) β2D backbone upsample factors per level.
-
num_upsample_filters(Sequence[int], default:(256, 256)) β2D backbone upsample channels per level.
-
shared_conv_num_filter(int, default:64) βChannels of the head's shared conv.
-
act(Union[str, Callable, None], default:'relu') βActivation type or callable for the 3D/2D backbones and head.
-
act_kwargs(Optional[Dict[str, Any]], default:None) βExtra activation arguments.
-
norm(Union[str, Callable, None], default:'batch_norm') βNormalization type or callable for the 3D/2D backbones and head.
-
norm_kwargs(Optional[Dict[str, Any]], default:None) βExtra normalization arguments.
Methods:
-
configure_backbone_3dβBuild the residual sparse 3D voxel backbone.
-
configure_backboneβBuild the 2D BEV backbone.
-
configure_headβBuild the multi-group anchor head.
-
decodeβDecode a forward output into raw per-anchor detections (see
MultiGroupAnchorHead.decode). -
reset_classifierβReplace the classification branch of the detection head for
num_classesoutputs.
Attributes:
-
num_features(int) βChannel count \(C\) of the BEV feature map entering the head.
num_features property ΒΆ
Channel count \(C\) of the BEV feature map entering the head.
configure_backbone_3d [source] ΒΆ
configure_backbone_3d() -> VoxelResBackbone8x
Build the residual sparse 3D voxel backbone.
configure_head [source] ΒΆ
configure_head() -> MultiGroupAnchorHead
Build the multi-group anchor head.
decode [source] ΒΆ
decode(out: AnchorHeadMultiOutput) -> Detection3D
Decode a forward output into raw per-anchor detections (see MultiGroupAnchorHead.decode).