PVCNN
PVCNN classification and segmentation models.

Classes:
-
PVConvBlock–Stack of
depthpoint-voxel convolutions, all at the same voxel resolution. -
PVCNNClassification–PVCNN classification model from
-
PVCNNSegmentation–PVCNN segmentation model from
Functions:
-
pvcnn_mit_han_lab_s3dis_area5–Paper-faithful PVCNN for S3DIS Area-5, from mit-han-lab/pvcnn.
PVConvBlock
¶
PVConvBlock(
in_channels: int,
out_channels: int,
depth: int,
kernel_size: int,
resolution: int,
use_se: bool = False,
normalize: bool = True,
act: Union[str, Callable, None] = "relu",
act_kwargs: Optional[Dict[str, Any]] = None,
act_first: bool = False,
norm: Union[str, Callable, None] = "batch_norm",
norm_kwargs: Optional[Dict[str, Any]] = None,
)
Bases: Module
Stack of depth point-voxel convolutions, all at the same voxel resolution.
A resolution of \(0\) or None disables voxelization and falls back to per-point MLP layers.
PVCNNClassification
¶
PVCNNClassification(
in_channels: int,
num_classes: int,
*,
channels: Sequence[int],
global_channels: Optional[Sequence[int]] = None,
depths: Sequence[int],
kernel_sizes: Sequence[int],
resolutions: Sequence[int],
use_se: bool = False,
normalize: bool = True,
dropout: float = 0.0,
global_pool: PoolLike = "max",
act: Union[str, Callable, None] = "relu",
act_kwargs: Optional[Dict[str, Any]] = None,
act_first: bool = False,
norm: Union[str, Callable, None] = "batch_norm",
norm_kwargs: Optional[Dict[str, Any]] = None,
)
Bases: ClassificationModel
PVCNN classification model from Point-Voxel CNN for Efficient 3D Deep Learning by Zhijian Liu, Haotian Tang, Yujun Lin, Song Han.
A flat stack of point-voxel conv blocks at decreasing voxel resolutions, followed by global pooling, an optional global MLP and a linear head.
Parameters:
-
in_channels(int) –Number of input feature channels.
-
num_classes(int) –Number of output classes. \(0\) replaces the head with
nn.Identity. -
channels(Sequence[int]) –Output feature width of each block.
-
global_channels(Optional[Sequence[int]], default:None) –MLP channels applied to the pooled feature.
Noneskips the global MLP. -
depths(Sequence[int]) –Number of point-voxel conv layers per block.
-
kernel_sizes(Sequence[int]) –Voxel conv kernel size per block.
-
resolutions(Sequence[int]) –Voxel grid resolution per block; \(0\) or
Noneuses MLP layers instead. -
use_se(bool, default:False) –Add a squeeze-and-excitation gate to every voxel branch.
-
normalize(bool, default:True) –Normalize coordinates into the unit voxel grid before voxelization.
-
dropout(float, default:0.0) –Dropout applied to the pooled features before the head.
-
global_pool(PoolLike, default:'max') –Global pooling reducing the point features to one vector per cloud.
-
act(Union[str, Callable, None], default:'relu') –Activation function.
-
act_kwargs(Optional[Dict[str, Any]], default:None) –Keyword arguments for the activation function.
-
act_first(bool, default:False) –Apply the activation before the normalization.
-
norm(Union[str, Callable, None], default:'batch_norm') –Normalization function.
-
norm_kwargs(Optional[Dict[str, Any]], default:None) –Keyword arguments for the normalization function.
Methods:
-
configure_blocks–Builds the point-voxel conv blocks, one per entry of
depths. -
configure_global_mlp–Builds the MLP applied to the pooled global feature, or
Nonewhenglobal_channelsis empty.
Attributes:
-
num_features(int) –Channel count \(C\) of the pooled features entering the head.
PVCNNSegmentation
¶
PVCNNSegmentation(
in_channels: int,
num_classes: int,
*,
channels: Sequence[int],
global_channels: Optional[Sequence[int]] = None,
depths: Sequence[int],
kernel_sizes: Sequence[int],
resolutions: Sequence[int],
spatial_dim: int = 3,
use_se: bool = False,
normalize: bool = True,
dropout: float = 0.0,
global_pool: PoolLike = "max",
act: Union[str, Callable, None] = "relu",
act_kwargs: Optional[Dict[str, Any]] = None,
act_first: bool = False,
norm: Union[str, Callable, None] = "batch_norm",
norm_kwargs: Optional[Dict[str, Any]] = None,
head_channels: Optional[Sequence[int]] = None,
head_dropout: float = 0.0,
)
Bases: SegmentationModel
PVCNN segmentation model from Point-Voxel CNN for Efficient 3D Deep Learning by Zhijian Liu, Haotian Tang, Yujun Lin, Song Han.
The same flat stack of point-voxel conv blocks as PVCNNClassification, but every layer output is
kept at full point resolution and concatenated with the broadcast global feature, so no decoder is
needed to recover per-point logits.
Parameters:
-
in_channels(int) –Number of input feature channels. Raised to
spatial_dimwhen smaller. -
num_classes(int) –Number of output classes. \(0\) replaces the head with
nn.Identity. -
channels(Sequence[int]) –Output feature width of each block.
-
global_channels(Optional[Sequence[int]], default:None) –MLP channels applied to the pooled feature.
Noneskips the global MLP. -
depths(Sequence[int]) –Number of point-voxel conv layers per block.
-
kernel_sizes(Sequence[int]) –Voxel conv kernel size per block.
-
resolutions(Sequence[int]) –Voxel grid resolution per block; \(0\) or
Noneuses MLP layers instead. -
spatial_dim(int, default:3) –Spatial dimensionality of the point clouds.
-
use_se(bool, default:False) –Add a squeeze-and-excitation gate to every voxel branch.
-
normalize(bool, default:True) –Normalize coordinates into the unit voxel grid before voxelization.
-
dropout(float, default:0.0) –Dropout applied to the concatenated point features before the head.
-
global_pool(PoolLike, default:'max') –Global pooling producing the cloud-level feature that is broadcast back to the points.
-
act(Union[str, Callable, None], default:'relu') –Activation function.
-
act_kwargs(Optional[Dict[str, Any]], default:None) –Keyword arguments for the activation function.
-
act_first(bool, default:False) –Apply the activation before the normalization.
-
norm(Union[str, Callable, None], default:'batch_norm') –Normalization function.
-
norm_kwargs(Optional[Dict[str, Any]], default:None) –Keyword arguments for the normalization function.
-
head_channels(Optional[Sequence[int]], default:None) –Hidden MLP channels of the head.
Noneuses a single linear layer. -
head_dropout(float, default:0.0) –Dropout between the hidden head layers.
Methods:
-
configure_blocks–Builds the point-voxel conv blocks, one per entry of
depths. -
configure_global_mlp–Builds the MLP applied to the pooled global feature, or
Nonewhenglobal_channelsis empty.
Attributes:
-
num_features(int) –Channel count \(C\) entering the head: every layer output concatenated with the global feature.
num_features
property
¶
Channel count \(C\) entering the head: every layer output concatenated with the global feature.
configure_blocks
¶
Builds the point-voxel conv blocks, one per entry of depths.
configure_global_mlp
¶
Builds the MLP applied to the pooled global feature, or None when global_channels is empty.
pvcnn_mit_han_lab_s3dis_area5
¶
pvcnn_mit_han_lab_s3dis_area5(
**hparams: Any,
) -> PVCNNSegmentation
Paper-faithful PVCNN for S3DIS Area-5, from mit-han-lab/pvcnn.
The generic PVCNNSegmentation uses act="relu" and nn.BatchNorm3d defaults for
both branches. Upstream's reference implementation splits them: the voxel branch
uses LeakyReLU(0.1) and nn.BatchNorm3d with \(\epsilon=10^{-4}\), while the point branch keeps ReLU.