Skip to content

PointNeXt

PointNeXt classification and segmentation models.

First page of PointNeXt: Revisiting PointNet++ with Improved Training and Scaling Strategies

2206.04670 · June 2022

Classes:

  • PointNeXtIntermediate –

    Input features and point cloud of one encoder block, recorded before it downsamples.

  • PointNeXtEncoderBlock –

    One encoder stage: an optional set-abstraction downsampling followed by depth inverted residual blocks.

  • PointNeXtEncoder –

    Stack of PointNeXtEncoderBlock stages, each preceded by a set-abstraction downsampling.

  • PointNeXtDecoder –

    The PointNeXt decoder, using the Feature Propagation (FP) module from the PointNet++ architecture.

  • PointNeXtPartDecoder –

    PointNeXt decoder for part segmentation (ShapeNetPart).

  • PointNeXtPartSegmentation –

    PointNeXt part segmentation model for ShapeNetPart.

  • PointNeXtClassification –

    PointNeXt classification model as described in the paper

  • PointNeXtSegmentation –

    PointNeXt segmentation model as described in the paper

PointNeXtIntermediate

Bases: NamedTuple

Input features and point cloud of one encoder block, recorded before it downsamples.

PointNeXtEncoderBlock

PointNeXtEncoderBlock(
    spatial_dim: int,
    channels: int,
    depth: int,
    expansion: int,
    radius: float,
    num_neighbors: int,
    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: Union[bool, List[bool]] = True,
    add_self_loops: bool = False,
    aggr: AggrType = "max",
    downsample: Optional[PointNeXtSetAbstraction] = None,
)

Bases: Module

One encoder stage: an optional set-abstraction downsampling followed by depth inverted residual blocks.

PointNeXtEncoder

PointNeXtEncoder(
    channels: Sequence[int],
    *,
    spatial_dim: int = 3,
    depths: Sequence[int],
    expansion: Union[int, Sequence[int]] = 4,
    ratios: Sequence[float],
    radiuses: Sequence[Union[float, Sequence[float]]],
    num_neighbors: Sequence[Union[int, Sequence[int]]],
    sa_layers: int = 1,
    sa_use_res: 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,
    bias: Union[bool, List[bool]] = True,
    add_self_loops: bool = False,
    aggr: AggrType = "max",
)

Bases: Module

Stack of PointNeXtEncoderBlock stages, each preceded by a set-abstraction downsampling.

When return_intermediates=True is passed to forward, the pre-downsampling features of every stage are returned in coarse-to-fine order, ready to be consumed as decoder skips.

Note

radiuses and num_neighbors hold one entry per channel: entry \(i\) configures the set-abstraction of block \(i\) and entry \(i+1\) its residual blocks.

Parameters:

  • channels (Sequence[int]) –

    Channels of the stem output followed by the output of each encoder block.

  • spatial_dim (int, default: 3 ) –

    Spatial dimension of the input point cloud.

  • depths (Sequence[int]) –

    Number of residual blocks in each encoder block.

  • expansion (Union[int, Sequence[int]], default: 4 ) –

    Bottleneck expansion factor of the residual blocks.

  • ratios (Sequence[float]) –

    Sampling ratio of the set-abstraction preceding each encoder block.

  • radiuses (Sequence[Union[float, Sequence[float]]]) –

    Ball-query radius for each channel level.

  • num_neighbors (Sequence[Union[int, Sequence[int]]]) –

    Maximum number of neighbors for each channel level.

  • sa_layers (int, default: 1 ) –

    Number of MLP layers inside each set-abstraction.

  • sa_use_res (bool, default: True ) –

    Whether the set-abstractions use a residual connection.

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

    Activation function to use for the encoder blocks.

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

    Keyword arguments for the activation function.

  • act_first (bool, default: False ) –

    Whether to apply the activation function before the normalization.

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

    Normalization function to use for the encoder blocks.

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

    Keyword arguments for the normalization function.

  • bias (Union[bool, List[bool]], default: True ) –

    Whether to use a bias for the encoder blocks.

  • add_self_loops (bool, default: False ) –

    Whether the neighborhood graphs include self-loops.

  • aggr (AggrType, default: 'max' ) –

    Aggregation used to pool neighbor features.

