Skip to content

pvcnn_blocks

PVCNN building blocks: voxelization, squeeze-and-excitation, and point-voxel convolution.

Classes:

  • Voxelization –

    Averages packed point features into a dense voxel grid.

  • SE3d –

    Squeeze-and-excitation gate for dense voxel grids.

  • PVConv –

    Point-voxel convolution: a dense 3D conv branch summed with a per-point MLP branch.

Voxelization

Voxelization(resolution: int, normalize: bool = True)

Bases: Module

Averages packed point features into a dense voxel grid.

Positions are centered per cloud and, when normalize is set, rescaled by the cloud's largest radius so every cloud fills the grid. The continuous grid coordinates are returned alongside the voxels, for trilinear devoxelization.

Shape

Input: \((N, C)\) features, \((N, 3)\) positions, \((N,)\) batch index Output: \((B, C, R, R, R)\) voxels, \((N, 3)\) grid coordinates

Parameters:

  • resolution (int) –

    Grid resolution \(R\) along each axis.

  • normalize (bool, default: True ) –

    Whether to rescale each cloud to the unit grid before voxelizing.

SE3d

SE3d(
    channels: int,
    reduction: int = 8,
    act: Union[str, Callable, None] = "relu",
    act_kwargs: Optional[Dict[str, Any]] = None,
)

Bases: Module

Squeeze-and-excitation gate for dense voxel grids.

Global-average-pools each channel, passes it through a bottleneck MLP, and rescales the grid by the resulting per-channel gate.

Shape

Input: \((B, C, R, R, R)\) Output: \((B, C, R, R, R)\)

Parameters:

  • channels (int) –

    Number of channels \(C\).

  • reduction (int, default: 8 ) –

    Bottleneck ratio of the squeeze layer.

  • act (Union[str, Callable, None], default: 'relu' ) –

    Activation between the squeeze and excitation layers, name resolved by create_act.

  • act_kwargs (Optional[Dict[str, Any]], default: None ) –

    Extra kwargs for the activation.

PVConv

PVConv(
    in_channels: int,
    out_channels: int,
    kernel_size: int,
    resolution: int,
    use_se: bool = False,
    normalize: bool = True,
    act: Union[str, Callable, None] = "relu",
    act_first: bool = False,
    act_kwargs: Optional[Dict[str, Any]] = None,
    norm: Union[str, Callable, None] = "batch_norm",
    norm_kwargs: Optional[Dict[str, Any]] = None,
)

Bases: Module

Point-voxel convolution: a dense 3D conv branch summed with a per-point MLP branch.

The voxel branch captures the neighborhood context at a coarse resolution and is devoxelized back with trilinear interpolation, while the point branch keeps the fine per-point detail.

Shape

Input: \((N, C_\text{in})\) features, \((N, 3)\) positions, \((N,)\) batch index Output: \((N, C_\text{out})\)

Parameters:

  • in_channels (int) –

    Input channel count.

  • out_channels (int) –

    Output channel count.

  • kernel_size (int) –

    Kernel size of the voxel convolutions.

  • resolution (int) –

    Voxel grid resolution \(R\) along each axis.

  • use_se (bool, default: False ) –

    Whether to gate the voxel branch with an SE3d block.

  • normalize (bool, default: True ) –

    Whether to rescale each cloud to the unit grid before voxelizing.

  • act (Union[str, Callable, None], default: 'relu' ) –

    Activation, name resolved by create_act. None disables.

  • act_first (bool, default: False ) –

    If True, run activation before normalization.

  • act_kwargs (Optional[Dict[str, Any]], default: None ) –

    Extra kwargs for the activation.

  • norm (Union[str, Callable, None], default: 'batch_norm' ) –

    Normalization, name resolved by create_norm. None disables.

  • norm_kwargs (Optional[Dict[str, Any]], default: None ) –

    Extra kwargs for the normalization.