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
PVConvBlock [source] ΒΆ
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 [source] ΒΆ
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 [source] ΒΆ
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: SemanticSegmentationModel
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.