PoissonGaussianNoise#

class deepinv.physics.PoissonGaussianNoise(gain=1.0, sigma=0.1, clip_positive=False, min_gain=1e-12, rng=None)[source]#

Bases: NoiseModel

Poisson-Gaussian noise \(y = \gamma z + \epsilon\) where \(z\sim\mathcal{P}(\frac{x}{\gamma})\) and \(\epsilon\sim\mathcal{N}(0, I \sigma^2)\).

This noise model allows to recover the Poisson noise model by setting the standard deviation to zero, i.e., \(\sigma=0\), and the Gaussian noise model by setting the gain to zero, i.e., \(\gamma\to0\).

Note

If \(\gamma=0\), the model will clamp the input to a small value to avoid division by zero, i.e., \(\gamma=\max(\gamma, \text{min\_gain})\).

Parameters:
  • gain (Union[float, torch.Tensor]) – gain of the noise.

  • sigma (Union[float, torch.Tensor]) – Standard deviation of the noise.

  • clip_positive (bool) – (optional) if True, the input is clipped to be positive before adding noise.

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


Examples:

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

>>> from deepinv.physics import Denoising, PoissonGaussianNoise
>>> import torch
>>> physics = Denoising()
>>> physics.noise_model = PoissonGaussianNoise()
>>> x = torch.rand(1, 1, 2, 2)
>>> y = physics(x)
forward(x, gain=None, sigma=None, seed=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 gain.

  • sigma (None, float, torch.Tensor) – Tensor containing gain and standard deviation. If not None, it will overwrite the current gain and standard deviation.

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

Returns:

noisy measurements

Examples using PoissonGaussianNoise:#

Inference and fine-tune a foundation model

Inference and fine-tune a foundation model

Tour of forward sensing operators

Tour of forward sensing operators