Exploring Phrase-Level Grounding with Text-to-Image Diffusion Model

Danni Yang, Ruohan Dong, Jiayi Ji, Yiwei Ma, Haowei Wang, Xiaoshuai Sun, Rongrong Ji

Introduction

While large-scale diffusion models have revolutionized image generation, their internal representations also harbor significant potential for image understanding. Most existing research focuses on sentence-level tasks, such as identifying a single object from a prompt. However, real-world scenarios often involve complex narratives. The Panoptic Narrative Grounding (PNG) task challenges models to generate precise pixel-level masks for every noun phrase in a long description (e.g., "A woman is holding a teddy bear toy..."). This requires handling context, distinguishing instances, and understanding linguistic relationships. DiffPNG is a novel framework designed to tackle this task in a zero-shot manner, leveraging the inherent knowledge of pre-trained text-to-image models like Stable Diffusion.

The DiffPNG Paradigm

Traditional PNG methods rely on fully supervised training on large annotated datasets. In contrast, DiffPNG repurposes a frozen diffusion model to perform grounding without task-specific fine-tuning. By treating the grounding process as a combination of localization and segmentation, the model can interpret complex scenes based purely on narrative text.

Comparison between the fully-supervised PNG paradigm and the proposed zero-shot diffusion-based paradigm.

Methodology

The DiffPNG pipeline consists of three main stages: Localization, Segmentation, and Refinement. The core innovation lies in how it extracts spatial information from the diffusion model's internal attention mechanisms.

Detailed architecture of the DiffPNG framework, highlighting the LSP and SMR modules.

1. Feature Extraction and Inversion

To process a real image, the framework employs Null-text Inversion. This ensures that the model's internal latent noise accurately reconstructs the original image. To handle long narrative captions, a text-splitting strategy is used with the CLIP text encoder to preserve contextual information for each phrase.

2. Locate-to-Segment Processor (LSP)

The LSP module is the core of the framework, decoupling the "where" from the "what shape":

  • Localization: Cross-attention maps are analyzed to identify "anchor points"—pixels with high correlation to specific noun phrases.
  • Segmentation: Self-attention maps are then used to propagate the influence of these anchors to neighboring pixels with similar features, forming a coherent spatial mask.

3. Subject-Focused Feature Aggregator

Noun phrases often contain multiple words (e.g., "yellow disc"). This module calculates word similarities within a phrase to ensure the primary noun (the subject) receives the highest weight, preventing adjectives from skewing the mask generation.

4. SAM-based Mask Refinement (SMR)

Since diffusion-generated masks can be noisy, the Segment Anything Model (SAM) is used as a high-resolution "polisher." SAM generates class-agnostic candidate masks, and a custom scoring system matches the diffusion-based masks to the best SAM candidates to produce final, crisp boundaries.

Evaluation and Results

The framework was evaluated on the Panoptic Narrative Grounding (PNG) dataset, which contains over 133,000 training images and 8,380 test images. Notably, as a zero-shot approach, DiffPNG was evaluated directly on the test set without any training on the PNG data.

DiffPNG established a new state-of-the-art for zero-shot performance:

  • Baseline Performance: DiffPNG achieved an Average Recall (AR) of 33.54%.
  • Refined Performance: With SAM refinement (DiffPNG), the score improved to 38.49% AR*.
  • Comparison: This significantly outperforms previous zero-shot diffusion methods like Dataset Diffusion (23.46%) and DiffSeg (24.08%).

Conclusion and Future Work

DiffPNG demonstrates that pre-trained diffusion models possess a deep, fine-grained understanding of image-text relationships. By effectively utilizing cross-attention for localization and self-attention for segmentation, the model achieves impressive zero-shot results. However, challenges remain regarding computational overhead and inference speed due to the multi-step inversion and refinement process. Future research may focus on integrating these capabilities into more efficient, unified architectures to bridge the gap with fully supervised models.

Summary updated

BibTeX
@inproceedings{yang2024exploring,
  author = {Danni Yang and Ruohan Dong and Jiayi Ji and Yiwei Ma and Haowei Wang and Xiaoshuai Sun and Rongrong Ji},
  title = {{Exploring Phrase-Level Grounding with Text-to-Image Diffusion Model}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-73668-1\_10},
}
Figure