Abstract
This paper addresses the performance gap in face recognition systems caused by the discrepancy between training objectives and evaluation metrics. While models are typically trained using Euclidean-based softmax loss, they are evaluated using cosine similarity. We introduce a suite of novel Deep Metric Learning (DML) loss functions based on angular margins. By explicitly enforcing intra-class feature clustering and inter-class separation on a normalized hypersphere, our proposed Discriminative Large Margin Cosine (DLMC) loss achieves highly discriminative features and state-of-the-art results on standard benchmarks.
Introduction
In modern face recognition, Convolutional Neural Networks (CNNs) are the standard architecture. However, a fundamental disconnect exists: models are optimized using softmax loss (cross-entropy based on Euclidean distance), yet industry-standard testing relies on cosine similarity (the angle between feature vectors).
Standard softmax loss fails to enforce tight intra-class clustering. Furthermore, it often minimizes loss by simply increasing the magnitude (norm) of feature vectors rather than improving their angular separation. This research bridges this gap by designing loss functions that directly optimize the angular margin during training, aligning the objective with the deployment metric.
Methodology
The authors propose a pipeline that covers training, verification, and identification tasks, as illustrated in Figure 1.
To achieve superior discriminative power, five loss functions were developed iteratively:
- LMC (Large Margin Cosine) Loss: Introduces a penalty if the cosine similarity between a sample and its class weight vector is below a fixed margin $\alpha$.
- HLMC (Hard LMC) Loss: Increases efficiency by applying the LMC constraint only to "hard" samples misclassified by the standard softmax.
- MALMC (Margin-Adaptive LMC) Loss: Dynamically updates margins for each class based on local feature distributions, eliminating the need for manual hyperparameter tuning.
- NLMC (Normalized LMC) Loss: Normalizes both features and weight vectors to a fixed radius $s$. This forces the network to optimize angular separation rather than inflating feature magnitudes.
- DLMC (Discriminative LMC) Loss: The final iteration, which combines normalization with a constraint forcing intra-class similarity to exceed the mean of the nearest inter-class similarities by a specific margin.
Experiments and Results
Datasets and Setup
Models were trained on the CASIA-WebFace dataset (~490k images) using a ResNet-27 architecture. Evaluation was performed on three major benchmarks: LFW (Labeled Faces in the Wild), YTF (YouTube Faces), and the challenging IJB-A (IARPA Janus Benchmark A).
Feature Visualization
The impact of these angular constraints is clearly visible in feature space. As shown in Figure 3, while standard softmax creates separable clusters, the introduction of angular constraints and normalization (as seen in the star-shaped distributions) leads to much more distinct and compact class representations.
Quantitative Performance
DLMC consistently outperformed standard softmax, Triplet loss, and other competitive variants:
- LFW: Achieved 99.07% verification accuracy.
- YTF: Achieved 94.16% verification accuracy.
- IJB-A: Reached 93.21% Rank-1 identification accuracy and 86.02% True Accept Rate (TAR) at a 0.01 False Accept Rate (FAR), outperforming several commercial systems.
Key Insights
- Metric Consistency: Aligning training (cosine) with testing (cosine) yields more reliable representations.
- The Magnitude Problem: Normalizing features to a hypersphere prevents the network from "cheating" by inflating vector norms, forcing it to learn better angular separation.
- Scalability: Unlike Triplet loss, which requires expensive hard-mining of triplets, DLMC uses class centers and neighborhood sampling, making it a highly scalable alternative for large-scale datasets.
Conclusion and Future Work
This work demonstrates that angular discriminative learning is a powerful paradigm for face recognition. Future research will focus on making these loss functions fully differentiable everywhere and improving robustness against variations in face detection preprocessing. The authors also suggest that these methods could be extended to other domains like person re-identification and general image retrieval.
Summary updated