Zero-shot Clustering of Embeddings with Pretrained and Self-Supervised Learnt Encoders

Scott C Lowe, Joakim Bruslund Haurum, Sageev Oore, Thomas B. Moeslund, Graham W. TaylorR0-FoMo @ NeurIPS 2023

Abstract

We explore whether large pretrained models can provide a useful representation space for datasets they were not trained on, and whether these representations can be used to group novel unlabelled data into meaningful clusters. Using image encoders pretrained on ImageNet via supervised or self-supervised techniques, we evaluate their performance on unseen datasets. Our findings indicate that self-supervised feature encoders, particularly when paired with Agglomerative Clustering, can generate well-defined clusters even for fine-grained datasets like NABirds. Furthermore, the Silhouette score serves as a reliable proxy for cluster quality in the absence of ground-truth labels.

Introduction

The prevailing paradigm for utilizing "foundation models" involves fine-tuning on a target dataset. However, fine-tuning is computationally intensive and requires labeled data. This study investigates the "zero-shot" potential of these models: can their off-the-shelf representation spaces effectively organize unseen datasets without any parameter updates? We evaluate this across diverse domains, from simple digits to complex biological categories.

Methodology

The proposed zero-shot pipeline consists of three stages:

  1. Feature Extraction: We tested five self-supervised paradigms—MoCo-v3 (Contrastive), DINO (Distillation), VICReg (CCA), MAE (Masked Image Modelling), and CLIP (Multi-Modal)—using ResNet-50 and ViT-B backbones.
  2. Dimensionality Reduction: High-dimensional embeddings were reduced to 50 dimensions using UMAP, which significantly outperformed PCA.
  3. Clustering: We compared K-Means, Agglomerative Clustering (AC), Affinity Propagation, and HDBSCAN.

Hyperparameters were tuned exclusively on ImageNet-related data and frozen for all other test datasets to ensure a true zero-shot evaluation.

Comparison of clustering algorithm rankings across ResNet-50 and ViT-B backbones. Agglomerative Clustering (AC) consistently achieves the best (lowest) rank.

Key Insights

  • SSL Superiority in Transfer: While supervised models excel on ImageNet-like data, SSL encoders (MoCo-v3, CLIP) demonstrate superior transferability to distant domains.
  • The Optimal Pipeline: The combination of UMAP (50-dim) and Agglomerative Clustering emerged as the most robust approach. As shown in the algorithmic rankings, AC variants consistently outperformed other algorithms.
  • MAE Limitations: Masked Image Modelling (MAE) performed poorly, likely due to its focus on low-level pixel reconstruction rather than high-level semantic features.
  • Validation without Labels: The Silhouette score correlates strongly with Adjusted Mutual Information (AMI), providing a practical way to estimate clustering quality in real-world scenarios without ground truth.

Results

The performance was evaluated across 10 datasets, including general objects (CIFAR), digits (MNIST, SVHN), and fine-grained categories (NABirds, iNaturalist).

Detailed AMI scores (%) for various encoders and clustering algorithms across ten datasets.

Key findings from the results include:

  • Top Encoders: MoCo-v3 performed best for ResNet-50, while CLIP was the top performer for ViT-B backbones.
  • Fine-Grained Success: CLIP/ViT-B achieved a remarkable 62% AMI on the NABirds dataset (555 classes) without any bird-specific training.
  • Scaling: On the 10,000-class iNaturalist-2021 dataset, AC reached an AMI of 28.6%, significantly outperforming competitors.
  • The SVHN Challenge: All models struggled with SVHN (AMI < 15%), likely due to high intra-class visual diversity (e.g., varying backgrounds for the same digit).

Conclusion

This work demonstrates that large-scale SSL models can perform effective zero-shot clustering on entirely unseen domains. By leveraging robust encoders like CLIP and MoCo-v3 with Agglomerative Clustering, researchers can gain meaningful insights from unlabeled data without the need for expensive fine-tuning. Future work will explore the applicability of these findings to non-natural image domains such as medical or satellite imagery.

Summary updated

BibTeX
@inproceedings{lowe2023zero,
  author = {Scott C Lowe and Joakim Bruslund Haurum and Sageev Oore and Thomas B. Moeslund and Graham W. Taylor},
  title = {{Zero-shot Clustering of Embeddings with Pretrained and Self-Supervised Learnt Encoders}},
  booktitle = {R0-FoMo @ NeurIPS},
  year = {2023},
  url = {https://openreview.net/forum?id=2gytoWpJGf},
}
Figure