AnscombeDenoiser#
- class deepinv.models.AnscombeDenoiser(denoiser, *args, **kwargs)[source]#
Bases:
DenoiserWraps a Gaussian denoiser into a Poisson-Gaussian denoiser using the
Generalized Anscombe Transform (GAT)and itsinverse.Given a noisy observation \(y\) corrupted by
Poisson-Gaussian noisewith gain \(\gamma\) and Gaussian standard deviation \(\sigma\), the wrapper:Applies the GAT to stabilize the variance to approximately \(\gamma^2\):
\[z = 2 \sqrt{\gamma y + \frac{3}{8}\gamma^2 + \sigma^2}\]Applies the wrapped Gaussian denoiser \(\denoisername\) at noise level \(\gamma\) (which matches the standard deviation of the GAT output):
\[\hat{z} = \denoisername(z,\; \sigma=\gamma)\]Applies the inverse GAT to return to the original domain. Setting \(u = \hat{z}/\gamma\):
\[\hat{y} = \gamma\left(\frac{1}{4}u^2 + \frac{1}{4}\sqrt{\frac{3}{2}}\,u^{-1} - \frac{11}{8}u^{-2} + \frac{5}{8}\sqrt{\frac{3}{2}}\,u^{-3} - \frac{1}{8} + \frac{\sigma^2}{\gamma^2}\right), \qquad u = \frac{\hat{z}}{\gamma}\]Note
When
gain = Nonethe noise is purely Gaussian and the GAT/IGAT are bypassed: the wrapped denoiser is called directly as \(\denoisername(y, \sigma)\).- Parameters:
denoiser (deepinv.models.Denoiser) – Gaussian denoiser \(\denoisername\) to wrap.
- Examples:
>>> import deepinv as dinv >>> import torch >>> from deepinv.models import AnscombeDenoiser, DRUNet >>> denoiser = DRUNet(pretrained="download") >>> anscombe_denoiser = AnscombeDenoiser(denoiser) >>> x = dinv.utils.load_example('butterfly.png') >>> y = dinv.physics.Denoising(dinv.physics.PoissonNoise(gain=.2))(x) >>> with torch.no_grad(): ... y_denoised = anscombe_denoiser(y, sigma=0., gain=0.2) >>> dinv.utils.plot([x, y, y_denoised], ["ground-truth", "noisy", "denoised"])
- forward(y, sigma, gain=None, *args, **kwargs)[source]#
Applies the Poisson-Gaussian denoiser via the Anscombe transform.
- Parameters:
y (torch.Tensor) – Noisy measurements corrupted by Poisson-Gaussian noise.
sigma (float | torch.Tensor) – Standard deviation of the Gaussian noise \(\sigma\).
gain (float | torch.Tensor | None) – Gain of the Poisson distribution \(\gamma\).
args – Additional positional arguments passed to the wrapped denoiser.
kwargs – Additional keyword arguments passed to the wrapped denoiser.
- Return torch.Tensor:
Denoised measurements in the original domain.
- Return type:
Examples using AnscombeDenoiser:#
Poisson-Gaussian Denoising with the Generalized Anscombe Transform