Loss#
- class deepinv.loss.Loss[source]#
Bases:
Module
Base class for all loss functions.
Sets a template for the loss functions, whose forward method must follow the input parameters in
deepinv.loss.Loss.forward()
.- adapt_model(model, **kwargs)[source]#
Some loss functions require the model forward call to be adapted before the forward pass.
- Parameters:
model (torch.nn.Module) – reconstruction model
- forward(x_net, x, y, physics, model, **kwargs)[source]#
Computes the loss.
- Parameters:
x_net (torch.Tensor) – Reconstructed image \(\inverse{y}\).
x (torch.Tensor) – Reference image.
y (torch.Tensor) – Measurement.
physics (deepinv.physics.Physics) – Forward operator associated with the measurements.
model (torch.nn.Module) – Reconstruction function.
- Returns:
(
torch.Tensor
) loss, the tensor size might be (1,) or (batch size,).- Return type:
Examples using Loss
:#

Learned Iterative Soft-Thresholding Algorithm (LISTA) for compressed sensing

Deep Equilibrium (DEQ) algorithms for image deblurring

Unfolded Chambolle-Pock for constrained image inpainting

Self-supervised learning with measurement splitting

Self-supervised denoising with the Neighbor2Neighbor loss.

Self-supervised learning with Equivariant Imaging for MRI.

Self-supervised denoising with the Generalized R2R loss.

Self-supervised learning from incomplete measurements of multiple operators.

Self-supervised MRI reconstruction with Artifact2Artifact

Imaging inverse problems with adversarial networks