Visual attribute transfer through deep image analogy

Jing Liao, Yuan Yao, Lu Yuan, Gang Hua, Sing Bing Kang

Abstract

This paper introduces Deep Image Analogy, a technique for transferring visual attributes (like color, texture, and style) between images that share semantic content but look vastly different. By finding dense correspondences in the feature space of a deep neural network rather than at the pixel level, the method enables high-quality, structure-preserving transfers across domains—such as turning a sketch into a photo or swapping styles between two different paintings.

Introduction

Visual attribute transfer—the process of moving the "look" of one image onto the structure of another—is a staple of image processing. However, traditional methods struggle when the source and target images are visually disparate. Low-level matching algorithms (like PatchMatch or optical flow) rely on color and intensity, which fail when trying to match a grayscale sketch to a colorful photograph. Conversely, early "Neural Style Transfer" methods often rely on global statistics, which can lead to "texture bleed" where artistic patterns are applied haphazardly. The core challenge is finding a semantically meaningful dense correspondence: how do we tell the computer that the "eye" in a painting corresponds to the "eye" in a photo, despite them looking nothing alike at the pixel level?

Methodology

The authors propose a "coarse-to-fine" approach that leverages the hierarchical nature of Deep Convolutional Neural Networks (specifically VGG-19).

Deep Feature Matching

Instead of matching pixels, the algorithm matches feature vectors extracted from different layers of the CNN. High-level layers capture "what" is in the image (semantics), while low-level layers capture "how" it looks (texture/color).

The Analogy Framework

They adapt the classic "Image Analogy" ($A : A' :: B : B'$) to a bidirectional setup. Given input images $A$ and $B'$, they seek to generate two latent images: $A'$ (which has the structure of $A$ and the style of $B'$) and $B$ (which has the structure of $B'$ and the style of $A$).

Coarse-to-Fine Strategy

The process starts at the highest (coarsest) layer of the network. At this level, the "features" of a photo of a cat and a painting of a cat are very similar. They compute a Nearest-Neighbor Field (NNF) using a modified version of PatchMatch in this feature space. This high-level mapping guides the search in the next, finer layer.

Feature Reconstruction

At each step, they use a deconvolutional approach to reconstruct the features of the latent images, ensuring they blend the desired structure and style before moving to the next layer.

Key Results

The authors evaluated their method using several benchmarks, including the Middlebury Optical Flow Dataset and PASCAL 3D+. On the PASCAL 3D+ dataset, Deep Image Analogy significantly outperformed baselines, achieving a Mean PCK (Percentage of Correct Keypoints) of 21.0, compared to just 4.2 for standard PatchMatch.

A real-world photo of a panda used as source content.

Qualitatively, the method produced strikingly better results in "Style-Swap" scenarios and "Photo-to-Style" transfers. As shown in the comparison between the source photo and the generated painting, local features like eyes and mouths remain crisp and correctly stylized, unlike the "messier" outputs of global neural style transfer.

A stylized panda painting generated via attribute transfer.

Discussion and Limitations

The "aha moment" is that while a painting and a photo look different to our eyes, they look very similar to the top layers of a pre-trained classification network. Using these layers as a "map" allows for structural alignment that pixel-based methods could never achieve.

However, limitations remain. The algorithm assumes the two images share the same basic components. If image A has a hat and image B' does not, the mapping for the hat region becomes unpredictable. Additionally, the current implementation does not handle large rotations or significant scale differences well, and the computational cost is relatively high (approx. 160 seconds for a 448x448 image).

Conclusion

Deep Image Analogy demonstrates success across diverse tasks: style transfer, color swap, and sketch-to-photo. By prioritizing semantics over pixels, it provides a robust framework for high-fidelity cross-domain image editing.

Summary updated

BibTeX
@article{liao2017visual,
  author = {Jing Liao and Yuan Yao and Lu Yuan and Gang Hua and Sing Bing Kang},
  title = {{Visual attribute transfer through deep image analogy}},
  journal = {ACM Trans. Graphics},
  year = {2017},
  doi = {10.1145/3072959.3073683},
}
Figure