centerpoint
Losses of the center-based detection heads, dense (CenterHead) and fully sparse (VoxelNeXtHead).
Both supervise the heatmap with gaussian_focal_loss and the gathered regression codes with a masked, code-weighted \(L_1\); the dense targets come from draw_heatmap_targets.
Classes:
-
CenterHeadLossβLoss of the dense
CenterHead(CenterPoint, Voxel Mamba). -
VoxelNeXtHeadLossβLoss of the fully sparse
VoxelNeXtHead.
CenterHeadLoss [source] ΒΆ
CenterHeadLoss(
num_classes: int,
*,
point_cloud_range: Sequence[float],
voxel_size: Sequence[float],
feature_map_stride: int,
code_weights: Sequence[float],
cls_weight: float = 1.0,
loc_weight: float = 0.25,
iou_weight: float = 0.0,
gaussian_overlap: float = 0.1,
min_radius: int = 2,
num_max_objs: int = 500,
)
Bases: Module
Loss of the dense CenterHead (CenterPoint, Voxel Mamba).
Reference: Center-based 3D Object Detection and Tracking (Yin et al., 2021).
Ground-truth boxes are splatted onto a per-class BEV Gaussian heatmap and their regression code (sub-cell center offset, \(z\), log extents and \((\cos\theta, \sin\theta)\)) is recorded at each peak cell. The heatmap is supervised by the penalty-reduced center focal loss and the regression maps by a masked, code-weighted \(L_1\) read back at those cells. When the head emits an iou map an optional \(L_1\) term regresses it toward the 3D IoU (rescaled to \([-1, 1]\)) between the decoded prediction and its matched box.
Parameters:
-
num_classes(int) βNumber of heatmap channels.
-
point_cloud_range(Sequence[float]) βRange \((x_\min, y_\min, z_\min, x_\max, y_\max, z_\max)\).
-
voxel_size(Sequence[float]) βVoxel size \((v_x, v_y, v_z)\).
-
feature_map_stride(int) βStride from the voxel grid to the BEV feature map.
-
code_weights(Sequence[float]) βPer-code regression weight, length \(8\) (the head predicts no velocity codes).
-
cls_weight(float, default:1.0) βMultiplier on the heatmap focal loss.
-
loc_weight(float, default:0.25) βMultiplier on the summed regression loss.
-
iou_weight(float, default:0.0) βMultiplier on the optional IoU-branch loss (\(0\) disables it).
-
gaussian_overlap(float, default:0.1) βMin-overlap passed to the Gaussian-radius solver.
-
min_radius(int, default:2) βLower clamp on the integer splat radius.
-
num_max_objs(int, default:500) βPer-scene object-target capacity.
Methods:
-
forwardβCompute the dense center loss and its terms.
forward [source] ΒΆ
forward(
output: CenterHeadOutput, data: Dict[str, Any]
) -> Dict[str, Tensor]
Compute the dense center loss and its terms.
Parameters:
-
output(CenterHeadOutput) βHead maps
heatmap\((B, C, H, W)\),center\((B, 2, H, W)\),center_z\((B, 1, H, W)\),dim\((B, 3, H, W)\),rot\((B, 2, H, W)\) and optionallyiou\((B, 1, H, W)\). -
data(Dict[str, Any]) βPacked GT (
DataKeys.BOX,DataKeys.LABEL,DataKeys.BATCH_BOX).
Returns:
-
Dict[str, Tensor]βA dict with the scalar
lossand detachedheatmap_loss,box_loss(andiou_losswhen enabled).
VoxelNeXtHeadLoss [source] ΒΆ
VoxelNeXtHeadLoss(
class_groups: Sequence[Sequence[int]],
*,
point_cloud_range: Sequence[float],
voxel_size: Sequence[float],
feature_map_stride: int,
code_weights: Sequence[float],
cls_weight: float = 1.0,
loc_weight: float = 0.25,
gaussian_overlap: float = 0.1,
min_radius: int = 2,
num_max_objs: int = 500,
)
Bases: Module
Loss of the fully sparse VoxelNeXtHead.
Reference: VoxelNeXt: Fully Sparse VoxelNet for 3D Object Detection and Tracking (Chen et al., 2023).
The head predicts CenterPoint-style attributes directly on the occupied BEV voxels rather than a dense map, so targets are drawn only at those voxels: the per-class heatmap is a Gaussian in squared voxel distance and each object's regression code is anchored to its nearest occupied voxel. The heatmap is supervised by the penalty-reduced center focal loss and the gathered regression rows by a masked, code-weighted \(L_1\). Classes are split into groups, one sparse head each.
Parameters:
-
class_groups(Sequence[Sequence[int]]) βZero-based global class-index groups, one per head (e.g.
[[0], [1, 2], ...]). -
point_cloud_range(Sequence[float]) βRange \((x_\min, y_\min, z_\min, x_\max, y_\max, z_\max)\).
-
voxel_size(Sequence[float]) βVoxel size \((v_x, v_y, v_z)\).
-
feature_map_stride(int) βStride from the voxel grid to the BEV feature map.
-
code_weights(Sequence[float]) βPer-code regression weight, length \(8 + \text{extra}\) (e.g. \(10\) with velocity).
-
cls_weight(float, default:1.0) βMultiplier on the heatmap focal loss.
-
loc_weight(float, default:0.25) βMultiplier on the summed regression loss.
-
gaussian_overlap(float, default:0.1) βMin-overlap passed to the Gaussian-radius solver.
-
min_radius(int, default:2) βLower clamp on the integer splat radius.
-
num_max_objs(int, default:500) βPer-scene object-target capacity.
Methods:
-
forwardβCompute the sparse center loss summed over class groups.
forward [source] ΒΆ
forward(
output: VoxelNeXtHeadOutput, data: Dict[str, Any]
) -> Dict[str, Tensor]
Compute the sparse center loss summed over class groups.
Parameters:
-
output(VoxelNeXtHeadOutput) βA
VoxelNeXtHeadOutput: per-group listshm\((V, n_g)\),center\((V, 2)\),center_z\((V, 1)\),dim\((V, 3)\),rot\((V, 2)\),vel\((V, 2)\) and sharedvoxel_indices\((V, 3)\) with columns \((\text{batch}, y, x)\). -
data(Dict[str, Any]) βPacked GT (
DataKeys.BOX,DataKeys.LABEL,DataKeys.BATCH_BOX).
Returns:
-
Dict[str, Tensor]βA dict with the scalar
lossand detachedheatmap_loss,box_loss.