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 [source] ΒΆ
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 [source] ΒΆ
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 [source] ΒΆ
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
SE3dblock. -
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.Nonedisables. -
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.Nonedisables. -
norm_kwargs(Optional[Dict[str, Any]], default:None) βExtra kwargs for the normalization.