TVPrior#

class deepinv.optim.TVPrior(def_crit=1e-08, n_it_max=1000, *args, **kwargs)[source]#

Bases: Prior

Total variation (TV) prior \(\reg{x} = \| D x \|_{1,2}\).

Parameters:
  • def_crit (float) – default convergence criterion for the inner solver of the TV denoiser; default value: 1e-8.

  • n_it_max (int) – maximal number of iterations for the inner solver of the TV denoiser; default value: 1000.

fn(x, *args, **kwargs)[source]#

Computes the regularizer

\[\reg{x} = \|Dx\|_{1,2}\]

where D is the finite differences linear operator, and the 2-norm is taken on the dimension of the differences.

Parameters:

x (torch.Tensor) – Variable \(x\) at which the prior is computed.

Returns:

(torch.Tensor) prior \(g(x)\).

nabla(x)[source]#

Applies the finite differences operator associated with tensors of the same shape as x.

nabla_adjoint(x)[source]#

Applies the adjoint of the finite difference operator.

prox(x, *args, gamma=1.0, **kwargs)[source]#

Compute the proximity operator of TV with the denoiser TVDenoiser.

Parameters:
  • x (torch.Tensor) – Variable \(x\) at which the proximity operator is computed.

  • gamma (float) – stepsize of the proximity operator.

Returns:

(torch.Tensor) proximity operator at \(x\).

Examples using TVPrior:#

Image deblurring with Total-Variation (TV) prior

Image deblurring with Total-Variation (TV) prior