Understanding Regularization to Visualize Convolutional Neural Networks

Maximilian Baust, Florian Ludwig, Christian Rupprecht, Matthias Kohl, Stefan BraunewellarXiv 2018

Abstract

Variational methods for revealing visual concepts learned by convolutional neural networks have gained significant attention. Being based on noisy gradients obtained via back-propagation, such methods require the application of regularization strategies. We present a mathematical framework unifying previously employed regularization methods based on "demons" optimization. Within this framework, we propose a novel technique based on Sobolev gradients which can be implemented via convolutions and does not require specialized numerical treatment, such as total variation regularization. Experiments on feature inversion and activation maximization demonstrate the benefit of a unified approach, yielding sharper reconstructions and better control over reconstructed scales.

Introduction

To interpret the internal representations of CNNs, researchers often employ activation maximization (generating an image that triggers a specific neuron) or feature inversion (reconstructing an image from its internal representation). However, the highly non-linear nature of CNNs results in extremely noisy gradients. Without proper regularization, these techniques produce unintelligible "salt-and-pepper" noise rather than recognizable objects. While Gaussian blurring and Total Variation (TV) are common fixes, they suffer from over-smoothing or computational complexity. This paper introduces a unified framework that balances ease of implementation with high-quality, detailed visualizations.

Methods: Sobolev Gradients and Demons Optimization

The proposed framework is inspired by "demons" optimization from medical image registration. It categorizes regularization into two types:

  • Elastic Demons: Regularizes the image itself (the solution), leading to an exponential smoothing effect over time.
  • Fluid Demons: Regularizes only the update (the gradient) at each step, providing a more localized smoothing.

The core innovation is the use of Sobolev Gradients. By performing gradient descent in a Sobolev space ($H^1$) rather than the standard $L^2$ space, the optimization naturally follows a smoother path. This is implemented using a Sobolev Filter ($S_\gamma$), a convolution kernel that is only weakly differentiable. Unlike the infinitely differentiable Gaussian kernel, which often over-smooths results into blurry blobs, the Sobolev kernel's sharp peak allows it to suppress high-frequency noise while preserving edges and fine details.

The Sobolev kernel features a sharp peak that preserves fine details while suppressing noise, unlike the smooth dome of a Gaussian kernel.

A hybrid Fluid-Elastic approach is also proposed, combining both kernels to allow precise control over the scales of reconstructed features.

Experimental Results

The framework was evaluated on the ImageNet dataset using VGG19, ResNet50, and DenseNet121 architectures.

Qualitative Analysis

In activation maximization tasks, such as visualizing the "king crab" class, Sobolev filters produced significantly crisper details and more natural textures than Gaussian alternatives. The fluid-elastic hybrid successfully captured both fine textures and coarse global structures, such as the contextual bias of people holding the crabs found in the training data.

Comparison of regularization methods for activation maximization. Sobolev filters (top row) produce sharper, more detailed features than Gaussian filters (middle row). The hybrid fluid-elastic approach captures both fine textures and global structure.

Quantitative Evaluation

Feature inversion experiments measured how well a reconstruction from one network could be classified by another. For DenseNet121 reconstructions, the Fluid-Elastic Sobolev method achieved a 10.4% top-1 accuracy on VGG19, significantly outperforming standard Total Variation (5.9%) and Fluid Demons (4.5%).

Conclusion

By shifting the metric of gradient descent to a Sobolev space, this framework provides a simple yet powerful tool for CNN visualization. The resulting Sobolev filters are easy to integrate into existing deep learning pipelines and offer superior detail preservation and scale control compared to traditional Gaussian or Total Variation methods. Future work may explore higher-order Sobolev spaces to further refine visual quality as network architectures continue to evolve in complexity.

Summary updated

Abstract

