Abstract
Deploying high-performance face recognition models on mobile and embedded devices is challenging due to the instability of popular loss functions when training small-scale architectures from scratch. This paper introduces AirFace, a framework featuring Li-ArcFace—a novel loss function that replaces trigonometric target logits with a linear function of the angle. This modification ensures monotonic behavior and stable convergence for low-dimensional embeddings. Combined with an optimized backbone based on MobileFaceNet, AirFace achieves state-of-the-art accuracy on lightweight benchmarks, including a 99.27% accuracy on LFW and second place in the DeepGlint-Light challenge.
Introduction
Deep Convolutional Neural Networks (DCNNs) have set new benchmarks in face recognition. However, state-of-the-art loss functions like ArcFace, which utilize additive angular margins, often encounter convergence issues (e.g., "NaN" errors) when applied to lightweight models with small embedding sizes (e.g., 128 dimensions) trained from scratch. This typically necessitates a cumbersome multi-stage training process. Furthermore, standard mobile architectures like MobileNetV2 are often suboptimal for the fine-grained discriminative tasks required in face recognition. AirFace addresses these issues through a more stable loss function and a specialized network architecture.
Li-ArcFace: Linearizing the Angular Margin
The core innovation of AirFace is Li-ArcFace (Linear ArcFace). Traditional ArcFace calculates the target logit as $s \cdot \cos(\theta + m)$. The non-linear, trigonometric nature of this function can lead to gradient instability, especially at large angles during the early stages of training small models.
AirFace replaces the cosine function with a linear mapping: $$f(\theta) = \frac{\pi - 2\theta}{\pi}$$ By applying the margin $m$ to the angle $ heta$ before this linear transformation, the loss function remains monotonic across the entire angular range $[0, \pi]$. This linearity provides a consistent and intuitive penalty, preventing model divergence and eliminating decision boundary overlap between classes.
Architectural Optimizations
AirFace builds upon the MobileFaceNet architecture with several key enhancements:
- Increased Capacity: The network's depth and width are expanded to capture more complex features while maintaining a low computational footprint.
- Enhanced Attention: The Convolutional Block Attention Module (CBAM) is integrated into every bottleneck. The final activation is modified from a sigmoid (0 to 1) to $1 + \tanh$ (0 to 2). This allows the network to both suppress noise and amplify salient features by up to 2x, accelerating convergence.
- Spatial Preservation: Global Depthwise Convolution (GDC) is used instead of Global Average Pooling to better preserve spatial information in the final 128-dimensional feature map.
Experimental Evaluation
The models were trained on CASIA-WebFace and MS1M-retina and evaluated on standard benchmarks including LFW, CFP-FP, AgeDB, and MegaFace.
Convergence and Stability
A significant advantage of Li-ArcFace is its training stability. While standard ArcFace often diverges when training a 128-dim MobileFaceNet from scratch, Li-ArcFace demonstrates smooth and consistent convergence, as shown in the accuracy progression below.
Performance Benchmarks
AirFace achieves highly competitive results across various datasets:
- LFW: 99.27% accuracy.
- AgeDB: 93.25% accuracy, slightly outperforming ArcFace even when the latter was initialized with Softmax pre-training.
- MegaFace: 98.04% Rank-1 identification accuracy using only 1G FLOPs, demonstrating exceptional efficiency compared to larger models requiring 20G+ FLOPs.
Conclusion
AirFace provides a robust solution for mobile face recognition by addressing the fundamental instability of angular margin loss functions in lightweight settings. By linearizing the target logit and optimizing the attention mechanism, AirFace enables efficient, from-scratch training of high-performance models for resource-constrained environments.
Summary updated