open3d.ml.torch.models.SparseConvUnet#

class open3d.ml.torch.models.SparseConvUnet(name='SparseConvUnet', device='cuda', multiplier=16, voxel_size=0.05, conv_block_reps=1, residual_blocks=False, in_channels=3, num_classes=20, grid_size=4096, batcher='ConcatBatcher', augment=None, **kwargs)#

Semantic Segmentation model.

Uses UNet architecture replacing convolutions with Sparse Convolutions.

name#

Name of model. Default to “SparseConvUnet”.

device#

Which device to use (cpu or cuda).

voxel_size#

Voxel length for subsampling.

multiplier#

min length of feature length in each layer.

conv_block_reps#

repetition of Unet Blocks.

residual_blocks#

Whether to use Residual Blocks.

in_channels#

Number of features(default 3 for color).

num_classes#

Number of classes.

__init__(name='SparseConvUnet', device='cuda', multiplier=16, voxel_size=0.05, conv_block_reps=1, residual_blocks=False, in_channels=3, num_classes=20, grid_size=4096, batcher='ConcatBatcher', augment=None, **kwargs)#

Initialize.

Parameters:
  • cfg (cfg object or str) – cfg object or path to cfg file

  • dataset_path (str) – path to the dataset

  • **kwargs (dict) – Dict of args

forward(inputs)#

Defines 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 Module instance 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)#

Calculate the loss on output of the model.

Loss#

Object of type SemSegLoss.

results#

Output of the model.

inputs#

Input of the model.

device#

device(cpu or cuda).

Returns:

Returns loss, labels and scores.

get_optimizer(cfg_pipeline)#

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)#

Function called right before running inference.

Parameters:

data – A data from the dataset.

inference_end(inputs, results)#

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()#

This function prepares the inputs for the model.

Returns:

The inputs to be consumed by the call() function of the model.

preprocess(data, attr)#

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

transform(data, attr)#

Transform function for the point cloud and features.

Parameters:

cfg_pipeline – config file for pipeline.

update_probs(inputs, results, test_probs, test_labels)#
training: bool#