Diffuse, Attend, and Segment: Unsupervised Zero-Shot Segmentation using Stable Diffusion

Junjiao Tian, Lavisha Aggarwal, Andrea Colaco, Z. Kira, Mar González-Franco
2/14/2026

No official code found. Best implementation: google/diffseg (330 stars, MIT, last commit 2024-07-09). 1 more below.

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 transfer 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 anno-tations is still challenging. In this paper, we propose to uti-lize 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 ef-fective iterative merging process based on measuring KL divergence among attention maps to merge them into valid segmentation masks. The proposed method does not re-quire any training or language dependency to extract qual-ity segmentation for any images. On COCO-Stuff-27, our method surpasses the prior unsupervised zero-shot trans-fer SOTA method by an absolute 26% in pixel accuracy and 17% in mean IoU. The project page is at https://sites.google.com/view/diffseg/home.11Georgia Institute of Technology

View on arXivView PDF

Code Implementations(2)

google/diffsegCommunity100%
MIT

DiffSeg is an unsupervised zero-shot segmentation method using attention information from a stable-diffusion model. This repo implements the main DiffSeg algorithm and additionally includes an experimental feature to add semantic labels to the masks based on a generated caption.

33028Python, Jupyter NotebookNov 22, 20232 years agoMIT
computer-visionsegmentationstable-diffusion
MIT

Unofficial pytorch implementation of DiffSeg (Diffuse attend and segment: Unsupervised zero-shot segmentation using stable diffusion)

10Python, Jupyter NotebookJun 22, 20251 years agoMIT

Similar Papers

Cite this paper

@article{tian2026diffuse,
  title  = {Diffuse, Attend, and Segment: Unsupervised Zero-Shot Segmentation using Stable Diffusion},
  author = {Junjiao Tian and Lavisha Aggarwal and Andrea Colaco and Z. Kira and Mar González-Franco},
  year   = {2026},
  eprint = {2308.12469},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/pdf/2308.12469},
  journal = {CVPR 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2308.12469.svg)](https://codeofpaper.com/paper/2308.12469)

Discussion