FreeSeg-Diff: Training-Free Open-Vocabulary Segmentation with Diffusion Models

Barbara Toniella Corradini, Mustafa Shukor, Paul Couairon, Guillaume Couairon, Franco Scarselli, Matthieu Cord

Abstract

Image segmentation traditionally relies on extensive manual annotations, limiting its scalability to open-vocabulary scenarios. FreeSeg-Diff introduces a training-free pipeline that repurposes the internal features of frozen diffusion models for zero-shot segmentation. By integrating Stable Diffusion’s spatial priors with CLIP’s semantic embeddings and BLIP-2’s scene captioning, FreeSeg-Diff achieves competitive performance on standard benchmarks like Pascal VOC and COCO without any task-specific fine-tuning.

Introduction

The challenge of image segmentation lies in the high cost of pixel-level labeling. While foundation models like CLIP have enabled open-vocabulary classification, they often lack the spatial granularity required for precise localization. Conversely, generative diffusion models (DMs) demonstrate a profound understanding of image structure. FreeSeg-Diff explores whether this "spatial intelligence" can be extracted to perform segmentation in a zero-shot manner, bypassing the need for expensive human-annotated datasets.

Methodology

The FreeSeg-Diff pipeline operates through four distinct stages using frozen, off-the-shelf models:

  1. Candidate Class Assessment: To constrain the search space, BLIP-2 generates a caption for the input image. Natural Language Processing (NLP) is then used to extract nouns, forming a localized vocabulary of candidate classes.
  2. Class-Agnostic Mask Retrieval: The image is processed through a frozen Stable Diffusion U-Net. Multiscale features are extracted from internal layers and clustered via K-Means to produce class-agnostic masks representing distinct structural regions.
  3. Mask Classification: Each region is isolated and evaluated by CLIP against the candidate vocabulary. The region is assigned the label with the highest semantic similarity.
  4. Refinement: A Conditional Random Field (CRF) is applied to sharpen mask boundaries, ensuring alignment with the original image's edges.
Detailed architecture of the FreeSeg-Diff pipeline, illustrating the integration of BLIP-2, Stable Diffusion, and CLIP.

Key Insights: Generative vs. Discriminative Features

A primary contribution of this work is the observation that features from generative models (e.g., Stable Diffusion) are superior for localization compared to discriminative models (e.g., ViT, DINO). The denoising objective in diffusion models forces the network to learn the underlying geometry and composition of objects to reconstruct them accurately.

Comparison of feature clustering across different foundation models. Generative features from Stable Diffusion (SDV1.5) show significantly better spatial coherence than discriminative counterparts.

The use of a "captioning filter" via BLIP-2 is also critical. By narrowing the potential classes to those likely present in the scene, the model significantly reduces false positives and semantic noise.

Experimental Results

FreeSeg-Diff was evaluated on Pascal VOC and COCO benchmarks. Despite being training-free, it achieved:

  • Pascal VOC: 53.27 mIoU, outperforming supervised baselines like MoCo (+19 points) and DINO (+14 points).
  • COCO: 31.01 mIoU, surpassing training-based open-vocabulary methods like ReCo by 15 points.
  • Competitive Performance: The results are comparable to weakly-supervised state-of-the-art methods, demonstrating the power of latent knowledge in foundation models.

Conclusion

FreeSeg-Diff demonstrates that pre-trained diffusion models contain rich, untapped spatial information suitable for complex vision tasks. While it currently relies on external captioners and multi-step processing, it sets a new benchmark for training-free, open-vocabulary segmentation. Future work may focus on streamlining the pipeline for real-time applications and extending the approach to instance-level segmentation.

Summary updated

BibTeX
@misc{corradini2024freeseg,
  author = {Barbara Toniella Corradini and Mustafa Shukor and Paul Couairon and Guillaume Couairon and Franco Scarselli and Matthieu Cord},
  title = {{FreeSeg-Diff: Training-Free Open-Vocabulary Segmentation with Diffusion Models}},
  year = {2024},
  eprint = {2403.20105},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.20105},
}
Figure