Skip to main content
QUICK REVIEW

[Paper Review] Learning Intra-Batch Connections for Deep Metric Learning

Jenny Seidenschwarz, Ismail Elezi|arXiv (Cornell University)|Feb 15, 2021
Face recognition and analysisComputer Science78 references13 citations
TL;DR

This paper proposes a learnable message passing network (MPN) that refines deep metric learning embeddings by leveraging all intra-batch relations through attention-augmented message passing. By enabling end-to-end training with global structural awareness, the method achieves state-of-the-art performance on CUB-200-2011, Cars196, Stanford Online Products, and In-Shop Clothes benchmarks without inference overhead, while also supporting improved performance via test-time MPN inference.

ABSTRACT

The goal of metric learning is to learn a function that maps samples to a lower-dimensional space where similar samples lie closer than dissimilar ones. Particularly, deep metric learning utilizes neural networks to learn such a mapping. Most approaches rely on losses that only take the relations between pairs or triplets of samples into account, which either belong to the same class or two different classes. However, these methods do not explore the embedding space in its entirety. To this end, we propose an approach based on message passing networks that takes all the relations in a mini-batch into account. We refine embedding vectors by exchanging messages among all samples in a given batch allowing the training process to be aware of its overall structure. Since not all samples are equally important to predict a decision boundary, we use an attention mechanism during message passing to allow samples to weigh the importance of each neighbor accordingly. We achieve state-of-the-art results on clustering and image retrieval on the CUB-200-2011, Cars196, Stanford Online Products, and In-Shop Clothes datasets. To facilitate further research, we make available the code and the models at https://github.com/dvl-tum/intra_batch_connections.

Motivation & Objective

  • To address the limitation of existing deep metric learning methods that rely only on pairwise or triplet losses, which ignore the global structure of the embedding space.
  • To develop a fully learnable module that refines embeddings using all inter-sample relations within a mini-batch.
  • To improve clustering and image retrieval performance by modeling the global dataset structure through message passing with learnable attention.
  • To ensure robustness and generalization by validating performance under various hyperparameter settings and without test set feedback.

Proposed method

  • The method uses a CNN backbone to generate initial feature embeddings for all samples in a mini-batch.
  • A fully connected graph is constructed where each node represents a sample’s embedding, enabling inter-sample communication.
  • Message passing is performed over K steps, where each sample aggregates messages from all other samples in the batch using a learnable attention mechanism.
  • Attention weights are computed via dot-product self-attention, allowing each sample to dynamically weigh the importance of its neighbors during message aggregation.
  • The refined embeddings are used to compute a cross-entropy loss, enabling end-to-end training of both the CNN and the MPN.
  • At inference, the method can either use only the CNN backbone (no overhead) or further apply the trained MPN using k-reciprocal nearest neighbor sampling for improved performance.

Experimental results

Research questions

  • RQ1Can modeling all intra-batch relations in a mini-batch improve deep metric learning beyond pairwise or triplet-based losses?
  • RQ2How does attention-based message passing enhance the model’s ability to capture global embedding structure compared to handcrafted rules or fixed sampling strategies?
  • RQ3Does the proposed method maintain performance robustness across different hyperparameter choices, such as the number of message passing steps or attention heads?
  • RQ4Can the method achieve state-of-the-art results without relying on test set feedback or architectural overfitting?
  • RQ5How does the method scale with increasing numbers of classes and samples per class in a mini-batch?

Key findings

  • The method achieves state-of-the-art performance on CUB-200-2011 with a Recall@1 of 70.3%, outperforming prior methods.
  • On Cars196, the model reaches 88.1% Recall@1, demonstrating strong performance on a larger, more complex dataset.
  • On Stanford Online Products, the method achieves 81.4% Recall@1, and on In-Shop Clothes, it reaches 92.8%, confirming broad effectiveness.
  • Even under a 'reality check' protocol that avoids test set feedback, the method achieves 67.1% Recall@1 on CUB-200-2011 and 86.7% on Cars196, showing robustness.
  • The performance remains stable across varying numbers of classes and samples per class, with maximum drops of 2.8pp on CUB-200-2011 and 3.4pp on Cars196.
  • The method shows that increasing message passing steps or attention heads does not improve performance on all datasets, indicating optimal configuration is data-dependent.

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.