Source-linked AI summary

InstantStyle: Free Lunch towards Style-Preserving in Text-to-Image Generation

Haofan Wang, Matteo Spinelli, Qixun Wang, Xu Bai, Zekui Qin, Anthony Chen

arXiv:2404.02733v2cs.CV

TL;DR

Style-consistent generation is hindered by style’s underdetermination, inversion-related detail loss, and adapter-based trade-offs between style strength and text control. InstantStyle decouples image style from content in feature space and injects reference features only into style-specific blocks, achieving strong stylization with improved control.

Abstract

from arXiv · show

Tuning-free diffusion-based models have demonstrated significant potential in the realm of image personalization and customization. However, despite this notable progress, current models continue to grapple with several complex challenges in producing style-consistent image generation. Firstly, the concept of style is inherently underdetermined, encompassing a multitude of elements such as color, material, atmosphere, design, and structure, among others. Secondly, inversion-based methods are prone to style degradation, often resulting in the loss of fine-grained details. Lastly, adapter-based approaches frequently require meticulous weight tuning for each reference image to achieve a balance between style intensity and text controllability. In this paper, we commence by examining several compelling yet frequently overlooked observations. We then proceed to introduce InstantStyle, a framework designed to address these issues through the implementation of two key strategies: 1) A straightforward mechanism that decouples style and content from reference images within the feature space, predicated on the assumption that features within the same space can be either added to or subtracted from one another. 2) The injection of reference image features exclusively into style-specific blocks, thereby preventing style leaks and eschewing the need for cumbersome weight tuning, which often characterizes more parameter-heavy designs.Our work demonstrates superior visual stylization outcomes, striking an optimal balance between the intensity of style and the controllability of textual elements. Our codes will be available at https://github.com/InstantStyle/InstantStyle.

1 Introduction

Style transfer is difficult because style is underdetermined and existing tuning-free methods can lose details or leak reference content. InstantStyle addresses these issues by decoupling style from content and injecting features selectively.

  • Style combines color, material, atmosphere, design, and structure, making it difficult to represent, evaluate, and transfer consistently.Source: §1 · p. 2
  • Tuning-free methods avoid costly model fine-tuning but include adapter-free and adapter-based approaches with distinct feature-injection mechanisms.Source: §1 · pp. 2–3
  • Adapter-free methods can lose texture and color during inversion, while adapter-based methods must balance style intensity against content leakage.Source: §1 · pp. 3–4
  • InstantStyle subtracts content text features from image features and injects image features only into style-specific diffusion blocks.Source: §1 · p. 4
  • The framework is tuning-free, model independent, and pluggable with attention-based feature-injection methods, while achieving strong style-transfer performance.Source: §1 · p. 4

2 Related Work

Text-to-image diffusion models generate images aligned with textual descriptions, while related customization work increasingly uses tuning-free feature injection. Attention studies motivate identifying layers associated with style and semantics.

2.1 Text-to-image Diffusion Models

  • Text-to-image diffusion models use text-conditioned cross-attention to generate high-quality images aligned with descriptions.Source: §2.1 · p. 4

2.2 Stylized Image Generation

  • Earlier stylized-generation methods fine-tuned diffusion models on shared-style image sets, which is time-consuming and difficult to generalize to real-world data.Source: §2.2 · p. 5
  • Recent tuning-free methods use lightweight adapters to extract reference-image features and inject them into diffusion models.Source: §2.2 · p. 5

2.3 Attention-based Feature Injection

  • Attention-control studies associate self-attention and cross-attention blocks with different generated attributes, including spatial layout, content, style, and semantics.Source: §2.3 · p. 5
  • InstantStyle is motivated by identifying the most style-relevant layers for disentangling content and style in style transfer.Source: §2.3 · p. 6

3 Methods

Style lacks a unified definition across images and scenes, spanning diverse visual attributes. This underdetermination makes large-scale paired style datasets difficult to collect and limits their diversity.

The definition of style is under determined.

Style degradation caused by inversion.

