SurePoissonLoss#
- class deepinv.loss.SurePoissonLoss(gain, tau=0.001, rng: Generator | None = None)[source]#
Bases:
Loss
SURE loss for Poisson noise
The loss is designed for the following noise model:
\[y = \gamma z \quad \text{with}\quad z\sim \mathcal{P}(\frac{u}{\gamma}), \quad u=A(x).\]The loss is computed as
\[\frac{1}{m}\|y-A\inverse{y}\|_2^2-\frac{\gamma}{m} 1^{\top}y +\frac{2\gamma}{m\tau}(b\odot y)^{\top} \left(A\inverse{y+\tau b}-A\inverse{y}\right)\]where \(R\) is the trainable network, \(y\) is the noisy measurement vector of size \(m\), \(b\) is a Bernoulli random variable taking values of -1 and 1 each with a probability of 0.5, \(\tau\) is a small positive number, and \(\odot\) is an elementwise multiplication.
See https://ieeexplore.ieee.org/abstract/document/6714502/ for details. If the measurement data is truly Poisson this loss is an unbiased estimator of the mean squared loss \(\frac{1}{m}\|u-A\inverse{y}\|_2^2\) where \(z\) is the noiseless measurement.
Warning
The loss can be sensitive to the choice of \(\tau\), which should be proportional to the size of \(y\). The default value of 0.01 is adapted to \(y\) vectors with entries in \([0,1]\).
- Parameters:
gain (float) – Gain of the Poisson Noise.
tau (float) – Approximation constant for the Monte Carlo approximation of the divergence.
rng (torch.Generator) – Optional random number generator. Default is None.
- forward(y, x_net, physics, model, **kwargs)[source]#
Computes the SURE loss.
- Parameters:
y (torch.Tensor) – measurements.
x_net (torch.Tensor) – reconstructed image \(\inverse{y}\).
physics (deepinv.physics.Physics) – Forward operator associated with the measurements
model (torch.nn.Module) – Reconstruction network
- Returns:
torch.nn.Tensor loss of size (batch_size,)
Examples using SurePoissonLoss
:#
Self-supervised denoising with the SURE loss.