deepmr.prox.tgv_denoise

Contents

deepmr.prox.tgv_denoise#

deepmr.prox.tgv_denoise(input, ndim, ths=0.1, device=None, verbose=False, niter=100, crit=1e-05, x2=None, u2=None)[source]#

Apply Total Generalized Variation denoising.

(see K. Bredies, K. Kunisch, and T. Pock, “Total generalized variation,” SIAM J. Imaging Sci., 3(3), 492-526, 2010.)

This algorithm converges to the unique image \(x\) (and the auxiliary vector field \(r\)) minimizing

\[\underset{x, r}{\arg\min} \; \frac{1}{2}\|x-y\|_2^2 + \lambda_1 \|r\|_{1,2} + \lambda_2 \|J(Dx-r)\|_{1,F}\]

where \(D\) maps an image to its gradient field and \(J\) maps a vector field to its Jacobian. For a large value of \(\lambda_2\), the TGV behaves like the TV. For a small value, it behaves like the \(\ell_1\)-Frobenius norm of the Hessian.

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.

Parameters:
  • input (np.ndarray | torch.Tensor) – Input image of shape (…, n_ndim, …, n_0).

  • ndim (int) – Number of spatial dimensions, can be either 2 or 3.

  • ths (float, optional) – Denoise threshold. Default is 0.1.

  • ndim – Number of spatial dimensions, can be either 2 or 3.

  • ths – Denoise threshold. The default is 0.1.

  • trainable (bool, optional) – If True, threshold value is trainable, otherwise it is not. The default is False.

  • device (str, optional) – Device on which the wavelet transform is computed. The default is None (infer from input).

  • verbose (bool, optional) – Whether to print computation details or not. The default is False.

  • niter (int, optional,) – Maximum number of iterations. The default is 1000.

  • crit (float, optional) – Convergence criterion. The default is 1e-5.

  • x2 (torch.Tensor, optional) – Primary variable for warm restart. The default is None.

  • u2 (torch.Tensor, optional) – Dual variable for warm restart. The default is None.

  • r2 (torch.Tensor, optional) – Auxiliary variable for warm restart. The default is None.

Returns:

output – Denoised image of shape (…, n_ndim, …, n_0).

Return type:

np.ndarray | torch.Tensor