Inversion-based style transfer converts a reference image into a latent diffusion trajectory before generating new content. For real images, this process can be unstable and degrade fine-grained style information, while style injection also requires careful balancing.

Style degradation caused by inversion.

3.2 Observations

The observations identify a trade-off in image-condition strength: stronger style guidance can damage text control and leak content, while weaker guidance may fail to express style. Weight tuning is therefore important, though tricky and not always effective.

Subtracted CLIP’s embeddings as disentangled representation.

CLIP’s shared image-text embedding space enables content to be represented from text and removed from reference-image features, producing a disentangled style representation.

The impact of different blocks is not equal.

Attention layers capture different semantic information, and experiments identify two layers that are especially representative of style and spatial layout.

3.3 Methodology

InstantStyle decouples content and style through two compatible strategies: feature subtraction in CLIP’s shared space and selective injection into style-related attention blocks.

  • The two decoupling strategies can be used separately across different models as a tuning-free mechanism.Source: §3.3 · p. 10
  • CLIP text features represent content while CLIP image features represent the reference, allowing content subtraction from image features.Source: Separating Content from Image · pp. 10–11
  • Subtracting content text features from reference-image features explicitly decouples style and content and mitigates content leakage.Source: Separating Content from Image · p. 11
  • With SDXL’s 11 transformer blocks, the 4th and 6th blocks correspond to layout and style, respectively.Source: Figure 8 · p. 11
  • The 6th blocks usually suffice for style, while the 4th matters when layout is treated as part of style.Source: Figure 8 · p. 11

Injecting into Style Blocks Only.

InstantStyle identifies separate attention blocks for style and spatial layout, then injects image features only into style blocks to transfer style while limiting content leakage.

Style and Layout Blocks

  • The up blocks.0.attentions.1 and down blocks.2.attentions.1 layers capture style and spatial layout, respectively.The paper associates style with color, material, and atmosphere, while layout captures structure and composition.Source: Injecting into Style Blocks Only · p. 11

Style-Only Injection

  • Injecting image features only into identified style blocks enables style transfer while preventing content leakage.This design uses the localized style representation without injecting features into layout-processing blocks.Source: Injecting into Style Blocks Only · p. 12

4 Experiments

Experiments evaluate InstantStyle through qualitative generation, ControlNet-based stylization, baseline comparisons, and ablations of content subtraction and feature-injection locations.

Qualitative Results

Image-Based Stylization

Comparison to Previous Methods

  • Comparisons include StyleAlign, Swapping Self-Attention, B-LoRA, and original IP-Adapter with weight tuning.For fair comparison, previous methods use official implementations with manual weight tuning where applicable; B-LoRA is trained on a single reference image.Source: §4.2 · p. 14, Figure 12 · p. 14
  • InstantStyle achieves the best visual effect among the compared methods, although each method defines style from different perspectives.The comparison is qualitative rather than based on a unified style metric.Source: §4.2 · p. 14

Ablation Study

  • Content subtraction reduces content leakage and improves consistency with the text, but still requires manual strength tuning.Increasing subtraction intensity removes examples of leaked reference content, including balloons and white animals.Source: §4.3 · pp. 14–15, Figure 13 · p. 15
  • Injecting image features only into style blocks performs best without further strength tuning, using a fixed strength of 1.0.Injecting into both style and layout blocks can help when spatial composition is considered part of style, but may leak content for general styles.Source: §4.3 · pp. 14, 16, Figure 14 · p. 15

5 Conclusions and Future Work

The paper presents InstantStyle as a general framework for disentangling style and content through two simple techniques, with implications for consistent generation beyond stylized images.

Conclusions and Future Work

  • InstantStyle disentangles style and content from reference images using two straightforward techniques and identifies distinct roles for particular attention layers.The authors suggest that these observations can inform subsequent model training.Source: §5 · p. 16
  • Reducing parameters in adapter and LoRA approaches may mitigate overfitting and prevent leakage of unnecessary information.The paper also points to applications in other consistent-generation tasks and video generation with consistent stylistic elements.Source: §5 · p. 16
Loading 2404.02733v2…