pip install ncut-pytorch
Ncut: Nyström Normalized Cut
Normalized Cut, a.k.a. spectral clustering, is a graphical method to analyze data grouping in the affinity eigenvector space. It has been widely used for unsupervised segmentation in the 2000s.
Nyström Normalized Cut, is a new approximation algorithm developed for large-scale graph cuts, \(O(n)\) time complexity, \(O(1)\) space complexity. Solve million-scale graph in milliseconds.
Video: Ncut applied to image encoder features from Segment Anything Model. RGB color is 3D spectral-tSNE embedding of Ncut eigenvectors.
Video: hierarchical clustering visualization @preview.ipynb
Installation
pip install -U ncut-pytorch
Quick Start
The input to Ncut is a feature tensor shaped (N, D), where N is the number of points and D is the feature dimension. If you already extracted features from a model, start here.
If you only have images and want a ready-made path, use the DINOv3 predictor. It is just a convenience wrapper around feature extraction, Ncut, and visualization.
paper in prep, Yang 2025
AlignedCut: Visual Concepts Discovery on Brain-Guided Universal Feature Space, Huzheng Yang, James Gee*, Jianbo Shi*,2024
Normalized Cuts and Image Segmentation, Jianbo Shi and Jitendra Malik, 2000