Abstract
Image style transfer aims to manipulate the appearance of a source image, or "content" image, to share similar texture and colors of a target "style" image. Ideally, the style transfer manipulation should also preserve the semantic content of the source image. A commonly used approach to assist in transferring styles is based on Gram matrix optimization. One problem of Gram matrix-based optimization is that it does not consider the correlation between colors and their styles. Specifically, certain textures or structures should be associated with specific colors. This is particularly challenging when the target style image exhibits multiple style types. In this work, we propose a color-aware multi-style transfer method that generates aesthetically pleasing results while preserving the style-color correlation between style and generated images. We achieve this desired outcome by introducing a simple but efficient modification to classic Gram matrix-based style transfer optimization. A nice feature of our method is that it enables the users to manually select the color associations between the target style and content image for more transfer flexibility. We validated our method with several qualitative comparisons, including a user study conducted with 30 participants. In comparison with prior work, our method is simple, easy to implement, and achieves visually appealing results when targeting images that have multiple styles.
Introduction
Since the seminal work of Gatys et al., Neural Style Transfer (NST) has relied heavily on Gram matrices to capture the "style" of an image by calculating correlations between different feature responses in a convolutional neural network (CNN). However, standard NST calculates this globally across the entire image. This global approach fails when a style image contains multiple distinct textures—for example, a painting where the sky is swirling but the grass is stippled. A global Gram matrix averages these together, resulting in a "muddy" mixture of styles applied uniformly across the content image.
To address this, we present CAMS (Color-Aware Multi-Style Transfer). CAMS explicitly correlates specific textures with specific colors, allowing for localized, multi-style results that are more aesthetically pleasing and artistically controllable without requiring tedious manual semantic segmentation masks.
Methods
CAMS uses color as a proxy for local style. The pipeline consists of three main stages:
- Palette Extraction & Mask Generation: A color palette (typically 5 colors) is extracted from both the content and style images. "Soft" masks for each color are generated using a Radial Basis Function (RBF).
- Color-Aware Style Loss: Instead of one global Gram matrix, CAMS computes a set of weighted Gram matrices. By applying the color masks to deep features (extracted from VGG-19) before calculating the Gram matrix, the model learns the specific texture associated with each color region.
- Optimization: The final image is generated by minimizing a joint loss function comprising content loss and the new color-aware style loss.
A standout feature is the interactive tool, which allows users to manually map colors—for instance, applying the texture of red paint in a style image to a blue shirt in a photograph.
Experimental Setup
The method was evaluated using diverse datasets:
- Flickr: Eight image pairs chosen for their multi-textured style images.
- FFHQ (Flickr-Faces-HQ) & WikiArt: 200 real portrait images from FFHQ were paired with 200 painting portraits from WikiArt for large-scale quantitative testing.
Key Results
CAMS demonstrates significant improvements in both quantitative metrics and qualitative appeal.
- User Preference: In a study with 30 participants, 38% of subjects rated CAMS results as "highly appealing," significantly outperforming the original Gatys NST (16%) and other state-of-the-art methods like AdaIN or LST.
- Quantitative Superiority: On the FFHQ-to-WikiArt test set, CAMS achieved a superior FID score of 119.93, indicating higher quality and more realistic style integration.
- Visual Fidelity: Qualitatively, CAMS excels at preserving distinct details. For example, it can transfer the specific stroke style of a white background in a painting specifically to a subject's white beard, rather than smearing it across the entire face.
Discussion and Conclusion
The core insight of CAMS is that color is often a sufficient proxy for semantic regions in artistic styles. By grouping textures by color, we achieve local style transfer without the overhead of object detection. While the "auto-mode" can struggle with style images of limited color range (e.g., grayscale sketches), the manual tool provides a level of artistic control that standard NST lacks. Future work may explore unsupervised texture clustering to further refine multi-style mapping beyond color associations.
Summary updated