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: Module, **kwargs) Module [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: Tensor, x: Tensor, y: Tensor, physics: Physics, model: Module, **kwargs) Tensor [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,).
Examples using Loss
:
Imaging inverse problems with adversarial networks
Image transforms for equivariance & augmentations
Training a reconstruction network.
Self-supervised learning with measurement splitting
Image transformations for Equivariant Imaging
Self-supervised MRI reconstruction with Artifact2Artifact
Self-supervised denoising with the UNSURE loss.
Self-supervised denoising with the SURE loss.
Self-supervised denoising with the Neighbor2Neighbor loss.
Self-supervised learning with Equivariant Imaging for MRI.
Self-supervised learning from incomplete measurements of multiple operators.
Vanilla Unfolded algorithm for super-resolution
Learned Iterative Soft-Thresholding Algorithm (LISTA) for compressed sensing
Deep Equilibrium (DEQ) algorithms for image deblurring
Learned iterative custom prior
Learned Primal-Dual algorithm for CT scan.
Unfolded Chambolle-Pock for constrained image inpainting