Abstract
In deep metric learning, the goal is to learn an embedding space where semantically similar images are clustered together while dissimilar ones are separated. Traditional approaches, such as triplet loss, rely on distance-based margins which are often sensitive to feature scaling and ignore the complex geometric relationships between multiple points. This paper introduces Angular Loss, a novel objective that optimizes the angular relationships within triplets. By enforcing an angular constraint at the negative vertex of the triplet triangle, the method achieves scale invariance and captures third-order geometric structures, leading to state-of-the-art performance in image retrieval and clustering.
Introduction
Metric learning is fundamental to various computer vision tasks, including face recognition, image retrieval, and product search. The standard paradigm involves mapping images into a high-dimensional space where Euclidean distances reflect semantic similarity. The most common objective, triplet loss, utilizes an anchor ($x_a$), a positive ($x_p$), and a negative ($x_n$) sample. It aims to ensure that the distance between the anchor and negative is greater than the distance between the anchor and positive by a fixed margin.
However, distance-based methods face two primary challenges:
- Scale Sensitivity: Absolute distance margins do not account for the varying intra-class variances across different categories. A fixed margin may be inappropriate for classes with different "spreads" in the embedding space.
- Limited Geometric Awareness: Pairwise distance constraints often fail to capture the broader geometric structure of the data manifold, leading to less stable optimization.
The Angular Loss Framework
To address these limitations, the authors propose the Angular Loss. Instead of a linear distance margin, this loss introduces a constraint on the angle at the negative point of the triplet triangle.
Geometric Innovation
The core idea is to ensure that the angle $\angle n$ at the negative vertex $x_n$ is smaller than a predefined threshold $\alpha$. Geometrically, this pushes the negative point away from the cluster formed by the anchor and positive points, effectively enlarging the relative distance between dissimilar classes.
Key Advantages
- Scale Invariance: Since angles are invariant to the scale of the feature vectors, the loss is naturally robust to variations in the magnitude of the embeddings. This allows the model to handle diverse object classes with varying distributions more effectively.
- Third-Order Geometry: Unlike triplet loss, where the gradient for one point typically depends only on its distance to one other point, the gradient in Angular Loss for any point in the triplet is a function of the positions of all three points ($x_a, x_p, x_n$). This "third-order" interaction provides more informative gradients and leads to more stable convergence.
- Integration: Angular Loss can be seamlessly integrated with other frameworks. The authors specifically demonstrate its synergy with N-pair loss, which considers multiple negative samples simultaneously to accelerate training.
Experimental Results
The proposed method was evaluated on three major benchmarks for fine-grained image retrieval: CUB-200-2011 (birds), Stanford Car, and Online Products.
Quantitative Performance
The combination of N-pair loss and Angular Loss (NL&AL) consistently outperformed baseline methods. On the Stanford Car dataset, the method achieved a 71.4% Recall@1, a significant improvement over the 48.3% achieved by traditional triplet loss. Similar gains were observed on the CUB-200-2011 dataset, where Recall@1 reached 54.7%.
Qualitative Analysis
Qualitative results demonstrate that the angular constraint helps the model better distinguish between visually similar but semantically different categories. In retrieval tasks, the NL&AL model identifies more correct matches (indicated by red arrows in the figure below) compared to the standard N-pair loss (NL).
Conclusion
Angular Loss represents a significant shift from distance-based to geometry-based optimization in deep metric learning. By leveraging the scale-invariant properties of angles and capturing higher-order interactions between data points, the method provides a more robust and effective objective for learning discriminative embeddings. Future work may extend this concept to higher-order manifolds, such as quadruplets, to capture even more complex data structures.
Summary updated