Parametrizing filters of a CNN with a GAN

Yannic Kilcher, Gary Bécigneul, Thomas HofmannarXiv 2017

Abstract

Deep learning models, particularly Convolutional Neural Networks (CNNs), are prized for their ability to learn complex, non-linear invariances. However, these learned symmetries are often opaque, residing within the high-dimensional weight space of the network. This paper presents a novel framework that utilizes a Generative Adversarial Network (GAN) to learn a smooth parametrization of the filters in a pre-trained CNN. By training the GAN to produce filters that generate activations indistinguishable from the original model, we can visualize and manipulate the manifold of learned invariances. Our results on the MNIST dataset demonstrate that this method not only provides qualitative insights into the network's internal representations but also offers quantitative benefits through filter ensembling.

Introduction

A fundamental goal of deep learning is to achieve invariance to irrelevant transformations in input data. While translation invariance is typically baked into CNN architectures, more sophisticated invariances—such as changes in pose, lighting, or local deformations—are learned during training. These learned invariances are critical to the model's performance but are notoriously difficult to interpret. Standard visualization techniques often fail to capture the continuous nature of these transformations. This work addresses this gap by parameterizing the set of filters of a trained CNN using the latent space of a GAN, allowing for a structured exploration of the model's internal logic.

Methodology

The proposed framework aims to map a latent noise vector $z$ to a set of filters that perform functionally similar operations to the original CNN layers.

The Activation Trick

Directly training a GAN on the weights of a CNN layer is impractical due to the limited number of filters, which constitutes a "small dataset" problem. To circumvent this, the authors introduce the Activation Trick. Instead of matching raw weight values, the GAN is trained to produce filters such that the resulting activations are statistically indistinguishable from those produced by the original CNN's filters when applied to the same input data.

The proposed architecture for parameterizing CNN filters using a GAN and InfoGAN loss.

InfoGAN and Manifold Traversal

To ensure that the generator learns a diverse and meaningful distribution of filters, an InfoGAN architecture is employed. This forces the model to maximize the mutual information between a subset of the latent variables and the generated filters, preventing mode collapse.

Once the GAN is trained, the "manifold of learned invariances" can be explored via Manifold Traversal. Given a specific input image, we identify its activation profile. By traversing the GAN's latent space to obtain new filters and then using gradient descent to find an image that yields the same activation profile, we can visualize the specific transformations that the CNN considers "equivalent" for that task.

Results and Discussion

The framework was evaluated using a CNN trained on the MNIST dataset. The visualizations reveal a clear hierarchy of learned symmetries across the network's depth.

Visualizing Invariances

Early layers were found to capture low-level transformations, such as stroke thickness and local brightness shifts. As we move deeper into the network, the learned invariances become significantly more complex and non-linear, involving topological morphing of the digits.

Grids showing the manifold of learned invariances, where digits smoothly morph in shape and thickness.

Quantitative Performance

Interestingly, the GAN-parametrized filters were found to capture a "manifold" of useful filters that exceeds the performance of the original fixed weights. By replacing the original filters with an ensemble average of GAN-generated filters, the authors observed an increase in MNIST test accuracy from 97.1% to 98.2%. This suggests that the GAN acts as a powerful regularizer, capturing a broader distribution of functional filters than standard backpropagation.

Conclusion

This work introduces a robust method for interpreting and parameterizing the internal representations of CNNs. By focusing on functional similarity through activations, the GAN-based approach provides a window into the complex, non-linear invariances that drive deep learning performance. Future research will focus on scaling this method to more complex datasets and exploring its utility in automated data augmentation and transfer learning.

Summary updated

BibTeX
@misc{kilcher2017parametrizing,
  author = {Yannic Kilcher and Gary Bécigneul and Thomas Hofmann},
  title = {{Parametrizing filters of a CNN with a GAN}},
  year = {2017},
  eprint = {1710.11386},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1710.11386},
}
Figure