CPABDiffeomorphism#

class deepinv.transform.CPABDiffeomorphism(*args, constant_batch: bool = True, n_tesselation: int = 3, zero_boundary: bool = True, volume_perservation: bool = True, override: bool = True, device: str | device = 'cpu', **kwargs)[source]#

Bases: Transform

Continuous Piecewise-Affine-based Diffeomorphism.

This requires the libcpab package which you can install from our maintained fork using pip install libcpab.

Wraps CPAB from a modified version of the original implementation. From the paper Freifeld et al. Transformations Based on Continuous Piecewise-Affine Velocity Fields.

These diffeomorphisms benefit from fast GPU-accelerated transform + fast inverse.

Generates n_trans randomly transformed versions.

See deepinv.transform.Transform for further details and examples.

..warning

This implementation does not allow using a ``torch.Generator`` to generate reproducible transformations.
You may be able to achieve reproducibility by using a global seed instead.
Parameters:
  • n_trans (int) – number of transformed versions generated per input image.

  • constant_batch (int) – if True, all images in batch transformed with same params.

  • n_tesselation (int) – number of cells in tesselation in all dimensions. See libcpab.Cpab docs for more info.

  • zero_boundary (bool) – see libcpab.Cpab docs.

  • volume_perservation (bool) – see libcpab.Cpab docs.

  • override (bool) – see libcpab.Cpab docs.

  • device (str, torch.device) – torch device.

Examples using CPABDiffeomorphism:#

Image transforms for equivariance & augmentations

Image transforms for equivariance & augmentations