An Empirical Study into Clustering of Unseen Datasets with Self-Supervised Encoders

Scott C. Lowe, Joakim Bruslund Haurum, Sageev Oore, Thomas B. Moeslund, Graham W. Taylor

TL;DR

This paper investigates how well self-supervised learning (SSL) models, trained on ImageNet, can cluster images from entirely new datasets without any further training. They find that SSL encoders excel at clustering data that's far from their training domain, outperforming traditional supervised models, and that manifold-based dimensionality reduction (like UMAP) is crucial for effective clustering.

What Problem Does This Paper Address?

The promise of self-supervised learning (SSL) is to create powerful, general-purpose feature extractors that can be reused across various tasks and datasets without extensive retraining. While SSL has shown great success in tasks like image classification after fine-tuning, there's less understanding of how well the raw embeddings from SSL models perform on downstream tasks, especially clustering, when applied to completely unseen datasets. This is crucial because fine-tuning can be computationally expensive and requires labeled data, which might not be available for new, custom datasets. The authors aim to bridge this gap by empirically evaluating the clustering capabilities of SSL encoders on a diverse set of unseen datasets.

Methods

The core of this work involves using pre-trained image encoders (both supervised and self-supervised) and applying them to new datasets. The key steps are:

  • Feature Extraction: Pre-trained encoders (ResNet-50 and ViT-B backbones) trained on ImageNet-1k using various SSL methods (MoCo-v3, DINO, VICReg, MAE) and one supervised method (cross-entropy) are used.
  • Dimensionality Reduction: Before clustering, embeddings are often reduced in dimensionality. The authors compare PCA, UMAP, and PaCMAP, finding UMAP to be generally superior for pre-trained SSL embeddings.
  • Clustering: Several classical clustering algorithms are employed: K-Means, Spectral Clustering, Agglomerative Clustering (AC), Affinity Propagation (AP), and HDBSCAN.
  • Evaluation: Clustering performance is measured using Adjusted Mutual Information (AMI) against ground truth labels. The silhouette score is also used as a proxy for clustering quality when ground truth is unavailable.

Datasets

The study uses a diverse set of datasets for evaluation, categorized by their relationship to the ImageNet-1k training domain:

  • In-Domain (ID): ImageNet-1k, ImageNet-v2, CIFAR-10, CIFAR-100, ImageNet-9 originals.
  • Domain-Shift (DS): ImageNet-9 FG-only, ImageNet-9 MixRand, ImageNet-R, ImageNet-Sketch.
  • Near-Out-of-Domain (Near-OOD): ImageNet-O, LSUN, Places365.
  • Fine-grained Near-Out-of-Domain (FG): FGVC Aircraft, Stanford Cars, Oxford Flowers, BIOSCAN-1M, NABirds, iNaturalist-2021.
  • Far-Out-of-Domain (Far-OOD): CelebA, UTKFace, BreakHis, DTD, EuroSAT, MNIST, FashionMNIST, SVHN.

The encoders were trained solely on ImageNet-1k.

Key Insights and Ideas

  • SSL for Out-of-Domain Clustering: SSL encoders shine when applied to datasets significantly different from their training data (Far-OOD), often outperforming supervised encoders. This suggests SSL learns more generalizable features.
  • Supervised for In-Domain: Conversely, supervised encoders tend to perform better on datasets very similar to their training data (In-Domain, Domain-Shift).
  • UMAP is Key: Manifold-based dimensionality reduction, particularly UMAP, is essential for achieving good clustering performance with SSL embeddings. Linear methods like PCA are less effective for these rich embeddings.
  • Silhouette Score as a Proxy: The silhouette score, especially when measured on UMAP-reduced embeddings, is highly correlated with AMI and can serve as a reliable proxy for clustering quality when ground truth labels are unavailable.
  • Background vs. Foreground: SSL encoders seem to be more influenced by background-foreground disparity compared to supervised models, potentially due to their instance-learning objective.

Key Results

  • Clustering Performance: SSL encoders generally outperform supervised encoders on datasets that are further away from ImageNet-1k. For example, on Far-OOD datasets, SSL encoders show a significant advantage.
  • Fine-tuning Trade-off: Fine-tuning SSL encoders on ImageNet-1k improves performance on in-domain and domain-shifted datasets but can degrade performance on Far-OOD datasets.
  • Clustering Method Performance: Agglomerative Clustering (AC) with a specified number of clusters (AC w/ C) generally performed best, though the differences between top clusterers were often small. HDBSCAN performed worst due to its noise handling.
  • UMAP Effectiveness: UMAP-reduced embeddings consistently led to better clustering results for most encoders and clusterers, with minimal sensitivity to the exact number of dimensions (5-200).
  • Correlation with kNN: Clustering performance (AMI) shows a moderate positive correlation with kNN accuracy, suggesting it's an orthogonal but related measure of encoder quality.

Limitations and Future Work

  • ImageNet-1k Focus: The study is limited to encoders pre-trained on ImageNet-1k. Future work could explore generalization to models trained on other large datasets.
  • Single Modality: The research is confined to vision data. Extending to other modalities would be valuable.
  • Architecture Capacity: Comparing ResNet-50 and ViT-B without controlling for capacity makes direct architectural comparisons difficult.
  • Untrained Networks: The behavior of untrained or partially trained networks was not fully explored, though preliminary findings suggest they are less amenable to clustering.

The authors suggest future work could investigate the reverse transfer (pre-training on other datasets and clustering ImageNet-1k) and explore clustering in other domains.

Summary updated

BibTeX
@article{lowe2026empirical,
  author = {Scott C. Lowe and Joakim Bruslund Haurum and Sageev Oore and Thomas B. Moeslund and Graham W. Taylor},
  title = {{An Empirical Study into Clustering of Unseen Datasets with Self-Supervised Encoders}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2026},
}
Figure