Open-Vocabulary Attention Maps with Token Optimization for Semantic Segmentation in Diffusion Models

Pablo Marcos-Manchón, Roberto Alcover-Couso, Juan C. SanMiguel, Jose M. MartínezCVPR 2024 · DOI

Abstract

Generating high-quality pixel-level annotations for synthetic images is a significant challenge in computer vision. This paper introduces OVAM (Open-Vocabulary Attention Maps), a training-free method to extract precise segmentation masks from diffusion models for any text token, even those not present in the original generation prompt. By decoupling generation and attribution and employing a novel token optimization strategy using a single annotated image, the proposed method significantly improves mask accuracy. Experimental results demonstrate that synthetic data generated via OVAM can effectively supplement real-world datasets, reducing human labeling efforts by up to 50% while maintaining state-of-the-art performance.

1. Introduction

The demand for large-scale, pixel-perfect labeled datasets for semantic segmentation—essential for applications like autonomous driving—is a major bottleneck in AI development. While Diffusion Models can generate realistic images, extracting precise masks for training remains difficult. Existing methods often suffer from a "vocabulary bottleneck," as they are typically limited to words present in the initial prompt. Furthermore, default attention maps are often blurry and imprecise, leading to low-quality training data.

This paper presents OVAM, a method that unlocks the internal spatial knowledge of diffusion models to generate masks for any word imaginable. By tapping into the model's internal attention mechanisms, researchers can now ask, "Where is the [any word]?" after an image has already been generated.

2. Methodology

The authors introduce two primary innovations to overcome current limitations in synthetic data labeling:

2.1 Open-Vocabulary Attention Maps (OVAM)

Standard diffusion models use cross-attention to link prompt words to image regions. OVAM decouples the Generator Prompt (used to create the image) from the Attribution Prompt (used to define the mask target). This allows for "post-hoc" queries, such as identifying a "mouth" on a "monkey" even if the mouth wasn't mentioned during the initial generation process.

2.2 Token Optimization

To improve the precision of these maps, the authors introduce a lightweight optimization loop. By using just a single annotated image of a target class (e.g., a car), they fine-tune the mathematical representation (embedding) of the text token via gradient descent. This "optimized token" produces significantly sharper and more accurate attention maps. This process is highly efficient, taking less than a minute on a single GPU.

Overview of OVAM: (a) Training-free open-vocabulary maps, (b) Token optimization for sharper masks, and (c) Final synthetic annotations across various categories.

Finally, the maps are refined using Self-Attention—which helps group pixels belonging to the same object—and Conditional Random Fields (dCRF) to sharpen object boundaries.

3. Experimental Results

The method was validated using several benchmarks, including VOC-sim, COCO-cap, and PASCAL VOC 2012. Key findings include:

  • Massive Accuracy Boost: For the "Grounded Diffusion" model, using optimized tokens improved the Mean Intersection over Union (mIoU) from 52.1 to 86.6 on synthetic images.
  • Reducing Human Labor: A segmentation model trained on a mix of 50% real data and 50% OVAM-synthetic data performed as well as a model trained on 100% real data, effectively cutting the required human labeling effort in half.
  • Universal Compatibility: Optimized tokens are transferable; plugging these "super-tokens" into other existing state-of-the-art methods instantly improved their performance.
Example of multi-object segmentation (window, bicycle, carpet) generated from a single prompt, demonstrating the precision of the resulting masks.

4. Conclusion

OVAM demonstrates that diffusion models possess deep, latent spatial understanding that can be unlocked with optimized text tokens. By providing a training-free, open-vocabulary approach to pixel-level annotation, this work paves the way for more efficient and scalable training of semantic segmentation models using synthetic data. Future work may extend this strategy to video segmentation or the discovery of "hidden" concepts within diffusion models that lack simple text labels.

Paper Citation: Pablo Marcos-Manchón, Roberto Alcover-Couso, Juan C. SanMiguel, and José M. Martínez. "Open-Vocabulary Attention Maps with Token Optimization for Semantic Segmentation in Diffusion Models." arXiv:2403.14291v1, 2024.

Summary updated

BibTeX
@inproceedings{marcosmanchon2024open,
  author = {Pablo Marcos-Manchón and Roberto Alcover-Couso and Juan C. SanMiguel and Jose M. Martínez},
  title = {{Open-Vocabulary Attention Maps with Token Optimization for Semantic Segmentation in Diffusion Models}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
  doi = {10.1109/cvpr52733.2024.00883},
}
Figure