ScorePrior
- class deepinv.optim.ScorePrior(denoiser, *args, **kwargs)[source]
Bases:
Prior
Score via MMSE denoiser \(\nabla \reg{x}=\left(x-\operatorname{D}_{\sigma}(x)\right)/\sigma^2\).
This approximates the score of a distribution using Tweedie’s formula, i.e.,
\[- \nabla \log p_{\sigma}(x) \propto \left(x-D(x,\sigma)\right)/\sigma^2\]where \(p_{\sigma} = p*\mathcal{N}(0,I\sigma^2)\) is the prior convolved with a Gaussian kernel, \(D(\cdot,\sigma)\) is a (trained or model-based) denoiser with noise level \(\sigma\), which is typically set to a low value.
Note
If math:sigma=1, this prior is equal to
deepinv.optim.RED
, which is defined in Regularization by Denoising (RED) and doesn’t require the normalization.Note
This class can also be used with maximum-a-posteriori (MAP) denoisers, but \(p_{\sigma}(x)\) is not given by the convolution with a Gaussian kernel, but rather given by the Moreau-Yosida envelope of \(p(x)\), i.e.,
\[p_{\sigma}(x)=e^{- \inf_z \left(-\log p(z) + \frac{1}{2\sigma}\|x-z\|^2 \right)}.\]- grad(x, sigma_denoiser, *args, **kwargs)[source]
Applies the denoiser to the input signal.
- Parameters:
x (torch.Tensor) – the input tensor.
sigma_denoiser (float) – the noise level.
Examples using ScorePrior
:
Uncertainty quantification with PnP-ULA.
Building your custom sampling algorithm.