Skip to content

randlanet

RandLA-Net classification and segmentation models.

First page of RandLA-Net: Efficient Semantic Segmentation of Large-Scale Point Clouds

1911.11236 Β· November 2019

Classes:

Functions:

  • random_max_pool –

    Random sampling followed by a max-pool over the neighbors of each kept point.

RandLANetEncoder [source] ΒΆ

RandLANetEncoder(
    in_channels: int,
    encoder_channels: Sequence[int],
    decimation: Union[int, Sequence[int]] = 4,
    num_neighbors: Union[int, Sequence[int]] = 16,
    *,
    act: Union[str, Callable, None],
    act_kwargs: Optional[Dict[str, Any]] = None,
    act_first: bool = False,
    norm: Union[str, Callable, None],
    norm_kwargs: Optional[Dict[str, Any]] = None,
    bias: bool = False,
)

Bases: Module

Stack of RandLANetResidualBlock units interleaved with random-sampling K-NN max-pool decimation.

Each encoder block doubles its \(d_\text{out}^\text{config}\) to produce a \(2 \cdot d_\text{out}^\text{config}\) channel feature; the per-stage decimation ratio then sub-samples the cloud by that factor.

When return_intermediates=True is passed to forward, the encoder returns the bottleneck features plus the per-stage skip features in fine-to-coarse order: intermediates[0] is block 0's PRE-decimation output (used as the full-resolution skip in RandLANetDecoder); subsequent entries are the POST-decimation outputs of blocks \(0 \ldots N-2\). The decoder consumes them in reverse.

Parameters:

  • in_channels (int) –

    Number of input channels.

  • encoder_channels (Sequence[int]) –

    Output channels of each dilated residual block (must be even).

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

    Decimation factor between consecutive encoder blocks. Either a single int or a per-block sequence of length \(N\).

  • num_neighbors (Union[int, Sequence[int]], default: 16 ) –

    Number of neighbors for the K-NN graph in each block. Either a single int or a per-block sequence of length \(N\).

RandLANetDecoder [source] ΒΆ

RandLANetDecoder(
    in_channels: int,
    skip_channels: Sequence[int],
    fp_channels: Sequence[int],
    *,
    act: Union[str, Callable, None],
    act_kwargs: Optional[Dict[str, Any]] = None,
    act_first: bool = False,
    norm: Union[str, Callable, None],
    norm_kwargs: Optional[Dict[str, Any]] = None,
    bias: bool = False,
)

Bases: Module

Stack of PointNet2FeaturePropagation blocks specialized to RandLA-Net.

Each block does 1-NN upsampling from the deeper resolution to its pos_skip resolution, concatenates with the encoder skip features, then applies a single linear+norm+act projection. The first block consumes the bottleneck features and the deepest encoder skip; subsequent blocks each cut the resolution by a stage of decimation until the finest (full-resolution) skip is reached.

Parameters:

  • in_channels (int) –

    Channels at the bottleneck (input to the first FP).

  • skip_channels (Sequence[int]) –

    Per-stage encoder skip channels in coarse-to-fine order.

  • fp_channels (Sequence[int]) –

    Per-stage decoder output channels (same length as skip_channels).

  • act (Union[str, Callable, None]) –

    Activation passed to each PointNet2FeaturePropagation MLP.

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

    Activation kwargs.

  • act_first (bool, default: False ) –

    If True, activation is applied before normalization.

  • norm (Union[str, Callable, None]) –

    Normalization passed to each PointNet2FeaturePropagation MLP.

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

    Normalization kwargs.

  • bias (bool, default: False ) –

    Whether to use bias in the MLP layers.

Note

No paper-specific defaults are baked in here; callers (typically the registered model factory) supply them.

RandLANetClassification [source] ΒΆ

RandLANetClassification(
    in_channels: int,
    num_classes: int,
    *,
    stem_channels: Optional[int] = 8,
    encoder_channels: Sequence[int],
    decimation: Union[int, Sequence[int]] = 4,
    num_neighbors: Union[int, Sequence[int]] = 16,
    aggr_channels: Optional[
        Union[int, Sequence[int]]
    ] = None,
    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,
    bias: bool = False,
)

Bases: ClassificationModel

RandLA-Net classification model from RandLA-Net: Efficient Semantic Segmentation of Large-Scale Point Clouds by Qingyong Hu, Bo Yang, Linhai Xie, Stefano Rosa, Yulan Guo, Zhihua Wang, Niki Trigoni, Andrew Markham.

Random sampling for downsampling and dilated residual blocks with local feature aggregation; point features are pooled globally after the encoder for classification.

Parameters:

  • in_channels (int) –

    Number of input channels.

  • num_classes (int) –

    Number of classes.

  • stem_channels (Optional[int], default: 8 ) –

    Number of channels in the stem MLP. Set to None to skip the stem.

  • encoder_channels (Sequence[int]) –

    Output channels of each dilated residual block (must be even).

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

    Decimation factor between consecutive encoder blocks.

  • num_neighbors (Union[int, Sequence[int]], default: 16 ) –

    Number of neighbors for the kNN graph in each block.

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

    Optional channels for the aggregation MLP applied before global pooling.

  • dropout (float, default: 0.0 ) –

    Dropout rate before the classification head.

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

    Global pooling operation.

