PoissonNoise

class deepinv.physics.PoissonNoise(gain=1.0, normalize=True, clip_positive=False, rng: Generator | None = None)[source]

Bases: NoiseModel

Poisson noise \(y = \mathcal{P}(\frac{x}{\gamma})\) with gain \(\gamma>0\).

If normalize=True, the output is divided by the gain, i.e., \(\tilde{y} = \gamma y\).


Examples:

Adding Poisson noise to a physics operator by setting the noise_model attribute of the physics operator:

>>> from deepinv.physics import Denoising, PoissonNoise
>>> import torch
>>> physics = Denoising()
>>> physics.noise_model = PoissonNoise()
>>> x = torch.rand(1, 1, 2, 2)
>>> y = physics(x)
Parameters:
  • gain (float) – gain of the noise.

  • normalize (bool) – normalize the output.

  • clip_positive (bool) – clip the input to be positive before adding noise. This may be needed when a NN outputs negative values e.g. when using LeakyReLU.

  • rng (torch.Generator (Optional)) – a pseudorandom random number generator for the parameter generation.

forward(x, gain=None, seed: int | None = None, **kwargs)[source]

Adds the noise to measurements x

Parameters:
  • x (torch.Tensor) – measurements

  • gain (None, float, torch.Tensor) – gain of the noise. If not None, it will overwrite the current noise level.

  • seed (int) – the seed for the random number generator, if rng is provided.

Returns:

noisy measurements

update_parameters(gain=None, **kwargs)[source]

Updates the gain of the noise.

Parameters:

gain (float, torch.Tensor) – gain of the noise.

Examples using PoissonNoise:

A tour of forward sensing operators

A tour of forward sensing operators

Self-supervised denoising with the SURE loss.

Self-supervised denoising with the SURE loss.

Self-supervised denoising with the Neighbor2Neighbor loss.

Self-supervised denoising with the Neighbor2Neighbor loss.