Visual Concept-driven Image Generation with Text-to-Image Diffusion Model

Tanzila Rahman, Shweta Mahajan, Hsin-Ying Lee, Jian Feng Ren, Sergey Tulyakov, Leonid Sigal

Abstract

Text-to-image (TTI) diffusion models have demonstrated impressive results in generating high-resolution images of complex and imaginative scenes. Recent personalization techniques allow these models to integrate user-illustrated concepts using a few sample images. However, generating images with multiple interacting concepts, or concepts entangled within a single illustration, remains a significant challenge. We propose a concept-driven TTI personalization framework that addresses these issues by jointly learning custom tokens and (latent) segmentation masks to disentangle concepts in user-provided images. Our approach employs an Expectation Maximization (EM)-like optimization procedure, alternating between learning custom tokens and estimating latent masks based on cross-attention maps refined via DenseCRF. We demonstrate that this joint refinement leads to superior concept learning and high-quality latent masks, enabling the combination of three or more entangled concepts in complex generated scenes.

Introduction

Current text-to-image (TTI) models, such as Stable Diffusion, excel at generating general objects but require specialized techniques to recognize specific, user-defined subjects—a process known as personalization. Traditionally, this requires multiple clean images of a single subject. The challenge intensifies when a user wishes to extract multiple distinct concepts from a single source image, such as a specific individual standing in a unique environment.

Existing personalization methods often struggle with "entanglement," where features from one concept (e.g., the subject) bleed into another (e.g., the background). To solve this, users typically have to provide manual, pixel-perfect masks. This paper introduces an automated framework that disentangles multiple interacting subjects and their environments from minimal source imagery without requiring manual human labeling.

Methodology

The core of the proposed framework is an EM-style Optimization Framework that treats the spatial locations of concepts as latent (hidden) variables. The process iterates through two primary stages:

  1. The E-step (Mask Extraction): The model analyzes the internal cross-attention maps of the latent diffusion model to identify which pixels correspond to specific tokens. Since raw attention maps are often coarse and noisy, the framework employs DenseCRF (Conditional Random Fields) to refine boundaries, producing clean binary masks that align with the actual object shapes.
  2. The M-step (Token Optimization): Using the refined masks, the model optimizes unique text tokens (e.g., [v1] for a person, [v3] for a background). This is guided by two loss functions: a Masked Diffusion Loss, which restricts token learning to the assigned mask region, and a Cross-Attention Loss, which ensures the model's focus remains on the correct spatial area.
The framework learns latent masks to isolate distinct concepts like subjects and backgrounds during the optimization process.

This iterative refinement creates a virtuous cycle: as tokens become more representative of the concepts, the generated masks become more accurate, which in turn further improves token training.

Results and Evaluation

The approach was evaluated quantitatively using the MS-COCO dataset, testing 120 concepts across 11 object classes. The proposed method demonstrated superior performance in CLIP similarity (alignment between text and image) and LPIPS diversity compared to existing baselines like Break-A-Scene.

Qualitative comparison showing our approach's ability to disentangle concepts and generate complex interactions compared to Dreambooth and Break-a-scene.

In a forced-choice user study, participants preferred this method 71.8% of the time over baselines for its faithfulness to original concepts and adherence to complex prompts. Qualitatively, the model successfully manages interactions between up to four distinct concepts—such as placing two specific people in a specific new environment—without the "ghosting" effects or feature bleeding common in standard personalization models.

Discussion and Conclusion

By automating the disentanglement of concepts through latent masking, this framework significantly reduces the manual effort required for high-fidelity personalization. While the iterative optimization (approx. 400 steps) is slower than encoder-based methods, the resulting ability to handle complex, multi-concept scenes is a major advancement. Future work may explore scaling this approach to even larger numbers of concepts and extending the latent masking logic to video generation and 3D scene composition.

Summary updated

BibTeX
@misc{rahman2024visual,
  author = {Tanzila Rahman and Shweta Mahajan and Hsin-Ying Lee and Jian Feng Ren and Sergey Tulyakov and Leonid Sigal},
  title = {{Visual Concept-driven Image Generation with Text-to-Image Diffusion Model}},
  year = {2024},
  eprint = {2402.11487},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.11487},
}
Figure