kaolin.metrics.voxelgrid

API

kaolin.metrics.voxelgrid.iou(pred, gt)

Computes IoU across two voxelgrids

Parameters
  • pred (torch.Tensor) – predicted (binary) voxelgrids, of shape \((\text{batch_size}, \text{X}, \text{Y}, \text{Z})\).

  • gt (torch.Tensor) – ground-truth (binary) voxelgrids, of shape \((\text{batch_size}, \text{X}, \text{Y}, \text{Z})\).

Returns

the intersection over union value.

Return type

(torch.FloatTensor)

Example

>>> pred = torch.tensor([[[[0., 0.],
...                        [1., 1.]],
...                       [[1., 1.],
...                        [1., 1.]]]])
>>> gt = torch.ones((1,2,2,2))
>>> iou(pred, gt)
tensor([0.7500])