randlanet
RandLA-Net classification and segmentation models.

Classes:
-
RandLANetEncoderβStack of
RandLANetResidualBlockunits interleaved with random-sampling -
RandLANetDecoderβStack of
PointNet2FeaturePropagationblocks specialized to RandLA-Net. -
RandLANetClassificationβRandLA-Net classification model from
-
RandLANetSegmentationβRandLA-Net segmentation model from
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
intor 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
intor 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
PointNet2FeaturePropagationMLP. -
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
PointNet2FeaturePropagationMLP. -
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
Noneto 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, orNonewhenstem_channelsis unset. -
configure_encoderβBuild the
RandLANetEncoderbackbone. -
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_stem [source] ΒΆ
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.
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
Noneto 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 aCallable/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 MLPact_firstsemantics):Linear β Act β Norm β Dropoutinstead of the defaultLinear β 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=Truesince it has no normalization.
Methods:
-
configure_stemβBuild the stem lifting the input features to
stem_channels, orNonewhenstem_channelsis unset. -
configure_encoderβBuild the
RandLANetEncoderbackbone. -
configure_aggrβBuild the aggregation MLP applied to the encoder output, or
Nonewhenaggr_channelsis unset. -
configure_decoderβBuild the
RandLANetDecoderupsampling the bottleneck features back through the encoder skips.
Attributes:
-
num_features(int) βFeature dimension \(C\) of the decoder output.
configure_stem [source] ΒΆ
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] ΒΆ
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.