LION.losses.jacobian_penalty¶
Penalties on a denoiser’s Jacobian, for Plug-and-Play methods that converge.
PnP convergence proofs ask something of the denoiser D: that it be firmly
nonexpansive (2D - I nonexpansive; Pesquet et al. 2021), or that its residual
I - D, the gradient of the potential of a gradient-step denoiser, be
L-Lipschitz with L < 1 (Hurault et al. 2022). A network isn’t, so it is
trained with a penalty on the spectral norm of the Jacobian of that map,
estimated by power iterations. They are model regularisations: a solver
adds one to its loss when it is its model_regularization (off by
default), called as penalty(model, step) with the mini-batch’s step
(LIONsolver).
Classes
|
Pesquet et al. (2021): |
|
Hurault et al. (2022): |
Functions
|
The spectral norm of the Jacobian J of |
- class LION.losses.jacobian_penalty.FirmlyNonexpansivePenalty(weight=1e-05, epsilon=0.05, power_iterations=50)[source]¶
Bases:
ModulePesquet et al. (2021):
weight * max(||J_Q(x̃)||², 1 - epsilon), with Q = 2D - I and x̃ a random point between each clean image and its denoised image (x̃ = r x + (1 - r) D(y), r uniform in [0, 1]).Their settings:
weight1e-5,epsilon0.05, after training without it (pretraining). They estimate the norm with the power method (their Appendix C); 50 iterations is Hurault et al.’s number.Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class LION.losses.jacobian_penalty.ProximalDenoiserPenalty(weight=0.001, epsilon=0.1, power_iterations=50)[source]¶
Bases:
ModuleHurault et al. (2022):
weight * max(||J_{I-D}(y)||, 1 - epsilon)at the noisy images y: the Hessian of a gradient-step denoiser’s potential (I - D = ∇g), so that D is a proximal operator.Their settings:
weight(μ) 1e-3 or 1e-2,epsilon0.1, 50 power iterations, fine-tuning a trained gradient-step denoiser for 10 epochs.Initialize internal Module state, shared by both nn.Module and ScriptModule.
- LION.losses.jacobian_penalty.jacobian_spectral_norm(f, x, power_iterations=50)[source]¶
The spectral norm of the Jacobian J of
fat each image of the batchx(fmaps each image on its own), estimated withpower_iterationsiterations of the power method on JᵀJ. Differentiable with respect tof’s parameters (as||Jᵀv||, v the last left singular vector: second derivatives only, which e.g. batch normalisation supports).