Methods:

  • configure_stem –

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

  • configure_encoder –

    Build the RandLANetEncoder backbone.

  • configure_aggr –

    Build the aggregation MLP applied to the encoder output, or None when aggr_channels is unset.

Attributes:

  • num_features (int) –

    Feature dimension \(C\) of the encoder output, after the optional aggregation MLP.

num_features property ΒΆ

num_features: int

Feature dimension \(C\) of the encoder output, after the optional aggregation MLP.

configure_stem [source] ΒΆ

configure_stem() -> Optional[MLP]

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

configure_encoder [source] ΒΆ

configure_encoder() -> RandLANetEncoder

Build the RandLANetEncoder backbone.

configure_aggr [source] ΒΆ

configure_aggr() -> Optional[MLP]

Build the aggregation MLP applied to the encoder output, or None when aggr_channels is unset.

RandLANetSegmentation [source] ΒΆ

RandLANetSegmentation(
    in_channels: int,
    num_classes: int,
    *,
    stem_channels: Optional[int] = 8,
    encoder_channels: Sequence[int],
    fp_channels: Sequence[int],
    head_channels: Sequence[int] = (64, 32),
    decimation: Union[int, Sequence[int]] = 4,
    num_neighbors: Union[int, Sequence[int]] = 16,
    aggr_channels: Optional[
        Union[int, Sequence[int]]
    ] = None,
    dropout: float = 0.5,
    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,
)

Bases: SemanticSegmentationModel

RandLA-Net segmentation model from RandLA-Net: Efficient Semantic Segmentation of Large-Scale Point Clouds by Qingyong Hu, Bo Yang, Linhai Xie, Stefano Rosa, Yulan Guo, Zhihua Wang, Niki Trigoni, Andrew Markham.

Encoder uses random sampling between dilated residual blocks; decoder uses 1-NN nearest-neighbor interpolation with concatenation skips and a single 1x1 linear+BN+act per stage. The skip used at full resolution is the pre-decimation output of the first encoder block.

Parameters:

  • in_channels (int) –

    Number of input channels.

  • num_classes (int) –

    Number of classes.

  • stem_channels (Optional[int], default: 8 ) –

    Number of channels in the stem MLP. Set to None to skip the stem.

  • encoder_channels (Sequence[int]) –

    Output channels of each dilated residual block (must be even).

  • fp_channels (Sequence[int]) –

    Per-stage decoder channels (one list per upsampling step).

  • head_channels (Sequence[int], default: (64, 32) ) –

    Hidden channels of the segmentation head MLP.

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

    Decimation factor between consecutive encoder blocks.

  • num_neighbors (Union[int, Sequence[int]], default: 16 ) –

    Number of neighbors for the kNN graph in each block.

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

    Channels for the bottleneck MLP between the encoder and the decoder (the upstream "decoder_0").

  • dropout (float, default: 0.5 ) –

    Dropout rate inside the segmentation head MLP.

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

    Activation type for both the decoder FP MLPs and the segmentation head MLP (string passed to create_act, or a Callable / nn.Module).

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

    Keyword arguments forwarded to the activation.

  • act_first (bool, default: False ) –

    If True, apply activation before normalization (PyG's MLP act_first semantics): Linear β†’ Act β†’ Norm β†’ Dropout instead of the default Linear β†’ Norm β†’ Act β†’ Dropout.

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

    Normalization type for the decoder FP MLPs and the head MLP.

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

    Keyword arguments forwarded to the normalization layers.

  • bias (bool, default: False ) –

    Whether the decoder/head hidden linear layers carry an explicit bias. The final head layer always uses bias=True since it has no normalization.

Methods:

  • configure_stem –

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

  • configure_encoder –

    Build the RandLANetEncoder backbone.

  • configure_aggr –

    Build the aggregation MLP applied to the encoder output, or None when aggr_channels is unset.

  • configure_decoder –

    Build the RandLANetDecoder upsampling the bottleneck 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 [source] ΒΆ

configure_stem() -> Optional[MLP]

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

configure_encoder [source] ΒΆ

configure_encoder() -> RandLANetEncoder

Build the RandLANetEncoder backbone.

configure_aggr [source] ΒΆ

configure_aggr() -> Optional[MLP]

Build the aggregation MLP applied to the encoder output, or None when aggr_channels is unset.

configure_decoder [source] ΒΆ

configure_decoder() -> RandLANetDecoder

Build the RandLANetDecoder upsampling the bottleneck features back through the encoder skips.

random_max_pool [source] ΒΆ

random_max_pool(
    x: Tensor,
    pos: Tensor,
    batch: Tensor,
    factor: int,
    num_neighbors: int,
) -> Tuple[Tensor, Tensor, Tensor]

Random sampling followed by a max-pool over the neighbors of each kept point.

Parameters:

  • x (Tensor) –

    Packed point features, shape \((N, C)\).

  • pos (Tensor) –

    Packed point positions, shape \((N, 3)\).

  • batch (Tensor) –

    Per-point batch index, shape \((N,)\).

  • factor (int) –

    Decimation factor, keeping \(N // \text{factor}\) points per cloud.

  • num_neighbors (int) –

    Number of neighbors gathered around each kept point.

Returns:

  • Tuple[Tensor, Tensor, Tensor] –

    The pooled features, positions and batch index of the kept points.