perceptionmetrics.models.utils.o3d package

Submodules

perceptionmetrics.models.utils.o3d.kpconv module

perceptionmetrics.models.utils.o3d.kpconv.transform_input(points, cfg, sampler)[source]

Transform point cloud data into input data for the model

Parameters:
  • points (np.ndarray) – Point cloud data

  • cfg (dict) – Dictionary containing model configuration file

  • sampler (ul.Sampler) – Object for sampling point cloud

Returns:

Model input data and selected indices

Return type:

Tuple[ Tuple[ torch.Tensor, List[torch.Tensor], List[torch.Tensor], List[torch.Tensor], List[torch.Tensor], List[torch.Tensor], ], List[np.ndarray], ]

perceptionmetrics.models.utils.o3d.kpconv.update_probs(new_probs, indices, test_probs, lengths, weight=0.95)[source]

Update test probabilities with new model output using weighted average for a smooth transition between predictions

Parameters:
  • new_probs (torch.Tensor) – New probabilities to be added to the test probabilities

  • indices (torch.Tensor) – Corresponding indices of the new probabilities

  • test_probs (torch.Tensor) – Test probabilities to be updated

  • lengths (int) – Length of each subsampled set of points

  • weight (float, optional) – Weight used in the weighted average, defaults to 0.95

Returns:

Updated test probabilities

Return type:

torch.Tensor

perceptionmetrics.models.utils.o3d.randlanet module

perceptionmetrics.models.utils.o3d.randlanet.transform_input(points, cfg, sampler=None)[source]

Transform point cloud data into input data for the model

Parameters:
  • points (np.ndarray) – Point cloud data

  • cfg (dict) – Dictionary containing model configuration file

  • sampler (Optional[ul.Sampler], optional) – Object for sampling point cloud, defaults to None

Returns:

Model input data and selected indices

Return type:

Tuple[ Tuple[ torch.Tensor, List[torch.Tensor], List[torch.Tensor], List[torch.Tensor], List[torch.Tensor], ], np.ndarray, ]

perceptionmetrics.models.utils.o3d.randlanet.update_probs(new_probs, indices, test_probs, n_classes, weight=0.95)[source]

Update test probabilities with new model output using weighted average for a smooth transition between predictions

Parameters:
  • new_probs (torch.Tensor) – New probabilities to be added to the test probabilities

  • indices (torch.Tensor) – Corresponding indices of the new probabilities

  • test_probs (torch.Tensor) – Test probabilities to be updated

  • n_classes (int) – Number of classes

  • weight (float, optional) – Weight used in the weighted average, defaults to 0.95

Returns:

Updated test probabilities

Return type:

torch.Tensor

Module contents

perceptionmetrics.models.utils.o3d.get_sample(points_fname, model_cfg, label_fname=None, name=None, idx=None, has_intensity=True, measure_processing_time=False)[source]

Get sample data for mmdetection3d models

Parameters:
  • points_fname (str) – filename of the point cloud

  • model_cfg (dict) – model configuration

  • label_fname (Optional[str], optional) – filename of the semantic label, defaults to None

  • name (Optional[str], optional) – sample name, defaults to None

  • idx (Optional[int], optional) – sample numerical index, defaults to None

  • has_intensity (bool, optional) – whether the point cloud has intensity values, defaults to True

  • measure_processing_time (bool, optional) – whether to measure processing time, defaults to False

Returns:

sample data and optionally processing time

Return type:

Union[ Tuple[np.ndarray, np.ndarray, ul.Sampler, np.ndarray, str, int], Tuple[np.ndarray, np.ndarray, ul.Sampler, np.ndarray, str, int], Dict[str, float] ]

perceptionmetrics.models.utils.o3d.inference(sample, model, model_cfg, measure_processing_time=False)[source]

Perform inference on a sample using an Open3D-ML model

Parameters:
  • sample (dict) – sample data dictionary

  • model (torch.nn.Module) – Open3D-ML model

  • model_cfg (dict) – model configuration

  • measure_processing_time (bool, optional) – whether to measure processing time, defaults to False

Returns:

predicted labels, ground truth labels, sample name and optionally processing time

Return type:

Union[ Tuple[torch.Tensor, Optional[torch.Tensor], Optional[str]], Tuple[torch.Tensor, Optional[torch.Tensor], Optional[str], Dict[str, float]] ]

perceptionmetrics.models.utils.o3d.reset_sampler(sampler, num_points, num_classes)[source]

Reset sampler object probabilities

Parameters:
  • sampler (ul.Sampler) – Sampler object

  • num_points (int) – Number of points in the point cloud

  • num_classes (int) – Number of semantic classes