Skip to main content
QUICK REVIEW

[Paper Review] Generalization in Metric Learning: Should the Embedding Layer be the Embedding Layer?

Nam Vo, James Hays|arXiv (Cornell University)|Mar 8, 2018
Advanced Image and Video Retrieval TechniquesComputer Science36 references6 citations
TL;DR

This paper investigates generalization in deep metric learning for fine-grained image retrieval, demonstrating that the penultimate layer (before the final embedding layer) often generalizes better than the standard embedding layer. By analyzing feature performance across multiple layers, the authors show that layers closer to the loss function overfit training data, while shallower layers like the penultimate layer yield superior test performance, leading to state-of-the-art results on Cars-196, CUB-200-2011, and Stanford Online Products benchmarks.

ABSTRACT

This work studies deep metric learning under small to medium scale data as we believe that better generalization could be a contributing factor to the improvement of previous fine-grained image retrieval methods; it should be considered when designing future techniques. In particular, we investigate using other layers in a deep metric learning system (besides the embedding layer) for feature extraction and analyze how well they perform on training data and generalize to testing data. From this study, we suggest a new regularization practice where one can add or choose a more optimal layer for feature extraction. State-of-the-art performance is demonstrated on 3 fine-grained image retrieval benchmarks: Cars-196, CUB-200-2011, and Stanford Online Product.

Motivation & Objective

  • To investigate how different layers in a deep metric learning network generalize to test data, especially under small to medium-scale data settings.
  • To challenge the conventional assumption that the final embedding layer is optimal for feature extraction in metric learning.
  • To explore whether alternative layers—particularly the penultimate layer—can yield better generalization and retrieval performance.
  • To provide a new regularization practice based on layer selection for improved generalization in metric learning.

Proposed method

  • The authors train a deep metric learning network using a contrastive or triplet loss and extract features from multiple intermediate layers, not just the final embedding layer.
  • They evaluate feature performance using standard retrieval metrics like Recall@1 (R@1) on training and test sets across multiple benchmarks.
  • The study compares the performance of the last layer (fc6) versus the penultimate layer (pool5.3) and other intermediate layers, analyzing their fit to training data and generalization to test data.
  • They conduct ablation studies across different architectures and datasets, including Cars-196, CUB-200-2011, Stanford Online Products, and the Revisited Oxford-Paris benchmarks.
  • They analyze the impact of layer depth, distance from the loss function, and embedding dimensionality on generalization and fitting performance.
  • They validate their findings on both their own trained models and publicly released models (e.g., lifted structure, HDC), confirming consistency across architectures.

Experimental results

Research questions

  • RQ1Does the final embedding layer always generalize best in deep metric learning for fine-grained image retrieval?
  • RQ2How does the performance of intermediate layers compare to the embedding layer in terms of training fit and test generalization?
  • RQ3Why does the penultimate layer often outperform the final layer in test performance despite worse training accuracy?
  • RQ4To what extent does layer depth or distance from the loss function influence generalization in metric learning?
  • RQ5Can selecting a different layer for feature extraction lead to state-of-the-art performance without modifying the loss or architecture?

Key findings

  • The penultimate layer (pool5.3) achieves 65.1% R@1 on the Cars-196 test set, outperforming the final layer’s 47.9% R@1 when using the same DML-trained network.
  • On the CUB-200-2011 benchmark, the penultimate layer achieves 66.4% R@1, compared to 46.3% for the final layer, demonstrating superior generalization.
  • On the Stanford Online Products dataset, the penultimate layer achieves 74.8% R@1, outperforming the final layer’s 74.1% R@1, with consistent gains in generalization.
  • In the Revisited Oxford-5k and Paris-6k benchmarks, the penultimate layer achieves better mP@1 performance in Easy and Medium settings, consistent with R@1 trends.
  • Despite underfitting training data, the penultimate layer generalizes better, suggesting that overfitting to the loss layer harms test-time performance.
  • The findings hold across multiple models, including the publicly released lifted structure and HDC models, confirming robustness beyond a single architecture.

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.