RepMet: Representative-based metric learning for classification and one-shot object detection

Eli Schwartz, Leonid Karlinsky, Joseph Shtok, Sivan Harary, Mattias Marder, Sharathchandra Pankanti, Rogério Schmidt Feris, Abhishek Kumar, Raja Giryes, Alexander M. Bronstein

Abstract

Deep learning models typically require vast amounts of labeled data to generalize to new categories. RepMet addresses this limitation by introducing a distance metric learning (DML) framework that jointly learns feature embeddings and multi-modal class "representatives." By integrating this DML module into standard detection and classification backbones, the authors achieve state-of-the-art performance in fine-grained classification and significantly improve few-shot object detection capabilities.

Introduction

Few-shot learning (FSL) aims to enable neural networks to recognize novel objects from only a handful of examples. While FSL has matured in image classification, few-shot object detection remains difficult because it requires both precise localization and classification in complex environments. Existing DML methods often struggle with unimodal assumptions—representing a class as a single point—and inefficient multi-stage training processes. RepMet overcomes these hurdles through an end-to-end architecture that models classes as mixtures of multiple representatives.

Methodology: The RepMet Architecture

The core innovation is the RepMet DML sub-net, designed to replace standard classification heads in existing architectures.

Representatives as Mixture Models

Unlike traditional approaches that use a single centroid per class, RepMet represents each category as a mixture of $K$ Gaussians. These "representatives" capture the diverse intra-class variance, such as different poses or sub-breeds, which is essential for fine-grained tasks.

Joint End-to-End Learning

RepMet learns the backbone parameters, the embedding space, and the class representatives simultaneously. The representatives are implemented as weights in a fully connected layer, allowing for direct gradient-based optimization. This synergy allows the backbone to "warp" the embedding space to maximize discriminative power.

The RepMet architecture integrates a DML embedding module with class representatives to compute distances and posteriors for joint training.

Detection and Loss Functions

For object detection, RepMet is integrated into an R-CNN framework. It handles background noise by estimating background probability as a lower bound of foreground class probabilities. Training is guided by a combination of Cross-Entropy and a specialized embedding loss, which enforces a margin ($\alpha$) between the distance to the correct class representative and the nearest incorrect one.

Experimental Results

The framework was evaluated on Stanford Dogs, Oxford-IIIT Pet, and ImageNet-LOC. To ensure statistical robustness, the authors introduced a new episodic benchmark for few-shot detection based on ImageNet-LOC, utilizing 500 random tasks.

Fine-grained Classification

RepMet significantly outperformed existing DML methods. On the Stanford Dogs dataset, it achieved a 13.7% test error, nearly halving the error rates of previous state-of-the-art methods (ranging from 24.0% to 29.7%).

Few-shot Object Detection

In 1-shot detection tasks on a 50-way ImageNet benchmark, RepMet reached 24.1% mAP, a substantial improvement over the 19.2% mAP achieved by the LSTD baseline. The model's "internal memory"—provided by the representatives—allows it to maintain robust performance even when training batches are small.

Conclusion

RepMet demonstrates that joint learning of embeddings and multi-modal representatives is a powerful strategy for few-shot tasks. By moving beyond unimodal class representations and enabling end-to-end training, the framework sets a new standard for fine-grained classification and few-shot object detection. Future work may explore dynamic prediction of the number of representatives and automated sample synthesis to further enhance the model's adaptability.

Summary updated

BibTeX
@inproceedings{schwartz2019repmet,
  author = {Eli Schwartz and Leonid Karlinsky and Joseph Shtok and Sivan Harary and Mattias Marder and Sharathchandra Pankanti and Rogério Schmidt Feris and Abhishek Kumar and Raja Giryes and Alexander M. Bronstein},
  title = {{RepMet: Representative-based metric learning for classification and one-shot object detection}},
  booktitle = {CVPR},
  year = {2019},
  doi = {10.1109/cvpr.2019.00534},
}
Figure