Skip to main content
QUICK REVIEW

[Paper Review] Diffuse, Attend, and Segment: Unsupervised Zero-Shot Segmentation using Stable Diffusion

Junjiao Tian, Lavisha Aggarwal|arXiv (Cornell University)|Aug 23, 2023
Domain Adaptation and Few-Shot LearningComputer Science9 citations
TL;DR

DiffSeg exploits self-attention in a pre-trained Stable Diffusion model to produce segmentation masks in an unsupervised zero-shot manner without any training, achieving state-of-the-art results on COCO-Stuff-27 and competitive results on Cityscapes.

ABSTRACT

Producing quality segmentation masks for images is a fundamental problem in computer vision. Recent research has explored large-scale supervised training to enable zero-shot segmentation on virtually any image style and unsupervised training to enable segmentation without dense annotations. However, constructing a model capable of segmenting anything in a zero-shot manner without any annotations is still challenging. In this paper, we propose to utilize the self-attention layers in stable diffusion models to achieve this goal because the pre-trained stable diffusion model has learned inherent concepts of objects within its attention layers. Specifically, we introduce a simple yet effective iterative merging process based on measuring KL divergence among attention maps to merge them into valid segmentation masks. The proposed method does not require any training or language dependency to extract quality segmentation for any images. On COCO-Stuff-27, our method surpasses the prior unsupervised zero-shot SOTA method by an absolute 26% in pixel accuracy and 17% in mean IoU. The project page is at \url{https://sites.google.com/view/diffseg/home}.

Motivation & Objective

  • Investigate whether self-attention in pre-trained Stable Diffusion contains object grouping signals suitable for segmentation without annotations.
  • Develop a post-processing pipeline that can convert attention maps into coherent segmentation masks without training.
  • Demonstrate zero-shot performance on standard benchmarks and compare to prior unsupervised methods.

Proposed method

  • Extract self-attention tensors from unconditioned Stable Diffusion runs on real images.
  • Aggregate multi-resolution attention maps into a high-resolution representation.
  • Iteratively merge attention maps using KL divergence to form object-proposal masks without pre-specifying the number of masks.
  • Apply non-maximum suppression across proposals to produce a final pixel-wise segmentation mask.
  • Evaluate using pixel accuracy (ACC) and mean IoU (mIoU) with Hungarian matching to ground-truth masks.
Figure 1 : Overview of DiffSeg. DiffSeg is an unsupervised and zero-shot segmentation algorithm using a pre-trained stable diffusion model. Starting from $M\times M$ anchor points, DiffSeg iteratively merges self-attention maps from the diffusion model for $N$ iterations to segment any image without
Figure 1 : Overview of DiffSeg. DiffSeg is an unsupervised and zero-shot segmentation algorithm using a pre-trained stable diffusion model. Starting from $M\times M$ anchor points, DiffSeg iteratively merges self-attention maps from the diffusion model for $N$ iterations to segment any image without

Experimental results

Research questions

  • RQ1Can self-attention in a pre-trained Stable Diffusion model reveal intrinsic object/groupings sufficient for segmentation without prompts or training?
  • RQ2Is it possible to produce high-quality segmentation masks from unconditional diffusion attention through simple post-processing?
  • RQ3How does DiffSeg perform in zero-shot segmentation benchmarks compared to existing unsupervised methods?

Key findings

  • DiffSeg achieves state-of-the-art results on COCO-Stuff-27 in unsupervised zero-shot segmentation, surpassing prior SOTA by 26 percentage points in pixel accuracy and 17 percentage points in mean IoU.
  • DiffSeg operates without language dependence or auxiliary images and still outperforms prior methods on COCO-Stuff-27 across 320×320 and 512×512 resolutions.
  • On Cityscapes, DiffSeg is on par with or surpasses prior zero-shot methods, especially when using smaller input resolutions due to class granularity.
  • Compared to alternative unsupervised baselines (e.g., K-Means variants), DiffSeg provides more stable and higher-quality segmentation without requiring a predefined number of clusters.
  • The method demonstrates strong generalization to diverse image styles (DomainNet sketches, paintings, and real-world photos).
Figure 2 : Visualization of Segmentation Masks and Self-Attentions Tensors. Left: Overlay of segmentation and the original image. Right: Attention maps from a stable diffusion model have two properties: Intra-Attention Similarity and Inter-Attention Similarity. Maps of different resolutions have var
Figure 2 : Visualization of Segmentation Masks and Self-Attentions Tensors. Left: Overlay of segmentation and the original image. Right: Attention maps from a stable diffusion model have two properties: Intra-Attention Similarity and Inter-Attention Similarity. Maps of different resolutions have var

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.