open3d.ml.tf.models.SparseConvUnet¶
-
class
open3d.ml.tf.models.
SparseConvUnet
(*args, **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, augment=None, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
call
(inputs, training=False)¶ Calls the model on new inputs.
In this case call just reapplies all ops in the graph to the new inputs (e.g. build a new computational graph from the provided inputs).
Note: This method should not be called directly. It is only meant to be overridden when subclassing tf.keras.Model. To call a model on an input, always use the __call__ method, i.e. model(inputs), which relies on the underlying call method.
- Parameters
inputs – A tensor or list of tensors.
training – Boolean or boolean scalar tensor, indicating whether to run the Network in training mode or inference mode.
mask – A mask or list of masks. A mask can be either a tensor or None (no mask).
- Returns
A tensor if there is a single output, or a list of tensors if there are more than one outputs.
-
get_batch_gen
(dataset, steps_per_epoch=None, batch_size=1)¶
-
get_loss
(Loss, results, inputs)¶ 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
(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
(point, feat, label, lengths)¶ Transform function for the point cloud and features.
- Parameters
args – A list of tf Tensors.
-