Skip to content

Denoiser examples: L1 or L2 loss and Jacobian penalties, with the papers - #398

Merged
AnderBiguri merged 3 commits into
mainfrom
docs/denoiser-loss-choice
Nov 23, 2026
Merged

AnderBiguri merged 3 commits into
mainfrom
docs/denoiser-loss-choice

Conversation

@AnderBiguri

@AnderBiguri AnderBiguri commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

The Gaussian-denoiser examples used torch.nn.L1Loss() without saying why. They now define both losses, use one, and cite the papers:

  • demos/d07_denoisers_and_pnp.py: a cell defining l1_loss and l2_loss, loss_fn = l1_loss, with full references. The commented fine-tuning example uses loss_fn too.
  • scripts/example_scripts/04_pnp_denoiser.py: the same, shorter.

Which paper uses which:

  • L1: DRUNet (Zhang et al., TPAMI 2022: "minimizing the L1 loss rather than L2 loss").
  • L2: DnCNN (Zhang et al., TIP 2017), FFDNet (Zhang et al., TIP 2018), gradient-step denoiser (Hurault et al., ICLR 2022).
  • Why choose either: L2 trains towards the MMSE denoiser (Tweedie, what PnP theory assumes); L1 towards the median, and often trains better (Zhao et al., IEEE TCI 2017).

What changes for existing results: nothing; the examples still train with L1.

Second commit: which papers use which model_regularization. DnCNN, FFDNet, DRUNet and the GS denoiser use none. Pesquet et al. (SIIMS 2021, FirmlyNonexpansivePenalty) and Hurault et al. (ICML 2022, ProximalDenoiserPenalty) both use the L2 loss: they train without the penalty first, then fine-tune with it. The commented fine-tuning example in d07 now uses l2_loss, as those papers do (before, it used the L1 loss of the main example).

https://claude.ai/code/session_01L6n1VKffUYCm8Gn76j2Uvf


Generated by Claude Code

The d07 tutorial and the PnP example script define both losses and use
one (L1, as DRUNet), saying which paper uses which: L1 for DRUNet; L2 for
DnCNN, FFDNet and the gradient-step denoiser; and why one might choose
either (L2 trains towards the MMSE denoiser PnP theory assumes; L1 often
trains better, Zhao et al. 2017). No change to what the examples run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6n1VKffUYCm8Gn76j2Uvf
…which loss

Pesquet et al. (2021) and Hurault et al. (ICML 2022) both use the L2 loss
and add their penalty after training without it; DnCNN, FFDNet, DRUNet and
the GS denoiser use none. The commented fine-tuning example now uses
l2_loss, as the papers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6n1VKffUYCm8Gn76j2Uvf
@AnderBiguri AnderBiguri changed the title Denoiser examples: L1 or L2 loss, with the papers Denoiser examples: L1 or L2 loss and Jacobian penalties, with the papers Nov 23, 2026
The main training passes model_regularization=None explicitly; the
fine-tuning example defines both penalties, each with its paper and
settings, and picks one, as loss_fn is picked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6n1VKffUYCm8Gn76j2Uvf
@AnderBiguri
AnderBiguri merged commit 2cad0c6 into main Nov 23, 2026
3 checks passed
@AnderBiguri
AnderBiguri deleted the docs/denoiser-loss-choice branch November 23, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants