Abstract
Deep embedding learning becomes more attractive for discriminative feature learning, but many methods still require hard-class mining, which is computationally complex and performance-sensitive. To this end, we propose Adaptive Large Margin N-Pair loss (ALMN) to address the aforementioned issues. Instead of exploring hard example-mining strategy, we introduce the concept of large margin constraint. This constraint aims at encouraging local-adaptive large angular decision margin among dissimilar samples in multimodal feature space so as to significantly encourage intraclass compactness and interclass separability. And it is mainly achieved by a simple yet novel geometrical Virtual Point Generating (VPG) method, which converts artificially setting a fixed margin into automatically generating a boundary training sample in feature space and is an open question. We demonstrate the effectiveness of our method on several popular datasets for image retrieval and clustering tasks.
Introduction and Problem Statement
Deep embedding learning aims to map images into a feature space where similar items are clustered together and dissimilar items are separated. Traditionally, achieving high performance has relied on hard-example mining—the process of searching through massive datasets to find the most "difficult" pairs to train on. However, this process is computationally heavy and highly sensitive to noise.
Furthermore, existing "large margin" methods often utilize a fixed margin, a one-size-fits-all distance requirement. As illustrated in Figure 1, real-world data is often multimodal and heterogeneous. In complex datasets like CUB-200-2011 (birds), the intra-class distance can occasionally be larger than the inter-class distance. A fixed margin might be too lenient for simple patterns but impossibly strict for complex ones, leading to sub-optimal embeddings or training failure.
Methods: Adaptive Large Margin N-Pair Loss
The authors propose ALMN, which builds upon the standard N-pair loss with two primary innovations designed to bypass the mining bottleneck:
- Class Center Anchors: Instead of comparing random pairs, the model uses class centers ($c_{y_i}$) as anchors. These centers are updated using a moving-average style during training, providing more stable gradient directions than individual noisy samples.
- Virtual Point Generating (VPG): This is the core contribution. Instead of searching for a hard negative sample in the dataset, the algorithm mathematically generates a virtual point ($x_g$). This virtual point is essentially a synthetic version of a positive sample that has been pushed further away from the class center toward the nearest negative class.
By forcing the model to correctly classify this virtual, "harder" point, the model naturally develops a large angular margin. Crucially, this margin is adaptive: because the virtual point is generated based on the local neighborhood (the distance to the nearest negative class), easy patterns receive a stronger constraint while hard patterns receive a more manageable one.
Experimental Results
The authors evaluated ALMN on five popular benchmarks for fine-grained image retrieval and clustering, including CUB-200-2011, CARS196, and Stanford Online Products (SOP). ALMN consistently outperformed state-of-the-art methods like Triplet Loss and standard N-pair loss:
- CUB-200-2011: Achieved a Recall@1 of 52.4%, outperforming the N-pair baseline (49.1%).
- CARS196: Reached 71.6% Recall@1, a significant jump over standard N-pair (63.6%).
- Stability: Qualitative results show that while fixed-margin methods often struggle to converge on complex data, ALMN’s loss drops steadily, proving that its adaptive nature helps stabilize training.
Conclusion
VPG demonstrates that we do not always need to find hard examples if we can simulate the geometry of a hard example. By optimizing the angle between samples rather than raw Euclidean distance, the model becomes more robust to variations in feature scale. While the specific geometric formulation of VPG remains an "open question" for further optimization, ALMN provides a powerful, mining-free alternative for deep embedding learning.
Summary updated