cloudViewer.ml.torch.models.RandLANet#
- class cloudViewer.ml.torch.models.RandLANet(name='RandLANet', k_n=16, num_layers=4, num_points=45056, num_classes=19, ignored_label_inds=[0], sub_sampling_ratio=[4, 4, 4, 4], dim_input=3, dim_feature=8, dim_output=[16, 64, 128, 256], grid_size=0.06, batcher='DefaultBatcher', ckpt_path=None, weight_decay=0.0, **kwargs)[source]#
Class defining RandLANet.
A model for Semantic Segmentation.
- __init__(name='RandLANet', k_n=16, num_layers=4, num_points=45056, num_classes=19, ignored_label_inds=[0], sub_sampling_ratio=[4, 4, 4, 4], dim_input=3, dim_feature=8, dim_output=[16, 64, 128, 256], grid_size=0.06, batcher='DefaultBatcher', ckpt_path=None, weight_decay=0.0, **kwargs)[source]#
Initialize.
- forward(inputs)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- get_loss(Loss, results, inputs, device)[source]#
Runs the loss on outputs of the model.
- Parameters:
outputs – logits
labels – labels
- Returns:
loss
- get_optimizer(cfg_pipeline)[source]#
Returns an optimizer object for the model.
- Parameters:
cfg_pipeline – A Config object with the configuration of the pipeline.
- Returns:
Returns a new optimizer object.
- inference_begin(data)[source]#
Function called right before running inference.
- Parameters:
data – A data from the dataset.
- inference_end(inputs, results)[source]#
This function is called after the inference.
This function can be implemented to apply post-processing on the network outputs.
- Parameters:
results – The model outputs as returned by the call() function. Post-processing is applied on this object.
- Returns:
Returns True if the inference is complete and otherwise False. Returning False can be used to implement inference for large point clouds which require multiple passes.
- inference_preprocess()[source]#
This function prepares the inputs for the model.
- Returns:
The inputs to be consumed by the call() function of the model.
- static nearest_interpolation(feature, interp_idx)[source]#
- Parameters:
feature – [B, d, N] input features matrix
interp_idx – [B, up_num_points, 1] nearest neighbour index
- Returns:
[B, up_num_points, d] interpolated features matrix
- preprocess(data, attr)[source]#
Data preprocessing function.
This function is called before training to preprocess the data from a dataset.
- Parameters:
data – A sample from the dataset.
attr – The corresponding attributes.
- Returns:
Returns the preprocessed data
- static random_sample(feature, pool_idx)[source]#
- Parameters:
feature – [B, d, N, 1] input features matrix
pool_idx – [B, N’, max_num] N’ < N, N’ is the selected position after pooling
- Returns:
pool_features = [B, N’, d] pooled features matrix