TVDenoiser#

class deepinv.models.TVDenoiser(verbose=False, tau=0.01, rho=1.99, n_it_max=1000, crit=1e-05, x2=None, u2=None)[source]#

Bases: Denoiser

Proximal operator of the isotropic Total Variation operator.

This algorithm converges to the unique image \(x\) that is the solution of

\[\underset{x}{\arg\min} \; \frac{1}{2}\|x-y\|_2^2 + \gamma \|Dx\|_{1,2},\]

where \(D\) maps an image to its gradient field.

The problem is solved with an over-relaxed Chambolle-Pock algorithm (see L. Condat, “A primal-dual splitting method for convex optimization involving Lipschitzian, proximable and linear composite terms”, J. Optimization Theory and Applications, vol. 158, no. 2, pp. 460-479, 2013.

Code (and description) adapted from Laurent Condat’s matlab version (https://lcondat.github.io/software.html) and Daniil Smolyakov’s code.

This algorithm is implemented with warm restart, i.e. the primary and dual variables are kept in memory between calls to the forward method. This speeds up the computation when using this class in an iterative algorithm.

Parameters:
  • verbose (bool) – Whether to print computation details or not. Default: False.

  • tau (float) – Stepsize for the primal update. Default: 0.01.

  • rho (float) – Over-relaxation parameter. Default: 1.99.

  • n_it_max (int) – Maximum number of iterations. Default: 1000.

  • crit (float) – Convergence criterion. Default: 1e-5.

  • x2 (torch.Tensor, None) – Primary variable for warm restart. Default: None.

  • u2 (torch.Tensor, None) – Dual variable for warm restart. Default: None.

Note

The regularization term \(\|Dx\|_{1,2}\) is implicitly normalized by its Lipschitz constant, i.e. \(\sqrt{8}\), see e.g. A. Beck and M. Teboulle, “Fast gradient-based algorithms for constrained total variation image denoising and deblurring problems”, IEEE T. on Image Processing. 18(11), 2419-2434, 2009.

Warning

For using TV as a prior for Plug and Play algorithms, it is recommended to use the class TVPrior instead. In particular, it allows to evaluate TV.

forward(y, ths=None, **kwargs)[source]#

Computes the proximity operator of the TV norm.

Parameters:
Returns:

Denoised image.

static nabla(x)[source]#

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

static nabla_adjoint(x)[source]#

Applies the adjoint of the finite difference operator.

prox_tau_fx(x, y)[source]#

Proximal operator of the function \(\frac{1}{2}\|x-y\|_2^2\).