Source-linked AI summary

Dense Text-to-Image Generation with Attention Modulation

Yunji Kim, Jiyoung Lee, Jin-Hwa Kim, Jung-Woo Ha, Jun-Yan Zhu

arXiv:2308.12964v1cs.CVcs.GRcs.LG

TL;DR

Dense-caption generation remains difficult because models may omit or blend objects, and text alone offers limited layout control. DenseDiffusion analyzes intermediate attention maps and modulates them during generation without fine-tuning, improving textual and layout fidelity while achieving comparable qualitative layout control to specially trained models.

  • Problem

    Existing text-to-image models often omit or blend objects in dense captions, while text prompts alone provide limited precise scene-layout control.

    Source: §1 · p. 2
  • Method

    DenseDiffusion is a training-free method that modulates a pretrained model’s intermediate attention maps according to caption segments and layout masks.

    Source: §1 · p. 2, §3 · p. 3
  • Results

    DenseDiffusion improves Stable Diffusion, outperforms several compositional diffusion models across textual, layout, and image-quality evaluations, and achieves comparable qualitative layout control to trained models.

    Source: §1 · p. 2, §5 · p. 9
  • Takeaways & Limitations

    Attention modulation enables a pretrained text-to-image model to reflect dense textual and spatial conditions without fine-tuning.

    Source: §1 · p. 2, §5 · p. 9

    Performance depends on Stable Diffusion’s capacity, and fine-grained masks with thin structures remain difficult to follow.

    Source: §5 · p. 9

Abstract

from arXiv · show

Existing text-to-image diffusion models struggle to synthesize realistic images given dense captions, where each text prompt provides a detailed description for a specific image region. To address this, we propose DenseDiffusion, a training-free method that adapts a pre-trained text-to-image model to handle such dense captions while offering control over the scene layout. We first analyze the relationship between generated images' layouts and the pre-trained model's intermediate attention maps. Next, we develop an attention modulation method that guides objects to appear in specific regions according to layout guidance. Without requiring additional fine-tuning or datasets, we improve image generation performance given dense captions regarding both automatic and human evaluation scores. In addition, we achieve similar-quality visual results with models specifically trained with layout conditions.

1. Introduction

Dense captions often cause text-to-image models to omit or blend objects, while text prompts alone provide limited precise control over scene layout. DenseDiffusion addresses these issues with training-free attention modulation and improves fidelity across textual, layout, and image-quality evaluations.

  • Dense captions describe specific image regions, but existing models often omit or blend visual features from different objects.Source: §1 · p. 2
  • Text prompts alone make precise control over generated scene layouts difficult.Source: §1 · p. 2
  • Training or fine-tuning layout-conditioned models is computationally expensive and may require retraining for each new user.Source: §1 · p. 2
  • DenseDiffusion analyzes intermediate self- and cross-attention maps, then modulates them on the fly according to layout conditions without training.Source: §1 · p. 2
  • DenseDiffusion improves Stable Diffusion and outperforms several compositional diffusion models across textual, layout, and image-quality conditions.Source: §1 · p. 2

2. Related work

Related work spans text-to-image diffusion, training-free compositional methods, and spatial-control systems. DenseDiffusion builds on attention-based editing and modulation while targeting faithful dense-caption and layout conditioning without fine-tuning.

Text-to-Image Diffusion Models

  • Text-to-image diffusion models synthesize diverse photorealistic images and support flexible editing through interactions between intermediate image and textual features.Source: §2 · p. 2
  • Prompt-to-Prompt, Plug-and-Play, and pix2pix-zero manipulate or reuse attention and spatial features to preserve structure or align edited generations.Source: §2 · p. 2

Compositional Diffusion Methods

  • Composable Diffusion, MultiDiffusion, Attend-and-Excite, and Structure Diffusion address dense captions with training-free denoising, attention, or noise optimization strategies.Source: §2 · p. 2
  • Paint-with-words increases cross-attention for segmented objects, but existing compositional methods can fail to reflect text and layout conditions faithfully.Source: §2 · p. 2

Image Synthesis with Spatial Control

  • Spatial-control approaches include data-driven systems, domain-limited conditional GANs, and methods that add spatial modulation to pretrained diffusion models.Source: §2 · pp. 2–3
  • Several concurrent works also investigate training-free spatial control for diffusion models.Source: §2 · p. 3

3. Method

DenseDiffusion represents captions as region-linked segments and modulates Stable Diffusion’s cross- and self-attention maps during denoising. Its modulation preserves the pretrained model’s behavior while adapting strength to attention ranges, segment areas, and timestep.

3. Method

  • Each segment (c_n, m_n) pairs a nonoverlapping caption phrase with a binary map for one image region.Source: §3 · p. 3

3.1. Preliminaries

  • Stable Diffusion generates images through successive denoising steps from random noise, using a timestep-dependent noise-prediction network.Source: §3.1 · p. 3
  • Matched keys consistently receive higher mean and maximum attention than unmatched keys in both cross- and self-attention analyses.Source: Table 1 · p. 3
  • Attention maps are computed as softmax(QK^T / sqrt(d)), where Q and K are query and key values derived from intermediate and context features.Source: §3.1 · p. 3

