pointnet2
PointNet++ classification and segmentation models.

Classes:
-
PointNet2EncoderβPointNet++ encoder from the paper
-
PointNet2DecoderβPointNet++ decoder (feature propagation) from the paper
-
PointNet2ClassificationβPointNet++ classification model from the paper
-
PointNet2SegmentationβPointNet++ segmentation model from the paper
PointNet2Encoder [source] ΒΆ
PointNet2Encoder(
in_channels: int,
sa_channels: Sequence[
Sequence[Union[int, Sequence[int]]]
],
*,
ratios: Optional[Sequence[float]] = None,
num_points: Optional[Sequence[int]] = None,
radii: Sequence[Union[float, Sequence[float]]],
num_neighbors: Sequence[Union[int, Sequence[int]]],
stem_channels: Optional[int] = None,
spatial_dim: int = 3,
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,
bias: bool = False,
use_pos: bool = True,
normalize_pos: bool = True,
pos_first: bool = False,
aggr: AggrType = "max",
sort_neighbors: bool = False,
)
Bases: Module
PointNet++ encoder from the paper PointNet++: Deep Hierarchical Feature Learning on Point Sets in a Metric Space by Charles R. Qi, Li Yi, Hao Su, Leonidas J. Guibas.
Processes raw point clouds through an optional linear stem followed by multiple Set Abstraction (SA) blocks that progressively downsample the points while learning local features using radius-based grouping. Each SA block can optionally use Multi-Scale Grouping (MSG).
Parameters:
-
in_channels(int) βNumber of input channels (features per point).
-
sa_channels(Sequence[Sequence[Union[int, Sequence[int]]]]) βList of channel configurations for Set Abstraction (SA) blocks. Each element defines the MLP channels for one SA block. For Multi-Scale Grouping (MSG), provide nested lists of channels.
-
ratios(Optional[Sequence[float]], default:None) βSampling ratios for each SA block (between 0 and 1). Mutually exclusive with
num_points. -
num_points(Optional[Sequence[int]], default:None) βAbsolute number of sampled centroids for each SA block (e.g. PointRCNN's fixed \(4096, 1024, \ldots\)). Exactly one of
ratios/num_pointsmust be given. -
radii(Sequence[Union[float, Sequence[float]]]) βSearch radiuses for each SA block's neighborhood. For MSG, provide a list of radii per block.
-
num_neighbors(Sequence[Union[int, Sequence[int]]]) βMax number of neighbors for each SA block. For MSG, provide a list of neighbor counts per block.
-
stem_channels(Optional[int], default:None) βOptional number of channels for initial linear projection.
-
spatial_dim(int, default:3) βSpatial dimensionality of point coordinates (e.g. 3 for 3D, 2 for 2D).
-
act(Union[str, Callable, None], default:'relu') βActivation function type or callable.
-
act_kwargs(Optional[Dict[str, Any]], default:None) βAdditional keyword arguments for the activation function.
-
act_first(bool, default:False) βIf
True, activation is applied before normalization. -
norm(Union[str, Callable, None], default:'batch_norm') βNormalization layer type or callable.
-
norm_kwargs(Optional[Dict[str, Any]], default:None) βAdditional keyword arguments for the normalization layer.
-
bias(bool, default:False) βWhether to use bias in linear layers.
-
use_pos(bool, default:True) βWhether to concatenate per-point relative positions to
x. -
pos_first(bool, default:False) βConcatenate the relative positions before the grouped features (see
PointNet2SetAbstraction). -
aggr(AggrType, default:'max') βAggregation of the grouped features in each SA block.
Attributes:
-
out_channels(int) βOutput channels of the last SA block.
-
skip_channels(List[int]) βSkip-connection channel sizes (stem output + each SA output except the last), ordered
PointNet2Decoder [source] ΒΆ
PointNet2Decoder(
in_channels: int,
skip_channels: Sequence[int],
fp_channels: Sequence[Sequence[int]],
*,
spatial_dim: int = 3,
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,
bias: bool = False,
k: Optional[Union[int, Sequence[int]]] = None,
weighting: Literal["squared", "inverse"] = "squared",
eps: float = 1e-16,
)
Bases: Module
PointNet++ decoder (feature propagation) from the paper PointNet++: Deep Hierarchical Feature Learning on Point Sets in a Metric Space by Charles R. Qi, Li Yi, Hao Su, Leonidas J. Guibas.
Upsamples features from the encoder back to the original resolution using kNN interpolation and skip connections from encoder intermediates.
Parameters:
-
in_channels(int) βNumber of input channels from the encoder (or aggregation) output.
-
skip_channels(Sequence[int]) βChannel sizes for skip connections at each level, ordered from coarsest to finest resolution.
-
fp_channels(Sequence[Sequence[int]]) βList of channel configurations for Feature Propagation (FP) blocks. Each element defines the MLP channels for one FP block.
-
spatial_dim(int, default:3) βSpatial dimensionality of point coordinates. Also used as the default number of neighbors
kfor kNN interpolation in all but the first FP block. -
act(Union[str, Callable, None], default:'relu') βActivation function type or callable.
-
act_kwargs(Optional[Dict[str, Any]], default:None) βAdditional keyword arguments for the activation function.
-
act_first(bool, default:False) βIf
True, activation is applied before normalization. -
norm(Union[str, Callable, None], default:'batch_norm') βNormalization layer type or callable.
-
norm_kwargs(Optional[Dict[str, Any]], default:None) βAdditional keyword arguments for the normalization layer.
-
bias(bool, default:False) βWhether to use bias in linear layers.
-
k(Optional[Union[int, Sequence[int]]], default:None) βNumber of neighbors for kNN interpolation, per FP block when a sequence. Defaults to
1for the first (deepest) block andspatial_dimfor the remaining blocks.
PointNet2Classification [source] ΒΆ
PointNet2Classification(
in_channels: int,
num_classes: int,
*,
stem_channels: Optional[int] = None,
sa_channels: Sequence[
Sequence[Union[int, Sequence[int]]]
],
aggr_channels: Optional[
Union[int, Sequence[int]]
] = None,
aggr_use_pos: bool = False,
head_channels: Optional[
Union[int, Sequence[int]]
] = None,
ratios: Sequence[float],
radii: Sequence[Union[float, Sequence[float]]],
num_neighbors: Sequence[Union[int, Sequence[int]]],
spatial_dim: int = 3,
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,
bias: bool = False,
use_pos: bool = True,
normalize_pos: bool = True,
sa_aggr: AggrType = "max",
dropout: Union[float, Sequence[float]] = 0.0,
global_pool: PoolLike = "max",
)
Bases: ClassificationModel
PointNet++ classification model from the paper PointNet++: Deep Hierarchical Feature Learning on Point Sets in a Metric Space by Charles R. Qi, Li Yi, Hao Su, Leonidas J. Guibas.
This network is a hierarchical point cloud classification model. It processes raw point clouds through a PointNet2Encoder (optional stem + SA blocks), an optional aggregation MLP, global pooling, and a classification head.
Parameters:
-
in_channels(int) βNumber of input channels (features per point).
-
num_classes(int) βNumber of output classes.
-
stem_channels(Optional[int], default:None) βOptional number of channels for initial linear projection (inside the encoder).
-
sa_channels(Sequence[Sequence[Union[int, Sequence[int]]]]) βList of channel configurations for Set Abstraction (SA) blocks. Each element defines the MLP channels for one SA block. For Multi-Scale Grouping (MSG), provide nested lists of channels.
-
aggr_channels(Optional[Union[int, Sequence[int]]], default:None) βChannel sizes for the post-encoder aggregation MLP.
-
ratios(Sequence[float]) βSampling ratios for each SA block (between 0 and 1).
-
radii(Sequence[Union[float, Sequence[float]]]) βSearch radiuses for each SA block's neighborhood. For MSG, provide a list of radii per block.
-
num_neighbors(Sequence[Union[int, Sequence[int]]]) βMax number of neighbors for each SA block. For MSG, provide a list of neighbor counts per block.
-
spatial_dim(int, default:3) βSpatial dimensionality of point coordinates (e.g. 3 for 3D, 2 for 2D).
-
act(Union[str, Callable, None], default:'relu') βActivation function type or callable.
-
act_kwargs(Optional[Dict[str, Any]], default:None) βAdditional keyword arguments for the activation function.
-
act_first(bool, default:False) βIf
True, activation is applied before normalization. -
norm(Union[str, Callable, None], default:'batch_norm') βNormalization layer type or callable.
-
norm_kwargs(Optional[Dict[str, Any]], default:None) βAdditional keyword arguments for the normalization layer.
-
bias(bool, default:False) βWhether to use bias in linear layers.
-
use_pos(bool, default:True) βWhether to concatenate per-point relative positions to
x. -
sa_aggr(AggrType, default:'max') βAggregation of the grouped features in each SA block.
-
dropout(Union[float, Sequence[float]], default:0.0) βDropout for the classification head: a single rate shared by every hidden layer, or one rate per hidden layer.
-
global_pool(PoolLike, default:'max') βGlobal pooling operation.
Methods:
-
configure_encoderβBuild the
PointNet2Encoderbackbone. -
configure_aggrβBuild the aggregation MLP applied to the encoder output, or
Nonewhenaggr_channelsis unset.
Attributes:
-
num_features(int) βFeature dimension \(C\) of the encoder output, after the optional aggregation MLP.
num_features property ΒΆ
Feature dimension \(C\) of the encoder output, after the optional aggregation MLP.
configure_encoder [source] ΒΆ
configure_encoder() -> PointNet2Encoder
Build the PointNet2Encoder backbone.
PointNet2Segmentation [source] ΒΆ
PointNet2Segmentation(
in_channels: int,
num_classes: int,
*,
stem_channels: Optional[int] = None,
sa_channels: Sequence[
Sequence[Union[int, Sequence[int]]]
],
aggr_channels: Optional[
Union[int, Sequence[int]]
] = None,
fp_channels: Sequence[Sequence[int]],
head_channels: Optional[
Union[int, Sequence[int]]
] = None,
ratios: Sequence[float],
radii: Sequence[Union[float, Sequence[float]]],
num_neighbors: Sequence[Union[int, Sequence[int]]],
spatial_dim: int = 3,
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,
bias: bool = False,
use_pos: bool = True,
normalize_pos: bool = True,
sa_aggr: AggrType = "max",
dropout: float = 0.0,
skip_input: bool = True,
fp_k: Optional[Union[int, Sequence[int]]] = None,
)
Bases: SemanticSegmentationModel
PointNet++ segmentation model from the paper PointNet++: Deep Hierarchical Feature Learning on Point Sets in a Metric Space by Charles R. Qi, Li Yi, Hao Su, Leonidas J. Guibas.
This network is a hierarchical point cloud segmentation model built from a PointNet2Encoder (optional stem + SA blocks), an optional aggregation MLP, a PointNet2Decoder (FP blocks with skip connections), and a per-point classification head.
Parameters:
-
in_channels(int) βNumber of input channels (features per point).
-
num_classes(int) βNumber of output classes.
-
stem_channels(Optional[int], default:None) βOptional number of channels for initial linear projection (inside the encoder).
-
sa_channels(Sequence[Sequence[Union[int, Sequence[int]]]]) βList of channel configurations for Set Abstraction (SA) blocks. Each element defines the MLP channels for one SA block. For Multi-Scale Grouping (MSG), provide nested lists of channels.
-
aggr_channels(Optional[Union[int, Sequence[int]]], default:None) βChannel sizes for the post-encoder aggregation MLP.
-
fp_channels(Sequence[Sequence[int]]) βList of channel configurations for Feature Propagation (FP) blocks. Each element defines the MLP channels for one FP block.
-
ratios(Sequence[float]) βSampling ratios for each SA block (between 0 and 1).
-
radii(Sequence[Union[float, Sequence[float]]]) βSearch radiuses for each SA block's neighborhood. For MSG, provide a list of radii per block.
-
num_neighbors(Sequence[Union[int, Sequence[int]]]) βMax number of neighbors for each SA block. For MSG, provide a list of neighbor counts per block.
-
spatial_dim(int, default:3) βSpatial dimensionality of point coordinates (e.g. 3 for 3D, 2 for 2D).
-
act(Union[str, Callable, None], default:'relu') βActivation function type or callable.
-
act_kwargs(Optional[Dict[str, Any]], default:None) βAdditional keyword arguments for the activation function.
-
act_first(bool, default:False) βIf
True, activation is applied before normalization. -
norm(Union[str, Callable, None], default:'batch_norm') βNormalization layer type or callable.
-
norm_kwargs(Optional[Dict[str, Any]], default:None) βAdditional keyword arguments for the normalization layer.
-
bias(bool, default:False) βWhether to use bias in linear layers.
-
use_pos(bool, default:True) βWhether to concatenate per-point relative positions to
x. -
sa_aggr(AggrType, default:'max') βAggregation of the grouped features in each SA block.
-
dropout(float, default:0.0) βDropout rate for classification head.
Methods:
-
configure_encoderβBuild the
PointNet2Encoderbackbone. -
configure_aggrβBuild the aggregation MLP applied to the encoder output, or
Nonewhenaggr_channelsis unset. -
configure_decoderβBuild the
PointNet2Decoderupsampling the coarsest features back through the encoder skips.
Attributes:
-
num_features(int) βFeature dimension \(C\) of the decoder output.
configure_encoder [source] ΒΆ
configure_encoder() -> PointNet2Encoder
Build the PointNet2Encoder backbone.
configure_aggr [source] ΒΆ
Build the aggregation MLP applied to the encoder output, or None when aggr_channels is unset.
configure_decoder [source] ΒΆ
configure_decoder() -> PointNet2Decoder
Build the PointNet2Decoder upsampling the coarsest features back through the encoder skips.