kaolin.metrics.point

chamfer_distance(S1: torch.Tensor, S2: torch.Tensor, w1: float = 1.0, w2: float = 1.0)[source]

Computes the chamfer distance between two point clouds

Parameters
  • S1 (torch.Tensor) – point cloud

  • S2 (torch.Tensor) – point cloud

  • w1 – (float): weighting of forward direction

  • w2 – (float): weighting of backward direction

Returns

chamfer distance between two point clouds S1 and S2

Return type

torch.Tensor

Example

>>> A = torch.rand(300,3)
>>> B = torch.rand(200,3)
>>> >>> chamfer_distance(A,B)
tensor(0.1868)
directed_distance(S1: torch.Tensor, S2: torch.Tensor, mean: bool = True)[source]

Computes the average distance from point cloud S1 to point cloud S2

Parameters
Returns

ditance from point cloud S1 to point cloud S2

Return type

torch.Tensor

Args:

Example

>>> A = torch.rand(300,3)
>>> B = torch.rand(200,3)
>>> >>> directed_distance(A,B)
tensor(0.1868)
iou(points1: torch.Tensor, points2: torch.Tensor, thresh=0.5)[source]

Computes the intersection over union values for two sets of points

Parameters
Returns

IoU scores for the two sets of points

Return type

iou (torch.Tensor)

Examples

>>> points1 = torch.rand( 1000)
>>> points2 = torch.rand( 1000)
>>> loss = iou(points1, points2)
tensor(0.3400)
f_score(gt_points: torch.Tensor, pred_points: torch.Tensor, radius: float = 0.01, extend=False)[source]

Computes the f-score of two sets of points, with a hit defined by two point existing withing a defined radius of each other

Parameters
  • gt_points (torch.Tensor) – ground truth points

  • pred_points (torch.Tensor) – predicted points points

  • radius (float) – radisu from a point to define a hit

  • extend (bool) – if the alternate f-score definition should be applied

Returns

computed f-score

Return type

(float)

Example

>>> points1 = torch.rand(1000)
>>> points2 = torch.rand(1000)
>>> loss = f_score(points1, points2)
>>> loss
tensor(0.0070)