Variational methods for revealing visual concepts learned by convolutional neural networks have gained significant attention during the last years. Being based on noisy gradients obtained via back-propagation such methods require the application of regularization strategies. We present a mathematical framework unifying previously employed regularization methods. Within this framework, we propose a novel technique based on Sobolev gradients which can be implemented via convolutions and does not require specialized numerical treatment, such as total variation regularization. The experiments performed on feature inversion and activation maximization demonstrate the benefit of a unified approach to regularization, such as sharper reconstructions via the proposed Sobolev filters and a better control over reconstructed scales.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
ImageNet-1K · ImageNet reconstruction assessment · VGG19 reconstructiofluid-elastic demons with Sobolev filterstop-1 classification score13.8%Image Classification · resolution=11x11 · subset=1000 randomly selected images per class · classifier=DenseNet121 · iterations=300 · reconstruction-layer=block5_conv1 · reconstruction-backbone=VGG19
Source quote
L250: {total variation} │ 44.0% │ 65.7% │ 5.9% │ 14.4% {fluid demons} │ 43.5% │ 67.3% │ 4.5% │ 10.4% {fluid-elastic demons} │ 13.8% │ 30.6% │ 10.4% │ 21.6%
ImageNet-1K · ImageNet reconstruction assessment · DenseNet121 reconstfluid-elastic demons with Sobolev filterstop-1 classification score10.4%Image Classification · resolution=11x11 · subset=1000 randomly selected images per class · classifier=VGG19 · iterations=300 · reconstruction-layer=conv5_block12_0_bn · reconstruction-backbone=DenseNet121
Source quote
L250: {total variation} │ 44.0% │ 65.7% │ 5.9% │ 14.4% {fluid demons} │ 43.5% │ 67.3% │ 4.5% │ 10.4% {fluid-elastic demons} │ 13.8% │ 30.6% │ 10.4% │ 21.6%
Reported baseline / comparator measurements (4)
BenchmarkMethodMetricScoreProtocol / Evidence
ImageNet-1K · ImageNet reconstruction assessment · VGG19 reconstructiototal variation regularization baselinetop-1 classification score44.0%Image Classification · resolution=11x11 · subset=1000 randomly selected images per class · classifier=DenseNet121 · iterations=300 · reconstruction-layer=block5_conv1 · reconstruction-backbone=VGG19
Source quote
L250: {total variation} │ 44.0% │ 65.7% │ 5.9% │ 14.4% {fluid demons} │ 43.5% │ 67.3% │ 4.5% │ 10.4% {fluid-elastic demons} │ 13.8% │ 30.6% │ 10.4% │ 21.6%
ImageNet-1K · ImageNet reconstruction assessment · VGG19 reconstructiofluid demons with Sobolev filters baselinetop-1 classification score43.5%Image Classification · resolution=11x11 · subset=1000 randomly selected images per class · classifier=DenseNet121 · iterations=300 · reconstruction-layer=block5_conv1 · reconstruction-backbone=VGG19
Source quote
L250: {total variation} │ 44.0% │ 65.7% │ 5.9% │ 14.4% {fluid demons} │ 43.5% │ 67.3% │ 4.5% │ 10.4% {fluid-elastic demons} │ 13.8% │ 30.6% │ 10.4% │ 21.6%
ImageNet-1K · ImageNet reconstruction assessment · DenseNet121 reconsttotal variation regularization baselinetop-1 classification score5.9%Image Classification · resolution=11x11 · subset=1000 randomly selected images per class · classifier=VGG19 · iterations=300 · reconstruction-layer=conv5_block12_0_bn · reconstruction-backbone=DenseNet121
Source quote
L250: {total variation} │ 44.0% │ 65.7% │ 5.9% │ 14.4% {fluid demons} │ 43.5% │ 67.3% │ 4.5% │ 10.4% {fluid-elastic demons} │ 13.8% │ 30.6% │ 10.4% │ 21.6%
ImageNet-1K · ImageNet reconstruction assessment · DenseNet121 reconstfluid demons with Sobolev filters baselinetop-1 classification score4.5%Image Classification · resolution=11x11 · subset=1000 randomly selected images per class · classifier=VGG19 · iterations=300 · reconstruction-layer=conv5_block12_0_bn · reconstruction-backbone=DenseNet121
Source quote
L250: {total variation} │ 44.0% │ 65.7% │ 5.9% │ 14.4% {fluid demons} │ 43.5% │ 67.3% │ 4.5% │ 10.4% {fluid-elastic demons} │ 13.8% │ 30.6% │ 10.4% │ 21.6%
BibTeX
@misc{baust2018understanding,
  author = {Maximilian Baust and Florian Ludwig and Christian Rupprecht and Matthias Kohl and Stefan Braunewell},
  title = {{Understanding Regularization to Visualize Convolutional Neural Networks}},
  year = {2018},
  eprint = {1805.00071},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1805.00071},
}

Loading related content...

Figure