Deep Triplet Ranking Networks for One-Shot Recognition

Meng Ye, Yuhong GuoarXiv 2018 · OpenReview

Abstract

Despite the breakthroughs achieved by deep learning models in conventional supervised learning scenarios, their dependence on sufficient labeled training data in each class prevents effective applications of these deep models in situations where labeled training instances for a subset of novel classes are very sparse -- in the extreme case only one instance is available for each class. To tackle this natural and important challenge, one-shot learning, which aims to exploit a set of well labeled base classes to build classifiers for the new target classes that have only one observed instance per class, has recently received increasing attention from the research community. In this paper we propose a novel end-to-end deep triplet ranking network to perform one-shot learning. The proposed approach learns class universal image embeddings on the well labeled base classes under a triplet ranking loss, such that the instances from new classes can be categorized based on their similarity with the one-shot instances in the learned embedding space. Moreover, our approach can naturally incorporate the available one-shot instances from the new classes into the embedding learning process to improve the triplet ranking model. We conduct experiments on two popular datasets for one-shot learning. The results show the proposed approach achieves better performance than the state-of-the- art comparison methods.

Introduction: The One-Shot Challenge

Standard deep learning models are data-hungry; they typically require thousands of labeled examples per class to generalize well. However, in many real-world scenarios, we only have one or two examples of a new category (e.g., a rare medical condition or a specific person's face). This is known as one-shot learning.

The authors identify a specific weakness in previous metric-learning approaches, such as Siamese networks: they rely on absolute similarity. These models attempt to force a specific distance value between pairs of images. This often fails when inter-class variations are small (different characters looking similar) or intra-class variations are large (the same character written differently). The authors argue that relative similarity—learning that image A is more like image B than it is like image C—is a more robust way to build universal embeddings.

Relative vs. absolute similarity in character recognition

Methods: Deep Triplet Ranking

The authors propose a two-stage approach centered on a Deep Triplet Ranking Network:

  1. The Architecture: They use a CNN with four blocks (totaling 10 convolutional layers) followed by a fully connected layer that produces a 1024-dimensional embedding.
  2. Triplet Ranking Loss: Instead of comparing pairs, the model looks at triplets: an anchor, a positive (same class), and a negative (different class). The loss function forces the distance between the anchor and the positive to be smaller than the distance between the anchor and the negative by a specific margin. This focuses the model on the relative structure of the feature space.
  3. Leveraging the One-Shot Instance: Usually, the single instance of a new class is only used at test time. The authors propose a "fine-tuning" phase. Since you can't form a triplet with only one image, they use data augmentation (rotations, shears, flips, and color adjustments) to create "synthetic" positive examples. This allows the model to "practice" on the specific novel classes it is about to be tested on.
  4. Regularization: They include an $L_2$ norm regularizer on the embedding features to prevent numerical instability and ensure stable training.

Key Insights and Results

The core "aha moment" of this work is that the model doesn't need to know exactly how similar two images are in a vacuum; it only needs to know the ranking. This provides the model with more flexibility to handle "hard" negatives—different classes that look very similar.

Through PCA visualization, the authors demonstrate that their triplet approach creates much tighter, more distinct clusters for novel classes compared to standard Siamese networks. The fine-tuning stage further warps the embedding space to better separate the new classes.

PCA visualization comparing embedding spaces of Siamese vs. Triplet Ranking networks

The proposed method outperformed several established baselines (Siamese, Matching, and Prototypical Networks) on benchmark datasets:

  • Omniglot (20-way, 1-shot): Achieved 97.0% accuracy, significantly higher than the standard Siamese network's 92%.
  • miniImageNet (5-way, 1-shot): Achieved 50.58% accuracy, a state-of-the-art result for this difficult dataset at the time of publication.

Conclusion

This paper demonstrates that relative similarity via triplet ranking is a powerful paradigm for one-shot learning. By shifting the focus from absolute distance to relative ranking and incorporating a fine-tuning phase with augmented data, the model achieves superior generalization on novel classes. Future work may explore more sophisticated data augmentation for complex natural images and more efficient triplet mining strategies to reduce computational costs.

Summary updated

Abstract

Despite the breakthroughs achieved by deep learning models in conventional supervised learning scenarios, their dependence on sufficient labeled training data in each class prevents effective applications of these deep models in situations where labeled training instances for a subset of novel classes are very sparse -- in the extreme case only one instance is available for each class. To tackle this natural and important challenge, one-shot learning, which aims to exploit a set of well labeled base classes to build classifiers for the new target classes that have only one observed instance per class, has recently received increasing attention from the research community. In this paper we propose a novel end-to-end deep triplet ranking network to perform one-shot learning. The proposed approach learns class universal image embeddings on the well labeled base classes under a triplet ranking loss, such that the instances from new classes can be categorized based on their similarity with the one-shot instances in the learned embedding space. Moreover, our approach can naturally incorporate the available one-shot instances from the new classes into the embedding learning process to improve the triplet ranking model. We conduct experiments on two popular datasets for one-shot learning. The results show the proposed approach achieves better performance than the state-of-the- art comparison methods.
BibTeX
@misc{ye2018deep,
  author = {Meng Ye and Yuhong Guo},
  title = {{Deep Triplet Ranking Networks for One-Shot Recognition}},
  year = {2018},
  eprint = {1804.07275},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1804.07275},
}
Figure