Skip to main content
QUICK REVIEW

[Paper Review] Learning Metrics from Teachers: Compact Networks for Image Embedding

Lu Yu, Vacit Oguz Yazici|arXiv (Cornell University)|Apr 7, 2019
Face recognition and analysisComputer Science38 references8 citations
TL;DR

This paper proposes knowledge distillation from large teacher networks to compact student networks for efficient image embedding learning. By introducing two novel loss functions—absolute and relative metric distillation—it enables small networks like MobileNet-0.25 to achieve significantly improved retrieval performance, boosting Recall@1 from 27.5% to 44.6% on CUB-200-2011.

ABSTRACT

Metric learning networks are used to compute image embeddings, which are widely used in many applications such as image retrieval and face recognition. In this paper, we propose to use network distillation to efficiently compute image embeddings with small networks. Network distillation has been successfully applied to improve image classification, but has hardly been explored for metric learning. To do so, we propose two new loss functions that model the communication of a deep teacher network to a small student network. We evaluate our system in several datasets, including CUB-200-2011, Cars-196, Stanford Online Products and show that embeddings computed using small student networks perform significantly better than those computed using standard networks of similar size. Results on a very compact network (MobileNet-0.25), which can be used on mobile devices, show that the proposed method can greatly improve Recall@1 results from 27.5\% to 44.6\%. Furthermore, we investigate various aspects of distillation for embeddings, including hint and attention layers, semi-supervised learning and cross quality distillation. (Code is available at https://github.com/yulu0724/EmbeddingDistillation.)

Motivation & Objective

  • Address the challenge of deploying large, accurate metric learning networks on mobile devices with limited compute and battery.
  • Improve the performance of small student networks for image embedding tasks without increasing model size.
  • Explore knowledge distillation for metric learning, a domain where it has been underexplored compared to classification.
  • Investigate cross-quality distillation to transfer knowledge from high-quality to low-quality image inputs.
  • Evaluate the effectiveness of different distillation components, including hint layers, attention distillation, and semi-supervised learning.

Proposed method

  • Propose a relative teacher loss that teaches the student network to replicate the relative distances between image pairs, rather than exact embeddings.
  • Introduce an absolute teacher loss that guides the student to match the teacher’s output embeddings directly.
  • Use triplet loss as the primary metric learning objective during training for both teacher and student networks.
  • Integrate knowledge distillation losses (absolute and relative) alongside the triplet loss to guide student training.
  • Apply distillation with hint layers and attention maps to transfer intermediate feature representations from teacher to student.
  • Enable semi-supervised training by incorporating unlabeled data during distillation to improve generalization.
Figure 1: Graphical illustration of the two knowledge distillation losses we propose for metric learning. $L_{KD}^{abs}$ aims to minimize the distance between the student and teacher embedding of the same image. $L_{KD}^{rel}$ compares the distance in the embedding of the teacher between two images,
Figure 1: Graphical illustration of the two knowledge distillation losses we propose for metric learning. $L_{KD}^{abs}$ aims to minimize the distance between the student and teacher embedding of the same image. $L_{KD}^{rel}$ compares the distance in the embedding of the teacher between two images,

Experimental results

Research questions

  • RQ1Can knowledge distillation effectively transfer metric learning capabilities from large teacher networks to small student networks?
  • RQ2Does a relative teacher (teaching pairwise distances) outperform an absolute teacher (teaching exact embeddings) in metric distillation?
  • RQ3How effective is distillation when the student is trained on low-quality images while the teacher uses high-quality images?
  • RQ4What is the impact of using unlabeled data during distillation on embedding quality?
  • RQ5Can distillation with attention or hint layers further improve compact network performance?

Key findings

  • The relative teacher loss consistently outperforms the absolute teacher loss, achieving 17.1% higher Recall@1 on CUB-200-2011 with MobileNet-0.25.
  • Using MobileNet-0.25 as a student network, Recall@1 increased from 27.5% to 44.6% after distillation, demonstrating strong performance on mobile-optimized architectures.
  • On the Cars-196 dataset, distillation improved Recall@1 by 29.9% compared to a student network trained without a teacher of the same size.
  • Cross-quality distillation significantly improved performance on low-resolution and unlocalized degradation settings, with the relative teacher achieving 61.9% Recall@1 on Cars-196 with degraded inputs.
  • Semi-supervised distillation with unlabeled data further enhanced performance, showing the benefit of leveraging large-scale weakly labeled data.
  • The use of attention and hint layers in distillation contributed to improved feature transfer, especially in challenging visual domains.
Figure 2: Illustration of difference between absolute and relative teacher. (left) Example of four data points in the embedding space of teacher. We consider two samples from two classes (indicated by square and star). (middle and right) show the absolute and relative loss for two student embeddings
Figure 2: Illustration of difference between absolute and relative teacher. (left) Example of four data points in the embedding space of teacher. We consider two samples from two classes (indicated by square and star). (middle and right) show the absolute and relative loss for two student embeddings

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.