Abstract
In recent years, vision transformers have been introduced into face recognition and analysis and have achieved performance breakthroughs. However, most previous methods generally train a single model or an ensemble of models to perform the desired task, which ignores the synergy among different tasks and fails to achieve improved prediction accuracy, increased data efficiency, and reduced training time. This paper presents a multi-purpose algorithm for simultaneous face recognition, facial expression recognition, age estimation, and face attribute estimation (40 attributes including gender) based on a single Swin Transformer. Our design, the SwinFace, consists of a single shared backbone together with a subnet for each set of related tasks. To address the conflicts among multiple tasks and meet the different demands of tasks, a Multi-Level Channel Attention (MLCA) module is integrated into each task-specific analysis subnet, which can adaptively select the features from optimal levels and channels to perform the desired tasks. Extensive experiments show that the proposed model has a better understanding of the face and achieves excellent performance for all tasks. Especially, it achieves 90.97% accuracy on RAF-DB and 0.22 $\epsilon$-error on CLAP2015, which are state-of-the-art results on facial expression recognition and age estimation respectively.
Introduction
Facial analysis in computer vision has traditionally been a fragmented field. Tasks such as identity recognition, emotion detection, and age estimation typically require separate models or complex ensembles. This approach is not only computationally expensive but also fails to leverage task synergy. For instance, a model trained on millions of faces for recognition develops a structural understanding of the face that could benefit age estimation.
However, simple multi-task learning often encounters task conflict. Face recognition (FR) requires "identity-invariant" features, whereas facial expression recognition (FER) focuses on "identity-independent" muscle movements. Standard networks often struggle to balance these competing objectives. SwinFace addresses this by using a shared backbone with specialized subnets that adaptively select relevant features.
Methodology
The SwinFace architecture is built upon a hierarchical Swin Transformer backbone (Swin-T). It consists of three primary components:
- Shared Backbone: A Swin-T transformer extracts feature maps at four hierarchical levels (FM1 to FM4), capturing a range of information from low-level edges to high-level semantic concepts.
- Task-Specific Subnets: The model includes one subnet for Face Recognition and 11 subnets for Face Analysis. These analysis subnets are grouped by relevance; for example, a "Mouth" subnet handles attributes like lipstick and beard presence.
- Multi-Level Channel Attention (MLCA): This module is the core innovation. It allows each analysis subnet to fuse features from all four backbone levels (MLFF) and apply channel attention (CA) to adaptively weight them. This mechanism enables an "Age" subnet to prioritize different layers and channels than an "Expression" subnet, effectively mitigating task conflicts.
The model is optimized using a weighted sum of losses, including CosFace for recognition and a combination of Gaussian and Euclidean losses for age regression.
Experimental Results
SwinFace was evaluated across a diverse set of benchmarks covering 42 distinct tasks. Training utilized massive datasets such as MS-Celeb-1M for recognition, AffectNet for expressions, and IMDB+WIKI for age estimation.
Performance Benchmarks
- Facial Expression: Achieved a state-of-the-art (SOTA) 90.97% accuracy on RAF-DB.
- Age Estimation: Achieved a SOTA 0.22 $\epsilon$-error on CLAP2015.
- Face Recognition: Outperformed Swin-T and ResNet-50 baselines, reaching 99.87% on LFW.
- Efficiency: Despite handling 43 outputs, the model adds only a 36% time overhead compared to a single-task recognition model.
Key Insights
A critical finding was the importance of initialization: pre-training on face recognition data significantly improved performance on data-scarce tasks like age estimation. Furthermore, the MLCA module revealed task-specific layer preferences; while most tasks rely on deeper layers (FM4), certain attribute subnets found intermediate layers (FM3) more beneficial.
Conclusion
SwinFace demonstrates that a unified transformer-based model can effectively manage multiple facial analysis tasks simultaneously without compromising performance. By addressing task conflicts through the MLCA module, it achieves state-of-the-art results across several domains. Future work will focus on incorporating geometric tasks such as facial landmark alignment and 3D face reconstruction, as well as exploring semi-supervised learning techniques to further enhance performance on rare attributes.
Summary updated