PointNeXtDecoder

PointNeXtDecoder(
    channels: Sequence[int],
    skip_channels: Sequence[int],
    depths: Sequence[int],
    *,
    spatial_dim: int = 3,
    dropout: float = 0.0,
    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: Union[bool, List[bool]] = True,
    plain_last: bool = True,
)

Bases: Module

The PointNeXt decoder, using the Feature Propagation (FP) module from the PointNet++ architecture.

Note

The number of channels should be equal to the number of decoder blocks + 1.

Parameters:

  • channels (Sequence[int]) –

    List of channels for each FP block. The first element should correspond to the last channel of the encoder.

  • skip_channels (Sequence[int]) –

    List of channels for the skip connections. This is usually the same as the first \(N-1\) channels of the encoder, in reverse order.

  • depths (Sequence[int]) –

    List of depths for each FP block.

  • spatial_dim (int, default: 3 ) –

    Spatial dimension of the input point cloud.

  • dropout (float, default: 0.0 ) –

    Dropout rate before the classification head.

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

    Activation function to use for the FP blocks.

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

    Keyword arguments for the activation function.

  • act_first (bool, default: False ) –

    Whether to apply the activation function before the normalization.

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

    Normalization function to use for the FP blocks.

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

    Keyword arguments for the normalization function.

  • bias (Union[bool, List[bool]], default: True ) –

    Whether to use a bias for the FP blocks.

PointNeXtPartDecoder

PointNeXtPartDecoder(
    channels: Sequence[int],
    skip_channels: Sequence[int],
    depths: Sequence[int],
    *,
    global_conv1_in: int,
    global_conv2_in: int,
    num_categories: int = 16,
    spatial_dim: int = 3,
    dropout: float = 0.0,
    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: Union[bool, List[bool]] = True,
    plain_last: bool = True,
)

Bases: Module

PointNeXt decoder for part segmentation (ShapeNetPart).

Uses the same FP block layout as PointNeXtDecoder, with two global feature convolutions and shape-category conditioning. At the shallowest decoder stage, the skip features are augmented with max-pooled global features from two encoder levels and a shape-category one-hot vector before the FP layer.

This matches the reference PointNextPartDecoder with cls_map='curvenet'.

Parameters:

  • channels (Sequence[int]) –

    List of channels for each FP block.

  • skip_channels (Sequence[int]) –

    List of channels for the skip connections.

  • depths (Sequence[int]) –

    List of depths for each FP block.

  • global_conv1_in (int) –

    Input channels for global_conv1 (typically encoder_channels[-2]).

  • global_conv2_in (int) –

    Input channels for global_conv2 (typically encoder_channels[-1]).

  • num_categories (int, default: 16 ) –

    Number of shape categories (16 for ShapeNetPart).

PointNeXtPartSegmentation

PointNeXtPartSegmentation(
    in_channels: int,
    num_classes: int,
    *,
    num_categories: int,
    stem_channels: Optional[
        Union[int, Sequence[int]]
    ] = None,
    stem_plain_last: bool = False,
    encoder_channels: Sequence[int],
    encoder_depths: Sequence[int],
    encoder_expansion: Union[int, Sequence[int]] = 4,
    sa_layers: int = 1,
    sa_use_res: bool = True,
    decoder_channels: Sequence[int],
    decoder_depths: Sequence[int],
    decoder_plain_last: bool = True,
    ratios: Sequence[float],
    radiuses: Sequence[Union[float, Sequence[float]]],
    num_neighbors: Sequence[Union[int, Sequence[int]]],
    add_self_loops: bool = False,
    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: Union[bool, List[bool]] = True,
    dropout: float = 0.0,
    head_channels: Optional[Sequence[int]] = None,
)

