Classification-Denoising Networks

Louis Thiry, Florentin Guth · DOI

Introduction

In modern computer vision, classification and denoising are typically treated as separate tasks. This separation results in two primary weaknesses: classifiers are notoriously brittle and vulnerable to adversarial attacks, while deep denoisers often struggle to incorporate class-level context effectively. Previous attempts to unify these tasks, such as Joint Energy Models (JEM), suffered from training instability and failed to scale beyond small datasets.

This paper introduces Classification-Denoising Networks (CDNs), a framework that unifies image classification and denoising into a single model by learning the joint probability of noisy images and their labels. By modeling the "score" of the data distribution, the authors create a classifier that is inherently more robust and provides a new mathematical interpretation of adversarial vulnerability: adversarial gradients are simply the difference between a conditional and an unconditional denoiser.

Methods: The GradResNet Architecture

The core of the CDN approach is modeling the joint log-probability $\log p(y, c)$ of a noisy image $y$ and a class label $c$. Classification is performed via a standard forward pass to compute logits. Denoising is achieved through the backward pass: using the Tweedie-Miyasawa formula, the model estimates the clean image by calculating the gradient of the log-probability with respect to the input (the "score").

To support this dual-pass functionality, the authors modified the standard ResNet18 into the GradResNet. Key architectural changes include:

  • Smooth Activations: Replacing ReLU with GELU to ensure well-behaved gradients for denoising.
  • Normalization Swap: Replacing BatchNorm with GroupNorm for consistency during the backward pass.
  • Bias Removal: Removing bias parameters to improve generalization across noise levels.
  • Side Connections: Adding skip-connections that mimic a UNet's decoder structure during gradient computation.
The GradResNet architecture modifies standard ResNet blocks with smooth activations, group normalization, and side connections to enable effective denoising via the backward pass.

Key Insights: Generative vs. Discriminative Trade-offs

A major contribution of this work is the theoretical link between adversarial attacks and denoising. The authors prove that the gradient used to create an adversarial attack is proportional to the difference between a class-conditional denoiser and an unconditional denoiser. An adversarial attack essentially attempts to inject specific features that shift the model's perception toward a different class.

Furthermore, the paper revisits the classic debate between generative and discriminative models. While discriminative models (standard classifiers) often achieve lower asymptotic error with massive data, generative models (like CDNs) exhibit lower variance, potentially learning more robust features with fewer samples.

Comparison of test error (KL divergence) for generative and discriminative models across linear and deep architectures as training size increases.

Results and Scaling

The CDN framework demonstrates that joint modeling can finally scale to real-world image sizes:

  • CIFAR-10: GradResNet achieved 96.3% accuracy, nearly matching standard ResNet18 (96.5%) while providing state-of-the-art denoising.
  • Efficiency: The model trained in 1.3 hours on CIFAR-10, a 27x speedup over previous JEM approaches.
  • ImageNet Scaling: Unlike previous joint models, CDNs successfully trained on full-resolution ImageNet, achieving 68.6% accuracy.
  • Robustness: The joint model showed significantly higher resistance to PGD (Projected Gradient Descent) adversarial attacks compared to standard discriminative classifiers.

Conclusion

Classification-Denoising Networks bridge the gap between discriminative and generative tasks. While the model is not yet a top-tier image generator compared to dedicated diffusion models, it offers a stable, efficient, and robust alternative for joint learning. Future work will focus on better aligning ResNet and UNet inductive biases to improve image synthesis quality and extending the framework to text-to-image settings.

Summary updated

BibTeX
@misc{thiry2024classification,
  author = {Louis Thiry and Florentin Guth},
  title = {{Classification-Denoising Networks}},
  year = {2024},
  eprint = {2410.03505},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.03505},
}
Figure