Textual Localization: Decomposing Multi-concept Images for Subject-Driven Text-to-Image Generation

Junjie Shentu, Matthew Watson, Noura Al MoubayedarXiv 2024 · DOI

Abstract

Personalizing text-to-image models typically requires curated datasets where the target subject is isolated. When training images contain multiple objects, existing models like DreamBooth and Custom Diffusion often suffer from "identity blending," failing to distinguish between distinct concepts. We introduce Textual Localization, a novel fine-tuning approach that incorporates spatial guidance into cross-attention layers. By leveraging segmentation masks to focus the model's attention on specific regions during training, our method successfully decomposes multi-concept images. This allows for the high-fidelity generation of individual subjects in novel contexts, even when trained on cluttered or multi-object data.

Introduction

The current state-of-the-art in subject-driven text-to-image generation relies on fine-tuning models like Stable Diffusion on a small set of images representing a specific concept. However, a significant bottleneck is the requirement for "clean" training data. If a user provides images where the target subject (e.g., a specific doll) is always accompanied by another object (e.g., a green bucket), the model often conflates the two. This results in the model either learning a hybrid identity or being unable to generate one object without the other.

Textual Localization addresses this challenge by enabling models to "look" only at the target object during the learning process, effectively decomposing complex scenes into individual, manageable concepts.

Methodology: Cross-attention Guidance

The core of Textual Localization is a novel fine-tuning pipeline built upon Stable Diffusion. The primary innovation is the Cross-attention Guidance mechanism, which regulates how text tokens interact with image patches.

Overview of the Textual Localization pipeline for decomposing multi-concept images.

The authors introduce a new loss function, $L_{attn}$, which aligns the model's internal attention maps with a segmentation mask of the target object. This mask is generated automatically using Grounding DINO for object detection and SAM (Segment Anything Model) for precise segmentation. Two guidance strategies are proposed:

  1. Hard Guidance: Strictly aligns the attention map with the mask, forcing the model to focus exclusively on the target region.
  2. Soft Guidance: Penalizes attention outside the target region while allowing more flexibility within it, better preserving the semantic variety of the original text prompt.

Experimental Evaluation

The researchers evaluated Textual Localization using a self-constructed dataset of 10 novel concepts, including both single-concept and multi-concept sets (e.g., pairs like a pot and a penbag). Performance was benchmarked against DreamBooth and Custom Diffusion using metrics such as CLIP-I (image fidelity), CLIP-T (text alignment), KID (quality), and LPIPS (diversity).

Ablation studies revealed that the $W_V$ (Value) matrix in the cross-attention layers undergoes the most significant changes during fine-tuning, indicating it is the primary repository for new semantic information.

Key Results and Insights

Textual Localization demonstrates a clear advantage in handling multi-concept training data. Quantitative results show that the "Hard Guidance" variant achieves an 8.13% improvement in CLIP-I scores and a 5.85% improvement in CLIP-T scores for multi-concept generation compared to Custom Diffusion.

Example of a generated subject (doll) in a new environment with modified attributes.

Qualitatively, the model excels at concept decomposition. When trained on images containing both a doll and a bucket, Textual Localization can generate the doll alone in a new setting (as seen in Figure 2) or the bucket alone, whereas baseline models often produce merged or co-dependent objects. This interpretability is a direct result of the spatial guidance, which ensures the cross-attention maps match the physical shape of the target object.

Conclusion and Future Work

Textual Localization significantly lowers the barrier for personalizing text-to-image models by removing the need for perfectly isolated training subjects. While the model occasionally struggles with extremely fine textures or highly complex scene compositions, it represents a major step forward in concept decomposition. Future work will explore the integration of more powerful feature extractors and improved inference-time guidance to further enhance detail capture and multi-subject scene generation.

Summary updated

BibTeX
@misc{shentu2024textual,
  author = {Junjie Shentu and Matthew Watson and Noura Al Moubayed},
  title = {{Textual Localization: Decomposing Multi-concept Images for Subject-Driven Text-to-Image Generation}},
  year = {2024},
  eprint = {2402.09966},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.09966},
}
Figure