Bases: SegmentationModel

PointNeXt part segmentation model for ShapeNetPart.

Uses the same encoder as PointNeXtSegmentation but replaces the decoder with PointNeXtPartDecoder (global feature conditioning on shape category) and adds a head with global max+avg pooling.

Parameters:

  • in_channels (int) –

    Number of input feature channels.

  • num_classes (int) –

    Number of part classes (50 for ShapeNetPart).

  • num_categories (int) –

    Number of shape categories (16 for ShapeNetPart).

  • stem_channels (Optional[Union[int, Sequence[int]]], default: None ) –

    Stem MLP channel sizes.

  • encoder_channels (Sequence[int]) –

    Encoder channel dimensions per stage.

  • encoder_depths (Sequence[int]) –

    Residual block depths per encoder stage.

  • encoder_expansion (Union[int, Sequence[int]], default: 4 ) –

    InvResMLP expansion ratio.

  • sa_layers (int, default: 1 ) –

    Number of SA conv layers per block.

  • sa_use_res (bool, default: True ) –

    Whether SA blocks use residual connections.

  • decoder_channels (Sequence[int]) –

    Decoder channel dimensions per stage.

  • decoder_depths (Sequence[int]) –

    FP block depths per decoder stage.

  • ratios (Sequence[float]) –

    FPS downsampling ratios.

  • radiuses (Sequence[Union[float, Sequence[float]]]) –

    Ball-query radii.

  • num_neighbors (Sequence[Union[int, Sequence[int]]]) –

    Max neighbors per ball query.

Methods:

  • configure_stem –

    Build the stem MLP lifting the input features, or None when stem_channels is unset.

  • configure_encoder –

    Build the PointNeXtEncoder backbone.

  • configure_decoder –

    Build the PointNeXtPartDecoder upsampling the coarsest features back through the encoder skips.

Attributes:

  • num_features (int) –

    Channel count \(C\) entering the head: decoder features concatenated with their global max and mean pools.

num_features property

num_features: int

Channel count \(C\) entering the head: decoder features concatenated with their global max and mean pools.

configure_stem

configure_stem() -> Optional[Module]

Build the stem MLP lifting the input features, or None when stem_channels is unset.

configure_encoder

configure_encoder() -> PointNeXtEncoder

Build the PointNeXtEncoder backbone.

configure_decoder

configure_decoder() -> PointNeXtPartDecoder

Build the PointNeXtPartDecoder upsampling the coarsest features back through the encoder skips.

PointNeXtClassification

PointNeXtClassification(
    in_channels: int,
    num_classes: int,
    *,
    stem_channels: Optional[
        Union[int, Sequence[int]]
    ] = None,
    stem_plain_last: bool = False,
    encoder_channels: Sequence[int],
    encoder_depths: Sequence[int],
    encoder_expansion: Union[int, Sequence[int]] = 4,
    sa_layers: int = 1,
    sa_use_res: bool = True,
    ratios: Sequence[float],
    radiuses: Sequence[Union[float, Sequence[float]]],
    num_neighbors: Sequence[Union[int, Sequence[int]]],
    add_self_loops: bool = False,
    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: Union[bool, List[bool]] = True,
    dropout: float = 0.0,
    global_pool: PoolLike = "max",
    head_channels: Optional[Sequence[int]] = None,
    global_sa_channels: Optional[Sequence[int]] = None,
)

Bases: ClassificationModel

PointNeXt classification model as described in the paper PointNeXt: Revisiting PointNet++ with Improved Training and Scaling Strategies by Guocheng Qian, Yuchen Li, Houwen Peng, Jinjie Mai, Hasan Abed Al Kader Hammoud, Mohamed Elhoseiny, Bernard Ghanem.

