Self-Taught Metric Learning without Labels

Sungyeon Kim, Dongwon Kim, Minsu Cho, Suha Kwak · DOI

Abstract

Deep metric learning (DML) traditionally relies on extensive human-annotated labels to teach models how to map similar objects close together in an embedding space. This paper introduces Self-Taught Metric Learning (STML), a framework that eliminates the need for labels by leveraging a teacher-student architecture and the contextual relationships between data points. By utilizing k-reciprocal nearest neighbors to define similarity, STML generates reliable "soft" labels that guide the learning process. Experimental results on standard benchmarks like CUB-200-2011 and Cars-196 demonstrate that STML not only outperforms existing unsupervised methods but also surpasses several established supervised models.

Introduction

The goal of deep metric learning is to create an embedding space where semantically similar items (e.g., two different images of the same bird species) are clustered together while dissimilar items are pushed apart. While highly effective, the supervised nature of this field presents a significant bottleneck: the requirement for massive, precisely labeled datasets.

Existing unsupervised approaches generally fall into two categories: instance discrimination and pseudo-labeling. Instance discrimination treats every image as a unique class, which fails to account for the fact that different images often belong to the same semantic category. Pseudo-labeling uses external algorithms like k-means to guess groups, but this process is computationally expensive and often introduces "noise" that hinders model convergence. STML addresses these issues by learning relationships end-to-end, using the data's own neighborhood structure as a supervisory signal.

The STML Framework

Teacher-Student Architecture

STML employs a dual-network setup consisting of a "Student" and a "Teacher." The Student network is the primary model being trained, while the Teacher is a temporal ensemble—an Exponential Moving Average (EMA) of the Student's weights. The Teacher observes the data and predicts similarity scores, which the Student then uses as targets for its own updates. This loop allows the model to gradually refine its understanding of the data distribution without external intervention.

Contextualized Semantic Similarity

The core innovation of STML is how it defines similarity. In the early stages of training, raw Euclidean distance in the embedding space is often unreliable. To solve this, the authors look at the "context" or neighborhood of data points. Specifically, they use k-reciprocal nearest neighbors. If two images, $x_i$ and $x_j$, share many of the same neighbors, they are likely to belong to the same semantic class, even if their direct distance is initially large. This Jaccard similarity between neighborhoods provides a much more stable and accurate signal than simple distance measurements.

Asymmetric Embeddings and Relaxed Loss

To ensure the Teacher provides a high-quality signal, the authors implement asymmetric embedding dimensions. The Teacher operates in a higher-dimensional space (e.g., 2048 dimensions) compared to the Student (e.g., 512 dimensions). This allows the Teacher to capture more complex features and nuances. Furthermore, because the similarity predictions are continuous values rather than binary (0 or 1), the framework utilizes a Relaxed Contrastive Loss. This loss function is designed to handle "soft" labels, allowing the model to learn from degrees of similarity rather than forcing rigid, potentially incorrect classifications.

Experimental Results

The STML framework was evaluated on three major fine-grained retrieval benchmarks: CUB-200-2011 (birds), Cars-196 (cars), and Stanford Online Products (SOP).

  • State-of-the-Art Performance: STML significantly outperformed previous unsupervised methods. On the CUB dataset, it achieved a Recall@1 of 59.7% (at 128 dimensions), a substantial jump from the previous best of 52.0%.
  • Surpassing Supervision: In a remarkable finding, STML achieved a Recall@1 of 60.6% on CUB, outperforming several well-known supervised models such as ABIER and MS. This suggests that the self-taught signals derived from neighborhood context can be cleaner and more effective than human labels in certain fine-grained contexts.
  • Efficiency and Versatility: Unlike pseudo-labeling methods that require offline clustering, STML is trained end-to-end, making it more computationally efficient. It also proved effective in semi-supervised settings, where it used unlabeled data to boost the performance of models trained on limited labeled sets.

Discussion and Insights

The Power of Soft Labels

One of the key takeaways from the STML research is that "soft" labels are often superior to "hard" labels in unsupervised learning. By allowing the model to express uncertainty and nuance (e.g., "these two items are 85% likely to be the same"), the training process becomes more stable and less prone to the errors typical of hard-assignment clustering.

Learning from Scratch

While the best results were achieved using ImageNet pre-trained weights, STML demonstrated a unique ability to learn from scratch. It significantly outperformed other self-supervised methods like NCE or ISIF when no pre-training was involved, proving that the neighborhood-based context is a powerful signal for discovering structure in raw data.

Conclusion

Self-Taught Metric Learning (STML) represents a significant step forward in unsupervised representation learning. By shifting the focus from individual data points to their contextual neighborhoods, STML allows models to discover semantic relationships without human guidance. Its ability to match or exceed supervised performance highlights the untapped potential of self-supervised signals in complex, fine-grained visual recognition tasks.

Summary updated

BibTeX
@misc{kim2022self,
  author = {Sungyeon Kim and Dongwon Kim and Minsu Cho and Suha Kwak},
  title = {{Self-Taught Metric Learning without Labels}},
  year = {2022},
  eprint = {2205.01903},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2205.01903},
}
Figure