ILVRDataFidelity#

class deepinv.sampling.ILVRDataFidelity(gamma=None, weight=1.0, rng=None, *args, **kwargs)[source]#

Bases: ScoreSDEDataFidelity

Iterative Latent Variable Refinement (ILVR) data-fidelity term.

This corresponds to the \(p(y|x_t)\) approximation proposed in [26], and reviewed in [35]. ILVR is a preconditioned version of deepinv.sampling.ScoreSDEDataFidelity: the mismatch against the noised measurements \(y_t = y + \sigma_t\epsilon\) is lifted back to the image space with the pseudo-inverse \(A^\dagger\) instead of the adjoint \(A^\top\),

\[-\nabla_{x_t} \log p_t(y|x_t) \approx \lambda \frac{A^\dagger \left(A x_t - y_t\right)}{\sigma_y^2 + \gamma_t^2}, \qquad A^\dagger = \left(A^\top A\right)^{-1} A^\top,\]

where \(\lambda\), exposed as weight, controls the scale of the data-fidelity term.

Parameters:
  • gamma (Callable, float) – annealing parameter \(\gamma_t\). If None (default), \(\gamma_t = \sigma_t\), the current diffusion noise level.

  • weight (float) – Weighting factor \(\lambda\). Default: 1.0.

  • rng (torch.Generator) – Random number generator used to noise the measurements, for reproducibility. Default: None.

grad(x, y, physics, sigma, *args, **kwargs)[source]#

Compute the ILVR data-fidelity gradient \(\lambda A^\dagger \left(A x_t - y_t\right) / (\sigma_y^2 + \gamma_t^2)\).

Parameters:
Returns:

ILVR gradient, with the same shape as x.

Return type:

Tensor

Examples using ILVRDataFidelity:#

Noisy data-fidelity terms for diffusion posterior sampling

Noisy data-fidelity terms for diffusion posterior sampling