3.2. Layout-guided Attention Modulation

  • Cross-attention modulation increases scores between image tokens and text tokens assigned to the same segment region.Source: §3.2 · p. 4
  • Self-attention modulation increases within-segment communication and decreases communication between different segments to reduce feature mixing.Source: §3.2 · p. 4
  • The modulation accounts for original attention ranges, segment areas, and timestep by using Mpos, Mneg, S, and λ_t.Source: §3.2 · pp. 4–5

4. Experiments

Experiments evaluate DenseDiffusion on dense-caption fidelity and layout control using automatic metrics, user studies, visual comparisons, and ablations. The method achieves stronger condition fidelity than training-free baselines and comparable or better layout adherence than trained layout-conditioned models.

Textual Fidelity

  • DenseDiffusion achieves the best performance on textual-condition automatic metrics and user studies.Table 2 reports the highest results for both automatic evaluation and human preference.Source: Table 2 · p. 5, §4.2 · p. 6

Layout Fidelity

  • 63% of AMT participants prefer DenseDiffusion over SD-Pww for fidelity to layout conditions.SD-Pww is the only baseline evaluated with segmentation-map layout control, and DenseDiffusion also achieves substantially higher IoU scores.Source: Table 3 · p. 5, §4.2 · p. 6

Evaluation Setting

  • The evaluation compares dense-caption fidelity and layout alignment using CLIP-Score, SOA-I, IoU, and human preference studies.The dataset contains 250 MS-COCO samples with two or more unique objects, generating four images per caption for each baseline.Source: §4.1 · pp. 5–6

Layout Fidelity

  • DenseDiffusion aligns more closely with input masks than SD-Pww while using the same dense caption and remaining training-free.Among the compared Stable Diffusion-based methods, only SD-Pww and DenseDiffusion support segmentation-map layout control.Source: Figure 4 · p. 6, §4.2 · p. 6

Comparison to Layout-Conditioned Models

  • DenseDiffusion adheres to layout conditions comparably to SpaText and outperforms MAS in many visual comparisons despite requiring no layout-specific training.MAS and SpaText are trained for layout control, whereas DenseDiffusion and SD-Pww use pre-trained Stable Diffusion models without training.Source: Figure 5 · p. 7, §4.2 · p. 7

Ablation Study

  • Ablations show that removing attention-modulation components generally reduces metric scores, with cross-attention modulation producing the largest degradation when omitted.Value-range adaptation also improves fidelity, while mask-area adaptation can produce monotonous backgrounds that help segmentation metrics without always satisfying textual conditions.Source: §4.2 · pp. 7–9

5. Conclusion

DenseDiffusion is a training-free method for improving dense-caption fidelity and controlling image layout, with results comparable to models specifically trained for layout control. Its effectiveness remains bounded by the base model’s object-generation capacity and coarse attention resolution for thin structures.

  • DenseDiffusion improves fidelity to dense captions and enables image layout control without training.Source: §5 · p. 9
  • Comparable layout control is achieved relative to models specifically trained for this task.Source: §5 · p. 9
  • The method depends on Stable Diffusion’s capacity to generate the requested objects.It fails to produce objects that Stable Diffusion cannot generate itself, such as a juggling bear.Source: §5 · p. 9
  • Fine-grained masks with thin structures remain difficult because the attention layers are fairly coarse.The method can fail to follow details such as the shape of leaves.Source: §5 · p. 9

A. Additional Comparison

Additional qualitative results evaluate concurrent methods on six dense captions, combining MS-COCO examples with captions curated by the authors.

  • Six dense captions are used for additional qualitative comparison.Three captions come from MS-COCO, while three are curated by the authors.Source: A. Additional Comparison · p. 12

A.1. Baselines

The baselines address object omission, mixed object features, and limited spatial control, using Stable Diffusion as their implementation or fine-tuning base.

  • The baselines target object omission, mixed visual features, and the lack of spatial controls in pretrained text-to-image models.Source: §A.1 · p. 12
  • Attend-and-Excite and Universal-Guided-Diffusion modify inference with additional objectives, but Attend-and-Excite does not support layout conditions.Universal-Guided-Diffusion uses an off-the-shelf MobileNetV3 segmentation network for additional guidance.Source: §A.1 · p. 12

A.2. Results

Qualitative comparisons show DenseDiffusion more faithfully follows textual and layout conditions than several alternative methods, while other methods exhibit recognizable failure modes.

  • DenseDiffusion is more effective than SD-Pww and Structure Diffusion at following textual and layout conditions.Figures 9–11 use curated prompts, while Figures 12–14 use MS-COCO prompts.Source: §A.2 · p. 12
  • MultiDiffusion reflects objects accurately but often produces collage-like results because its independent denoising processes lack interaction.Source: §A.2 · p. 12
  • Composable Diffusion, Attend-and-Excite, and Universal-Guided-Diffusion often fail to follow the conditions and tend to generate unrealistic images.Source: §A.2 · p. 12
  • The qualitative comparisons include methods marked † that receive textual condition only.Source: Figure 9 · p. 13, Figure 10 · p. 14, Figure 11 · p. 15
Loading 2308.12964v1…