EILoss#

class deepinv.loss.EILoss(transform, metric=torch.nn.MSELoss(), apply_noise=True, weight=1.0, no_grad=False, *args, **kwargs)[source]#

Bases: Loss

Equivariant imaging self-supervised loss.

Assumes that the set of signals is invariant to a group of transformations (rotations, translations, etc.) in order to learn from incomplete measurement data alone https://https://arxiv.org/pdf/2103.14756.pdf.

The EI loss is defined as

\[\| T_g \hat{x} - \inverse{\forw{T_g \hat{x}}}\|^2\]

where \(\hat{x}=\inverse{y}\) is a reconstructed signal and \(T_g\) is a transformation sampled at random from a group \(g\sim\group\).

By default, the error is computed using the MSE metric, however any other metric (e.g., \(\ell_1\)) can be used as well.

Parameters:
  • transform (deepinv.transform.Transform) – Transform to generate the virtually augmented measurement. It can be any torch-differentiable function (e.g., a torch.nn.Module) including torchvision transforms.

  • metric (Metric, torch.nn.Module) – Metric used to compute the error between the reconstructed augmented measurement and the reference image.

  • apply_noise (bool) – if True, the augmented measurement is computed with the full sensing model \(\sensor{\noise{\forw{\hat{x}}}}\) (i.e., noise and sensor model), otherwise is generated as \(\forw{\hat{x}}\).

  • weight (float) – Weight of the loss.

  • no_grad (bool) – if True, the gradient does not propagate through \(T_g\). Default: False. This option is useful for super-resolution problems, see https://arxiv.org/abs/2312.11232.

forward(x_net, physics, model, **kwargs)[source]#

Computes the EI loss

Parameters:
Returns:

(torch.Tensor) loss.

Examples using EILoss:#

Image transforms for equivariance & augmentations

Image transforms for equivariance & augmentations

Remote sensing with satellite images

Remote sensing with satellite images

Tour of MRI functionality in DeepInverse

Tour of MRI functionality in DeepInverse

Image transformations for Equivariant Imaging

Image transformations for Equivariant Imaging

Self-supervised learning with Equivariant Imaging for MRI.

Self-supervised learning with Equivariant Imaging for MRI.