open3d.ml.torch.models.PVCNN#

class open3d.ml.torch.models.PVCNN(name='PVCNN', device='cuda', num_classes=13, num_points=40960, extra_feature_channels=6, width_multiplier=1, voxel_resolution_multiplier=1, batcher='DefaultBatcher', augment=None, **kwargs)#

Semantic Segmentation model. Based on Point Voxel Convolutions. https://arxiv.org/abs/1907.03739

Uses PointNet architecture with separate Point and Voxel processing.

name#

Name of model. Default to “PVCNN”.

num_classes#

Number of classes.

num_points#

Number of points to sample per pointcloud.

extra_feature_channels#

Number of extra features. Default to 6 (RGB + Coordinate norms).

batcher#

Batching method for dataloader.

augment#

dictionary for augmentation.

__init__(name='PVCNN', device='cuda', num_classes=13, num_points=40960, extra_feature_channels=6, width_multiplier=1, voxel_resolution_multiplier=1, batcher='DefaultBatcher', 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)#

Forward pass for the model.

Parameters:

inputs – A dict object for inputs with following keys point (torch.float32): Input pointcloud (B, 3, N) feat (torch.float32): Input features (B, 9, N)

Returns:

probability distribution (B, N, C).

Return type:

torch.float32

get_loss(sem_seg_loss, results, inputs, device)#

Calculate the loss on output of the model.

sem_seg_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. It consists of subsampling and normalizing the pointcloud and creating new features.

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.

This function is called after preprocess method. It consists of converting numpy arrays to torch Tensors.

Parameters:
  • data – A sample from the dataset.

  • attr – The corresponding attributes.

Returns:

Returns dictionary data with keys (point, feat, label).

update_probs(inputs, results, test_probs)#
blocks = ((64, 1, 32), (64, 2, 16), (128, 1, 16), (1024, 1, None))#