PointNeXt modernizes PointNet++ through improved training strategies and architectural enhancements, achieving state-of-the-art performance while maintaining efficiency. The model introduces Inverted Residual MLP (InvResMLP) blocks, separable MLPs, and relative position normalization to enable effective model scaling.

Parameters:

  • in_channels (int) –

    Number of input channels (typically 3 for XYZ coordinates, or 6 for XYZ + RGB, or more with additional features like normal).

  • num_classes (int) –

    Number of output classes for classification.

  • stem_channels (Optional[Union[int, Sequence[int]]], default: None ) –

    Number of channels in the stem MLP layer(s) that map input to higher dimension. If None, no stem is used.

  • encoder_channels (Sequence[int]) –

    Channel dimensions for each encoder block. The number of channels should be equal to the number of blocks + 1.

  • encoder_depths (Sequence[int]) –

    Number of blocks in each encoder stage after the initial SA block.

  • encoder_expansion (Union[int, Sequence[int]], default: 4 ) –

    Expansion ratio to determine the hidden channels of the encoder blocks.

  • ratios (Sequence[float]) –

    Downsampling sampling ratios for each encoder stage. The number of ratios should be equal to the number of blocks.

  • radiuses (Sequence[Union[float, Sequence[float]]]) –

    Query radius for neighborhood grouping in each stage. The number of radiuses should be equal to the number of blocks + 1.

  • num_neighbors (Sequence[Union[int, Sequence[int]]]) –

    Maximum number of neighbors for each encoder stage. The number of num_neighbors should be equal to the number of blocks + 1.

  • add_self_loops (bool, default: False ) –

    Whether to include the center point as its own neighbor in grouping operations.

  • spatial_dim (int, default: 3 ) –

    Spatial dimensionality of point clouds (typically 3).

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

    Activation function.

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

    Additional arguments for the activation function.

  • act_first (bool, default: False ) –

    Whether to apply activation before normalization.

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

    Normalization layer type.

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

    Additional arguments for normalization layer.

  • bias (Union[bool, List[bool]], default: True ) –

    Whether to use bias in linear / MLP layers.

  • dropout (float, default: 0.0 ) –

    Dropout probability before the classification head.

  • global_pool (PoolLike, default: 'max' ) –

    Global pooling operation for final feature aggregation.

Methods:

  • configure_stem –

    Build the stem MLP lifting the input features, or None when stem_channels is unset.

  • configure_encoder –

    Build the PointNeXtEncoder backbone.

  • configure_global_sa –

    Build the global set-abstraction applied before pooling, or None when global_sa_channels is unset.

Attributes:

  • num_features (int) –

    Feature dimension \(C\) fed to the classification head, after the optional global set-abstraction.

num_features property

num_features: int

Feature dimension \(C\) fed to the classification head, after the optional global set-abstraction.

configure_stem

configure_stem() -> Optional[Module]

Build the stem MLP lifting the input features, or None when stem_channels is unset.

configure_encoder

configure_encoder() -> PointNeXtEncoder

Build the PointNeXtEncoder backbone.

configure_global_sa

configure_global_sa() -> Optional[PointNeXtSetAbstraction]

Build the global set-abstraction applied before pooling, or None when global_sa_channels is unset.

PointNeXtSegmentation

PointNeXtSegmentation(
    in_channels: int,
    num_classes: int,
    *,
    stem_channels: Optional[
        Union[int, Sequence[int]]
    ] = None,
    stem_plain_last: bool = False,
    encoder_channels: Sequence[int],
    encoder_depths: Sequence[int],
    encoder_expansion: Union[int, Sequence[int]] = 4,
    sa_layers: int = 1,
    sa_use_res: bool = True,
    decoder_channels: Sequence[int],
    decoder_depths: Sequence[int],
    decoder_plain_last: bool = True,
    ratios: Sequence[float],
    radiuses: Sequence[Union[float, Sequence[float]]],
    num_neighbors: Sequence[Union[int, Sequence[int]]],
    add_self_loops: bool = False,
    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: Union[bool, List[bool]] = True,
    dropout: float = 0.0,
    head_channels: Optional[Sequence[int]] = None,
)

