NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

DeepCut: Unsupervised Segmentation using Graph Neural Networks Clustering

Amit Aflalo, Shai Bagon, Tamar Kashti, Yonina C. Eldar · DOI

Abstract

Image segmentation is a fundamental task in computer vision. Data annotation for training supervised methods can be labor-intensive, motivating unsupervised methods. Current approaches often rely on extracting deep features from pre-trained networks to construct a graph, and classical clustering methods like k-means and normalized-cuts are then applied as a post-processing step. However, this approach reduces the high-dimensional information encoded in the features to pair-wise scalar affinities. To address this limitation, this study introduces a lightweight Graph Neural Network (GNN) to replace classical clustering methods while optimizing for the same clustering objective function. Unlike existing methods, our GNN takes both the pair-wise affinities between local image features and the raw features as input. This direct connection between the raw features and the clustering objective enables us to implicitly perform classification of the clusters between different graphs, resulting in part semantic segmentation without the need for additional post-processing steps. We demonstrate how classical clustering objectives can be formulated as self-supervised loss functions for training an image segmentation GNN. Furthermore, we employ the Correlation-Clustering (CC) objective to perform clustering without defining the number of clusters, allowing for k-less clustering. We apply the proposed method for object localization, segmentation, and semantic part segmentation tasks, surpassing state-of-the-art performance on multiple benchmarks.

Introduction

Image segmentation—the process of partitioning an image into meaningful regions—is a cornerstone of computer vision. While supervised deep learning has mastered this task, it requires massive amounts of human-annotated data, which is expensive and often unavailable in specialized fields like medical imaging.

Current unsupervised methods try to bridge this gap by extracting features from pre-trained models (like Vision Transformers) and then applying classical clustering algorithms (like $k$-means or Normalized Cuts). However, these classical solvers have a major flaw: they reduce rich, high-dimensional feature vectors into simple "affinity" scalars. In doing so, they throw away the intricate semantic information hidden in the raw features. Furthermore, many of these methods require the user to pre-define the number of clusters ($k$), which is impractical for real-world images with varying complexity.

Methodology

DeepCut introduces a "GNN-as-a-solver" approach. Instead of using a standalone mathematical solver to partition a graph, the framework utilizes a lightweight, 30k-parameter Graph Neural Network to predict cluster assignments.

GNN-Based Clustering

The process begins with a frozen, pre-trained Vision Transformer (DINO ViT). Each image patch is treated as a node in a graph. The edges between nodes are defined by the correlation between their deep features. A lightweight GNN (a single-layer GCN followed by an MLP) takes both the raw features and the adjacency matrix as input. This allows the network to leverage high-dimensional data during the grouping process.

The DeepCut pipeline: High-dimensional descriptors and an adjacency matrix are fed into a GNN to produce a segmented image.

Unsupervised Loss Functions

The GNN is trained using test-time optimization on a per-image basis. The loss functions are derived from classical graph theory:

  • Normalized Cut (N-cut): Minimizes connections between groups while maximizing connections within them.
  • Correlation-Clustering (CC): A "k-less" objective that uses negative weights (repulsion) to automatically determine the optimal number of clusters without human input.

Two-Stage Refinement

To mitigate the bias of graph cuts toward large, uniform segments, a two-stage process is employed. The model first separates the foreground from the background and then performs a second clustering step to segment the specific parts of the foreground object.

Two-stage refinement process: Initial clustering separates foreground/background, followed by a second step for detailed part segmentation.

Results and Discussion

DeepCut was evaluated across several standard benchmarks, including PASCAL VOC (localization), CUB (birds), and the Fashion Product Images Dataset (k-less clustering).

  • Localization and Segmentation: On PASCAL VOC 2012, DeepCut achieved a 72.2% CorLoc, outperforming TokenCut (72.1%). On the CUB bird dataset, it reached 78.2% mIoU, a significant improvement over previous spectral approaches (76.9%).
  • Efficiency: DeepCut is twice as fast as TokenCut, achieving a throughput of 5 images per second.
  • Semantic Consistency: Because the GNN processes actual feature vectors, it learns to associate specific patterns with specific cluster indices. This enables "semantic" segmentation across different images (e.g., consistently identifying "wing" features) without explicit labels.
  • k-less Clustering Performance: In tests on the Fashion Product Images Dataset, DeepCut achieved 99.27% classification purity when grouping items into classes without being provided the class count in advance.

Conclusion

DeepCut demonstrates that lightweight Graph Neural Networks can effectively replace classical clustering algorithms in unsupervised segmentation tasks. By optimizing directly on high-dimensional features, the method achieves superior accuracy and speed while enabling advanced capabilities like k-less clustering and semantic part segmentation. Future work may extend this approach to video segmentation and image matting.

Summary updated

BibTeX
@inproceedings{aflalo2022deepcut,
  author = {Amit Aflalo and Shai Bagon and Tamar Kashti and Yonina C. Eldar},
  title = {{DeepCut: Unsupervised Segmentation using Graph Neural Networks Clustering}},
  booktitle = {Workshops @ ICCV},
  year = {2022},
  doi = {10.1109/iccvw60793.2023.00010},
}
Figure