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: Heatmap is cosine distance of eigenvectors, w.r.t the mouse pointer. details
Installation
pip install -U ncut-pytorch
Install PyTorch separately if your environment does not already provide it. Predictor examples also need torchvision, and the optional Lightning-based M-space trainer uses pytorch-lightning~=2.0.
Quick Start: Ncut with DINO Features
Quick Start: Ncut with Your Features
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