Bases: SegmentationModel

PointNeXt segmentation model as described in the paper PointNeXt: Revisiting PointNet++ with Improved Training and Scaling Strategies by Guocheng Qian, Yuchen Li, Houwen Peng, Jinjie Mai, Hasan Abed Al Kader Hammoud, Mohamed Elhoseiny, Bernard Ghanem.

PointNeXt modernizes PointNet++ through improved training strategies and architectural enhancements, achieving state-of-the-art performance while maintaining efficiency. The model introduces Inverted Residual MLP (InvResMLP) blocks, separable MLPs, and relative position normalization to enable effective model scaling.

Parameters:

  • in_channels (int) –

    Number of input channels (typically 3 for XYZ coordinates, or 6 for XYZ + RGB, or more with additional features like normal).

  • num_classes (int) –

    Number of output classes for segmentation.

  • stem_channels (Optional[Union[int, Sequence[int]]], default: None ) –

    Number of channels in the stem MLP layer(s) that map input to higher dimension. If None, no stem is used.

  • encoder_channels (Sequence[int]) –

    Channel dimensions for each encoder block. The number of channels should be equal to the number of blocks + 1.

  • encoder_depths (Sequence[int]) –

    Number of layers in each encoder block after the initial SA block.

  • encoder_expansion (Union[int, Sequence[int]], default: 4 ) –

    Expansion ratio to determine the hidden channels of the encoder blocks.

  • decoder_channels (Sequence[int]) –

    Channel dimensions for each decoder block. The number of channels should be equal to the number of decoder blocks + 1.

  • decoder_depths (Sequence[int]) –

    Number of layers in each decoder stage.

  • ratios (Sequence[float]) –

    Downsampling sampling ratios for each encoder stage. The number of ratios should be equal to the number of blocks.

  • radiuses (Sequence[Union[float, Sequence[float]]]) –

    Query radius for neighborhood grouping in each stage. The number of radiuses should be equal to the number of blocks + 1.

  • num_neighbors (Sequence[Union[int, Sequence[int]]]) –

    Maximum number of neighbors for each encoder stage. The number of num_neighbors should be equal to the number of blocks + 1.

  • add_self_loops (bool, default: False ) –

    Whether to include the center point as its own neighbor in grouping operations.

  • spatial_dim (int, default: 3 ) –

    Spatial dimensionality of point clouds (typically 3).

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

    Activation function.

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

    Additional arguments for the activation function.

  • act_first (bool, default: False ) –

    Whether to apply activation before normalization.

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

    Normalization layer type.

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

    Additional arguments for normalization layer.

  • bias (Union[bool, List[bool]], default: True ) –

    Whether to use bias in linear / MLP layers.

  • dropout (float, default: 0.0 ) –

    Dropout probability before the classification head.

Methods:

  • configure_stem –

    Build the stem MLP lifting the input features, or None when stem_channels is unset.

  • configure_encoder –

    Build the PointNeXtEncoder backbone.

  • configure_decoder –

    Build the PointNeXtDecoder upsampling the coarsest features back through the encoder skips.

Attributes:

  • num_features (int) –

    Feature dimension \(C\) of the decoder output.

num_features property

num_features: int

Feature dimension \(C\) of the decoder output.

configure_stem

configure_stem() -> Optional[Module]

Build the stem MLP lifting the input features, or None when stem_channels is unset.

configure_encoder

configure_encoder() -> PointNeXtEncoder

Build the PointNeXtEncoder backbone.

configure_decoder

configure_decoder() -> PointNeXtDecoder

Build the PointNeXtDecoder upsampling the coarsest features back through the encoder skips.