Every Filter Extracts A Specific Texture In Convolutional Neural Networks

Zhiqiang Xia, Ce Zhu, Zhengtao Wang, Qi Guo, Yipeng LiuarXiv 2016

Abstract: Many works have concentrated on visualizing and understanding the inner mechanism of convolutional neural networks (CNNs) by generating images that activate some specific neurons, which is called deep visualization. However, it is still unclear what the filters extract from images intuitively. In this paper, we propose a modified code inversion algorithm, called feature map inversion, to understand the function of filter of interest in CNNs. We reveal that every filter extracts a specific texture. The texture from higher layer contains more colours and more intricate structures. We also demonstrate that style of images could be a combination of these texture primitives. Two methods are proposed to reallocate energy distribution of feature maps randomly and purposefully. Then, we inverse the modified code and generate images of diverse styles. With these results, we provide an explanation about why Gram matrix of feature maps could represent image style.

Introduction

Despite the massive success of Convolutional Neural Networks (CNNs) in computer vision, they are often criticized as "black boxes." Researchers have long used "deep visualization" to peek inside, but most methods focus on what a single neuron likes (activation maximization) or what an entire layer sees (code inversion). This paper identifies a specific gap: we didn't truly know what an individual filter—the fundamental building block of a convolutional layer—was trying to capture from a specific image. Understanding this is crucial for demystifying how networks represent complex concepts like "style" and for designing more efficient architectures.

Methodology: Feature Map Inversion

The researchers propose a novel approach called Feature Map Inversion (FMI). It builds on classical "code inversion," which tries to find an image that produces a specific set of internal activations.

  1. Isolating the Filter: To see what a specific filter $l$ is doing, they take the activations of a layer (the "code") and modify them. They amplify the feature map of the filter of interest and zero out all other feature maps in that layer.
  2. Reconstruction: They then run an optimization process to generate a synthetic image that would produce this modified code.
Isolating a single filter's feature map (orange) within a layer's activation volume for inversion.
  1. Style Manipulation: They also introduce two variations to test their "style as texture" hypothesis:
  2. Randomly Modified Code Inversion: They randomly reallocate the "energy" (sum of activations) across different filters to see how the style of a reconstructed image changes.
  3. Purposefully Modified Code Inversion (PMCI): They take the energy distribution from a famous painting and apply it to the feature maps of a content image to perform style transfer.

Key Insights: Filters as Texture Primitives

The most significant finding is that every filter extracts a specific, repeatable texture. A CNN doesn't just look for "edges"; it looks for a library of textures that build upon one another.

There is a clear complexity gradient across the network hierarchy. Filters in lower layers (e.g., relu1_2) extract simple, monotonous textures and basic colors. As you move deeper into the network (e.g., relu5_2), the filters extract increasingly intricate, multi-colored, and structurally complex textures.

Hierarchical texture primitives extracted by individual filters (0-4) across different layers (relu1_2 to relu5_2) for the Golden Gate Bridge image.

Understanding Style and Gram Matrices

The authors argue that the "style" of an image is essentially the specific weighted combination of these hierarchical texture primitives. This provides a theoretical grounding for why the Gram matrix is so effective in style transfer methods (like Gatys et al.). The Gram matrix effectively captures the energy distribution and correlations between these texture-extracting filters.

Using PMCI, the authors were able to generate stylized images that are visually comparable to state-of-the-art methods, confirming that simply matching the "energy" or activation levels of specific filters is enough to transfer the "feel" of an artwork.

Conclusion and Limitations

While the paper explains what filters see, it doesn't provide a quantitative framework for deciding which filters are "better" for specific tasks. Additionally, like many inversion-based visualization methods, the generated images can be noisy or contain artifacts.

However, this texture-centric view suggests that we might be able to design more efficient architectures by specifically targeting these texture primitives or pruning redundant filters that capture overlapping textures. Future work could explore how these findings apply to non-convolutional architectures like Transformers.

Summary updated

BibTeX
@misc{xia2016every,
  author = {Zhiqiang Xia and Ce Zhu and Zhengtao Wang and Qi Guo and Yipeng Liu},
  title = {{Every Filter Extracts A Specific Texture In Convolutional Neural Networks}},
  year = {2016},
  eprint = {1608.04170},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1608.04170},
}
Figure