MOILoss
- class deepinv.loss.MOILoss(physics: list[Physics] | Physics | None = None, physics_generator: PhysicsGenerator | None = None, metric: Metric | Module = MSELoss(), apply_noise=True, weight=1.0, rng=None)[source]
Bases:
Loss
Multi-operator imaging loss
This loss can be used to learn when signals are observed via multiple (possibly incomplete) forward operators \(\{A_g\}_{g=1}^{G}\), i.e., \(y_i = A_{g_i}x_i\) where \(g_i\in \{1,\dots,G\}\) (see https://arxiv.org/abs/2201.12151).
The measurement consistency loss is defined as
\[\| \hat{x} - \inverse{A_g\hat{x},A_g} \|^2\]where \(\hat{x}=\inverse{y,A_s}\) is a reconstructed signal (observed via operator \(A_s\)) and \(A_g\) is a forward operator sampled at random from a set \(\{A_g\}_{g=1}^{G}\).
By default, the error is computed using the MSE metric, however any other metric (e.g., \(\ell_1\)) can be used as well.
The operators can be passed as a list of physics or as a single physics with a random physics generator.
- Parameters:
physics (list[Physics], Physics) – list of physics containing the \(G\) different forward operators associated with the measurements, or single physics, or None. If single physics or None, physics generator must be used. If None, physics taken during
forward
.physics_generator (PhysicsGenerator) – random physics generator that generates new params, if physics is not a list.
metric (Metric, torch.nn.Module) – metric used for computing data consistency, which is set as the mean squared error by default.
weight (float) – total weight of the loss
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}}\).rng (torch.Generator) – torch randon number generator for randomly selecting from physics list. If using physics generator, rng is ignored.
- forward(x_net, physics, model, **kwargs)[source]
Computes the MOI loss.
- Parameters:
x_net (torch.Tensor) – Reconstructed image \(\inverse{y}\).
physics (Physics) – measurement physics.
model (torch.nn.Module) – Reconstruction function.
- Returns:
(torch.Tensor) loss.
Examples using MOILoss
:
Self-supervised learning from incomplete measurements of multiple operators.