jittor.loss3d

这里是Jittor的 3d 损失函数 模块的API文档,您可以通过from jittor import loss3d来获取该模块。

class jittor.loss3d.ChamferLoss(reduction='mean', dims='BNC', bidirectional=False)[源代码]

A loss layer that computes the chamfer loss from pc1 to pc2.

参数:
  • pc1 (jittor array) – input point cloud

  • pc2 (jittor array) – input point cloud

  • reduction (str, optional) – reduction method in batches, can be ‘mean’, ‘sum’, or None. Default: ‘mean’.

  • dims (str, optional) – a string that represents each dimension, can be ‘[BNC]’ ([batch, number of points, xyz]), or ‘[BCN]’ ([batch, xyz, number of points]). Default: ‘BNC’.

Example:

>>> import jittor as jt
>>> from jittor.loss3d import ChamferLoss
>>> jt.flags.use_cuda = True
>>> pc1 = jt.rand([10, 100, 3], dtype=jt.float32)
>>> pc2 = jt.rand([10, 100, 3], dtype=jt.float32)
>>> CF = ChamferLoss(dims='BNC', bidirectional=True)
>>> cf = CF(pc1, pc2)
>>> print('chamfer loss =', cf.item())
class jittor.loss3d.EarthMoverDistance(*args, **kw)[源代码]

A loss layer that computes Earth Mover’s distance from pc1 to pc2. Only supports GPU.

参数:
  • pc1 (jittor array) – input point cloud

  • pc2 (jittor array) – input point cloud

  • reduction (str, optional) – reduction method in batches, can be ‘mean’, ‘sum’, or None. Default: ‘mean’.

  • dims (str, optional) – a string that represents each dimension, can be ‘[BNC]’ ([batch, number of points, xyz]), or ‘[BCN]’ ([batch, xyz, number of points]). Default: ‘BNC’.

Example:

>>> import jittor as jt
>>> from jittor.loss3d import EarthMoverDistance
>>> jt.flags.use_cuda = True
>>> pc1 = jt.rand([10, 100, 3], dtype=jt.float32)
>>> pc2 = jt.rand([10, 100, 3], dtype=jt.float32)
>>> EMD = EarthMoverDistance(dims='BNC')
>>> emd = EMD(pc1, pc2)
>>> print('EMD =', emd.item())
grad(grad)[源代码]
jittor.loss3d.chamfer_loss(pc1, pc2, reduction='mean', dims='BNC', bidirectional=False)[源代码]

return the chamfer loss from pc1 to pc2.

参数:
  • pc1 (jittor array) – input point cloud

  • pc2 (jittor array) – input point cloud

  • reduction (str, optional) – reduction method in batches, can be ‘mean’, ‘sum’, or None. Default: ‘mean’.

  • dims (str, optional) – a string that represents each dimension, can be ‘[BNC]’ ([batch, number of points, xyz]), or ‘[BCN]’ ([batch, xyz, number of points]). Default: ‘BNC’.

Example:

>>> import jittor as jt
>>> from jittor.loss3d import chamfer_loss
>>> jt.flags.use_cuda = True
>>> pc1 = jt.rand([10, 100, 3], dtype=jt.float32)
>>> pc2 = jt.rand([10, 100, 3], dtype=jt.float32)
>>> cf = chamfer_loss(pc1, pc2, dims='BNC', bidirectional=True)
>>> print('chamfer loss =', cf.item())
jittor.loss3d.earth_mover_distance(pc1, pc2, reduction='mean', dims='BNC')[源代码]

Earth Mover’s distance from pc1 to pc2. Only supports GPU.

参数:
  • pc1 (jittor array) – input point cloud

  • pc2 (jittor array) – input point cloud

  • reduction (str, optional) – reduction method in batches, can be ‘mean’, ‘sum’, or None. Default: ‘mean’.

  • dims (str, optional) – a string that represents each dimension, can be ‘[BNC]’ ([batch, number of points, xyz]), or ‘[BCN]’ ([batch, xyz, number of points]). Default: ‘BNC’.

Example:

>>> import jittor as jt
>>> from jittor.loss3d import earth_mover_distance
>>> jt.flags.use_cuda = True
>>> pc1 = jt.rand([10, 100, 3], dtype=jt.float32)
>>> pc2 = jt.rand([10, 100, 3], dtype=jt.float32)
>>> emd = earth_mover_distance(pc1, pc2, dims='BNC')
>>> print('EMD =', emd.item())