randlanet_blocks
RandLA-Net local feature aggregation: spatial encoding, attentive pooling, and the dilated residual block.
Classes:
-
LocalSpatialEncodingβPer-edge spatial encoding MLP.
-
AttentivePoolingβAttention-weighted aggregation of neighbor features.
-
LocalFeatureAggregationβLocal feature aggregation: two rounds of spatial encoding and attentive pooling.
-
RandLANetResidualBlockβRandLA-Net dilated residual block.
LocalSpatialEncoding [source] ΒΆ
LocalSpatialEncoding(
in_channels: int,
out_channels: 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
Per-edge spatial encoding MLP.
Wraps a single Linear+norm+act block that lifts an input feature to out_channels. Used twice per LocalFeatureAggregation: first on the raw 10-channel relative positional encoding, then on its output.
AttentivePooling [source] ΒΆ
AttentivePooling(
in_channels: int,
out_channels: 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,
**kwargs: Unpack[MessagePassingParams],
)
Bases: MessagePassing
Attention-weighted aggregation of neighbor features.
Each edge concatenates its source feature with a per-edge spatial encoding, scores the result with a no-bias linear layer, softmax-normalizes the scores over the neighbors of each target point, sums the score-weighted features per target, then projects them with a Linear+norm+act block.
edge_index lists [source, target] pairs and edge_attr holds the \((E, C_\text{pos})\) spatial encoding of each edge.
Parameters:
-
in_channels(int) βChannels of each edge feature, the source feature and the spatial encoding concatenated.
-
out_channels(int) βOutput channels after the post-aggregation MLP.
-
**kwargs(Unpack[MessagePassingParams], default:{}) βExtra arguments for
MessagePassing.
LocalFeatureAggregation [source] ΒΆ
LocalFeatureAggregation(
d_out: 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
Local feature aggregation: two rounds of spatial encoding and attentive pooling.
Each round grows the receptive field, taking a per-point feature of width \(d_\text{out} / 2\) to \(d_\text{out}\). The 10-channel relative positional encoding keeps the channel order of QingyongHu/RandLA-Net (cat([rel_dist, rel_xyz, xyz_i, xyz_j], dim=-1)) so pretrained weights load without permuting the first kernel, and the second encoding re-projects the output of the first.
RandLANetResidualBlock [source] ΒΆ
RandLANetResidualBlock(
d_in: int,
d_out: int,
num_neighbors: 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
RandLA-Net dilated residual block.
Maps d_in channels to \(2 \cdot d_\text{out}\) via a residual path of MLP -> LocalFeatureAggregation -> MLP plus a parallel Linear+norm shortcut. mlp2 and shortcut carry no activation; the configured activation is applied once after the residual sum.
Parameters:
-
d_in(int) βNumber of input channels.
-
d_out(int) β"Configuration" channel count; the block actually outputs \(2 \cdot d_\text{out}\).
-
num_neighbors(int) βNumber of neighbors for the local feature aggregation.