Introduction
In Deep Metric Learning (DML), the goal is to train neural networks to map images into an embedding space where similar items are clustered together and dissimilar ones are separated. Historically, researchers have focused on designing complex loss functions (e.g., Multi-Similarity or Circle loss) to extract maximum information from small mini-batches by carefully weighting "hard" pairs.
However, the rise of embedding memory techniques like Cross-Batch Memory (XBM) and Momentum Contrast (MoCo) has changed the landscape. These methods allow models to compare current samples against thousands of historical examples. This paper re-evaluates the necessity of complex weighting schemes in the presence of large-scale memory, proposing that simplicity often yields better results.
Methods: From Mini-Batches to s-MoCo
The authors introduce s-MoCo (Supervised MoCo), an adaptation of the MoCo framework for supervised learning. While previous memory methods like XBM store stale features, s-MoCo utilizes a momentum-updated encoder to maintain feature consistency, effectively mitigating the "feature drift" problem.
To analyze existing loss functions, the researchers decomposed them into independent positive and negative weight curves. By plotting these weights against pair similarity, they discovered that many state-of-the-art (SOTA) losses—despite their mathematical differences—behave remarkably similarly in practice.
Key Insights
- Hard Negative Mining is Paramount: In memory-based DML, the primary driver of performance is identifying "hard" negatives (dissimilar items that the model thinks are similar). Once these are identified and easy negatives are discarded, the specific weighting of the remaining hard negatives becomes secondary.
- Triviality of Positive Weighting: While weighting hard positives is critical in small-batch training, it provides negligible benefits when a large memory is available.
- Independence and Robustness: Memory-based methods decouple the need for balanced positive and negative weighting. This allows for simpler loss designs that are more robust to hyperparameter variations compared to mini-batch-only approaches.
- The Power of Momentum: Using a momentum encoder (s-MoCo) is significantly more effective at maintaining memory consistency than simply storing old features, as seen in XBM.
Results and Performance
The study evaluated s-MoCo on three large-scale benchmarks: Stanford Online Products (SOP), In-Shop Clothes Retrieval, and VehicleID.
- Superior Accuracy: A simple contrastive loss paired with s-MoCo outperformed complex SOTA losses like Circle Loss and Multi-Similarity loss across all large datasets.
- Benchmark Success: On the SOP dataset, s-MoCo achieved a Recall@1 of 81.6% (ResNet50), surpassing XBM (80.6%) and Circle Loss (78.3%).
- Training Signal: s-MoCo identifies approximately 15% more hard negatives per iteration than XBM and 7x more than standard mini-batch methods, providing a much denser training signal.
Limitations
Despite its success on large datasets, s-MoCo faces challenges with small datasets like CUB-200-2011 and Cars-196. The intense training signal from the large memory can lead to rapid overfitting, resulting in a significant generalization gap. Future work is needed to adapt memory-based contrastive learning for better performance on smaller-scale data.
Summary updated