FreeStyle: Free Lunch for Text-guided Style Transfer using Diffusion Models

Li Shen, Feihong He, Gang Li, Mengyuan Zhang, Leilei Yan, Lingyu Si, Fanzhang LiarXiv 2024 · DOI

Abstract

FreeStyle is a novel, training-free method for image style transfer that leverages the internal power of pre-trained diffusion models like SDXL. By employing a dual-stream encoder and modulating features in the frequency domain, it achieves high-quality stylization based solely on text prompts. This approach eliminates the need for style reference images or time-consuming model fine-tuning, providing a "free lunch" for efficient artistic generation.

Introduction

Image style transfer—the process of applying the aesthetic of one image to the content of another—has evolved from simple texture synthesis to complex deep learning approaches. However, current diffusion-based methods face significant hurdles. Most require "inversion" (finding the exact noise that generates a specific image) or "fine-tuning" the model on a specific style, both of which involve thousands of iterations and significant GPU time. Furthermore, many tools are reference-dependent, requiring a physical "style image" to function. FreeStyle addresses these issues by utilizing the inherent knowledge inside large pre-trained diffusion models to perform style transfer instantly using only a text description.

Comparison with Existing Methods

Traditional diffusion-based style transfer typically falls into two categories: finetune-based and inversion-based methods. As shown in Figure 1, these methods require either a collection of style images to train the model or a complex inversion process to map a style to a specific text token. In contrast, FreeStyle (c) directly takes a content image and a text prompt (e.g., 'Oil Painting') to produce the stylized output without any additional training or reference images.

Comparison of FreeStyle with traditional finetune-based and inversion-based style transfer methods.

Methodology

The core of FreeStyle is a structural modification to the standard U-Net used in diffusion models, designed to decouple content from style without altering the model's weights.

Dual-Stream Encoder

Instead of a single input, FreeStyle uses two parallel encoder branches with shared parameters. One branch processes the original content image ($x_0$), while the other processes a noisy version of the image ($x_\sigma$) guided by a style text prompt.

Feature Modulation Module (FMM)

The Feature Modulation Module is the primary mechanism for stylization. The authors observed that low-frequency signals usually represent layout and content, while high-frequency signals represent texture and style.

  • Content Modulation: The variance of content features is amplified to ensure the structural integrity of the original image is preserved.
  • Style Modulation: Style features are transformed into the frequency domain using a Fourier Transform. The module filters out low-frequency "content" noise and uses a scaling factor ($s$) to boost the high-frequency "style" signals before converting them back to the spatial domain.

Single-Stream Decoder

The modulated features from both streams are fused and fed into a standard decoder to reconstruct the final stylized image, ensuring the output respects both the original structure and the new artistic style.

Key Insights and Results

The researchers evaluated FreeStyle using a diverse set of 202 content images and 10 distinct styles, including "Chinese Ink," "Studio Ghibli," and "Cyberpunk."

  • Zero Optimization: Because it uses the intrinsic style reconstruction ability of models like SDXL, the training cost is zero. It works out of the box without any iterations.
  • Aesthetic Quality: FreeStyle achieved a state-of-the-art (SOTA) CLIP Aesthetic Score of 6.3148, outperforming methods like CLIPstyler and InST. In qualitative user preference tests, FreeStyle's results were preferred 32% more often than the next best competitor.
  • Structural Integrity: By operating in the frequency domain, the method avoids common artifacts like "halo effects" or blurry textures, maintaining sharp structural lines while applying complex artistic textures.

Limitations and Future Work

While FreeStyle offers a significant efficiency boost, the balance between content and style currently relies on manual hyperparameter tuning ($b, s, \sigma$). Future research aims to develop a parameter-adaptive version of FreeStyle that can automatically calculate optimal scaling factors based on input complexity, making the process truly "one-click."

Reference: He, F., Li, G., et al. (2024). FreeStyle: Free Lunch for Text-guided Style Transfer using Diffusion Models. Preprint submitted to Pattern Recognition.

Summary updated

BibTeX
@misc{shen2024freestyle,
  author = {Li Shen and Feihong He and Gang Li and Mengyuan Zhang and Leilei Yan and Lingyu Si and Fanzhang Li},
  title = {{FreeStyle: Free Lunch for Text-guided Style Transfer using Diffusion Models}},
  year = {2024},
  eprint = {2401.15636},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2401.15636},
}
Figure