Texture synthesis and the controlled generation of natural stimuli using convolutional neural networks

Leon A. Gatys, Alexander S. Ecker, Matthias Bethge

Abstract

This paper introduces a parametric texture model that leverages the feature spaces of pre-trained Convolutional Neural Networks (CNNs). By matching the correlations between neurons in different layers of a network, the authors synthesize highly realistic natural textures that surpass previous mathematical models. The work reveals that networks trained for object recognition implicitly learn a deep, generative "grammar" of visual appearance.

Introduction

Texture synthesis involves generating a new, larger image from a small sample that maintains the same visual characteristics. Historically, this has been approached via non-parametric resampling (copy-pasting pixels) or parametric models using handcrafted statistics. While non-parametric methods work well, they lack a formal mathematical model. Conversely, handcrafted parametric models, such as the Portilla & Simoncelli model, often fail to capture the complex, high-level structures of natural images. This paper explores whether hierarchical features learned by deep neural networks can serve as a more powerful basis for natural texture modeling.

Methodology

The authors utilize the VGG-19 network, pre-trained on ImageNet, to extract feature representations. The core of the approach is the Gram Matrix.

Overview of the texture synthesis framework using VGG-19 and Gram matrices.
  • The Representation: As an image passes through the CNN, each layer produces feature maps. The authors compute the correlations between these maps within a layer to form a Gram Matrix. This process discards spatial information while preserving the "style" or texture statistics.
  • The Synthesis: Starting with white noise, the authors use gradient descent (L-BFGS) to iteratively update the image pixels. The goal is to minimize the difference between the Gram matrices of the noise image and those of the target source texture. Unlike standard training, the network weights remain frozen; only the input pixels are modified.

Experimental Setup

The VGG-19 network was pre-trained on the ImageNet dataset (1.2 million images). For synthesis, various natural images were used, including benchmarks from the Portilla & Simoncelli set for direct comparison. Evaluation included visual inspection and testing object information preservation using the ImageNet validation set.

Key Insights

A primary finding is the hierarchical complexity of the representation. Matching low-level layers (e.g., conv1_1) results in simple color-matched noise. Including higher layers (up to pool4) allows the model to capture increasingly complex structures like edges, shapes, and eventually the "objects" within the texture, such as individual stones or berries.

This demonstrates that discriminative features are generative: a network trained to recognize objects learns a feature space rich enough to create them. Furthermore, while the Gram matrix discards global arrangement, the representation in higher layers retains enough information to identify original objects with nearly 90% accuracy.

Results

The model produces natural textures nearly indistinguishable from originals, significantly outperforming previous state-of-the-art parametric models.

Comparison of texture synthesis across different CNN layers and against the Portilla & Simoncelli model.

Quantitatively, a linear classifier trained on the Gram matrices of the pool5 layer achieved 87.7% top-5 accuracy on ImageNet, proving that texture statistics in deep networks preserve almost all high-level object information. Additionally, the model is size-agnostic, capable of generating textures at any resolution.

Limitations and Future Work

Despite its success, the method is computationally intensive compared to non-parametric techniques. It also struggles with highly regular, man-made patterns (e.g., brick grids), often "shuffling" them into organic-looking but geometrically incorrect arrangements. Future work may focus on reducing the ~852k parameters used for the model and addressing boundary artifacts caused by zero-padding in CNN layers.

Summary updated

BibTeX
@inproceedings{gatys2015texture,
  author = {Leon A. Gatys and Alexander S. Ecker and Matthias Bethge},
  title = {{Texture synthesis and the controlled generation of natural stimuli using convolutional neural networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2015},
  url = {https://openreview.net/forum?id=B1WMtLWd-r},
}
Figure