1. Introduction
With the continuous advancement of artificial intelligence technology, emotional service robots are gradually transitioning from controlled laboratory environments to complex real-world applications such as educational companionship and medical rehabilitation [
1,
2]. As the core perception module for human–machine emotional interaction, Facial Expression Recognition (FER) directly determines the naturalness of robotic behavioral decisions and the quality of user experience [
3]. However, real-world deployment environments are far from ideal: dynamic viewpoint changes, non-uniform lighting distribution, and frequent occlusions pose severe challenges to algorithmic robustness. Simultaneously, edge-side deployment for service robots must meet stringent real-time requirements (inference speed
FPS) and low-latency constraints (response time
ms).
To address these challenges, existing research primarily employs two technical approaches. First, local feature extraction methods based on convolutional neural networks (CNNs) can effectively capture subtle facial textures; the FER-HA model proposed by Nemati et al. [
4] dynamically weights emotion-related information through an adaptive attention mechanism. achieving an accuracy improvement of 4.2% compared to the baseline model. However, their limited receptive fields make it difficult to model global semantic structures [
5]. Second, while Transformer-based global modeling paradigms can capture long-range dependencies, their high computational cost makes them unsuitable for meeting the real-time interaction requirements of robotic platforms.
To balance these trade-offs, recent studies have explored hybrid architectures that combine Convolutional Neural Networks (CNNs) with Transformers. The HLA-ViT model proposed by Tian et al. [
6] adopts a dual-stream architecture that fuses local and global contextual features at the decision level, thereby improving recognition performance and robustness. It achieved accuracy rates of 65.07% and 90.45% on the AffectNet and RAF-DB datasets, respectively. Although such methods have improved performance to some extent, most of them employ loosely coupled strategies (such as feature concatenation or late-stage fusion) and do not explicitly model the synergistic interaction between local and global representations.
A critical yet underexplored issue in these hybrid frameworks is the inconsistency between multi-level attention distributions. In practical scenarios, shallow layers tend to focus on local textures that are sensitive to noise or occlusion, whereas deep layers emphasize global semantic structures. When these attention patterns are not aligned, the model may suffer from unstable predictions. This phenomenon, referred to in this work as attention divergence, can be formally understood as the spatial inconsistency between shallow and deep attention maps, which leads to conflicting optimization objectives during training. To address this issue, we introduce the concept of attention synergy, which aims to enforce spatial consistency and complementary behavior between multi-level attention representations. Specifically, attention synergy is defined as the degree of alignment between shallow structural attention and deep semantic attention. By promoting such alignment, the model can achieve more stable and discriminative feature representations under challenging conditions.
Based on the YOLOv8 network model, this paper designs an architecture with hierarchical collaborative attention modeling and proposes a facial expression recognition network based on a dual-attention mechanism, named FER-SDAM (Facial Expression Recognition Network based on the Synergy Dual Attention Mechanism), which achieves efficient real-time inference. The proposed architecture enhances the perception of local structures in emotion-sensitive regions, such as the eyes and corners of the mouth, through a shallow Multidimensional Collaborative Attention (MCA) [
7] module, while modeling global semantic dependencies via a deep Transformer Block Enhancement Module (TBEM) [
8]. To explicitly bridge the gap between these heterogeneous representations, we introduce an Attention Consistency Loss (ACL), which constrains the spatial differences in attention maps across different levels, thereby promoting consistent attention patterns.
Extensive experiments are conducted on AffectNet, RAF-DB, and their variants with occlusion and pose perturbations. The results demonstrate that FER-SDAM achieves competitive recognition accuracy with low computational overhead, striking a good balance between accuracy and efficiency. In particular, the proposed method exhibits strong robustness, making it suitable for real-time deployment in service robots.
The main contributions of this paper are summarized as follows:
(1) We propose a hierarchical attention-cooperative FER framework designed specifically for real-time robotics applications, which effectively balances recognition performance and computational efficiency.
(2) We introduce an attention coordination mechanism with explicit consistency constraints by designing an Attention Consistency Loss (ACL). By spatially aligning attention maps of shallow local features with those of deep global semantics, we mitigate attention divergence and enhance robustness under occlusion and pose variations.
(3) Extensive experiments demonstrate that, compared to existing methods, our proposed approach achieves a superior trade-off between accuracy and efficiency and exhibits strong practical value in real-world human–robot interaction scenarios.
5. Experimental Results and Discussion
5.1. Comparison with Current State-of-the-Art Methods
5.1.1. Performance Comparison on the AffectNet and RAF-DB
As shown in
Table 4, FER-SDAM demonstrates a clear competitive edge on the large-scale, “real-world” AffectNet dataset, which is significantly more challenging than RAF-DB due to its vast diversity. Under AffectNet-7 and AffectNet-8 settings, our model achieves accuracy rates of 68.12% and 66.68% respectively, outperforming recent state-of-the-art methods like BTN [
31] and Ada-DF++ [
32].
Although FER-SDAM’s accuracy (88.87%) on the smaller RAF-DB dataset is slightly lower than that of heavyweight architectures such as POSTER++ [
34] (92.21%), as discussed in the performance comparison section, FER-SDAM prioritizes hardware-efficient deployment, achieving a ‘cost-effective’ balance suitable for mobile service robots.
5.1.2. Performance Comparison on Occlusion and Pose Variant Datasets
The experimental results in
Table 5 and
Table 6 further highlight the robustness and reliability of our FER-SDAM under non-ideal conditions.
Occlusion Robustness (
Table 5): FER-SDAM achieves the highest accuracy of 85.63% on Occlusion-RAF-DB, slightly outperforming the current best-performing PCNN network [
38]. On the Occlusion-AffectNet dataset, FER-SDAM achieves a accuracy of 69.59%, which is more than 5 percentage points higher than AMP-Net [
39] and 11 percentage points higher than the region-based RAN [
22]. This indicates that when specific regions are occluded, traditional region-based methods (such as RAN) lose critical information, whereas our ACL effectively aligns shallow-level textures with deep-level global semantics, enabling the network to recover affective cues from the remaining visible regions.
Table 5.
Comparison with state-of-the-art methods on Occlusion-RAF-DB and Occlusion-AffectNet datasets.
Table 5.
Comparison with state-of-the-art methods on Occlusion-RAF-DB and Occlusion-AffectNet datasets.
| Methods | Year | Accuracy (%) |
|---|
| | | Occlusion-RAF-DB | Occlusion-AffectNet |
|---|
| RAN [22] | 2020 | 82.72 | 58.5 |
| MA-Net [15] | 2021 | 83.65 | 59.59 |
| VTFF [13] | 2021 | 83.95 | 62.98 |
| AMP-Net [39] | 2022 | 85.28 | 64.27 |
| CRS-CONT [40] | 2022 | 84.63 | 60.91 |
| MGR3Net [30] | 2023 | 84.43 | 60.67 |
| SLW-LDT [41] | 2025 | 85.14 | 61.89 |
| CC-KD [42] | 2025 | 86.12 | - |
| PCNN [38] | 2025 | 85.56 | - |
| FER-SDAM (Ours) | - | 86.54 | 69.59 |
Pose Variation Robustness (
Table 6): Under extreme pose conditions (yaw angle
), our method maintains superior performance compared to Pose-RAF-DB (91.77%) and Pose-AffectNet (66.51%), outperforming the current state-of-the-art HAM [
20] by approximately 2–3 percentage points. This result demonstrates the effectiveness of our proposed hierarchical attention coordination strategy: by precisely capturing facial geometric deformations through the shallow MCA module and combining it with TBEM for deep-level semantic enhancement, the model successfully overcomes the challenge of feature distortion caused by pose variations.
Table 6.
Comparison with state-of-the-art methods on Pose-RAF-DB and Pose-AffectNet datasets.
Table 6.
Comparison with state-of-the-art methods on Pose-RAF-DB and Pose-AffectNet datasets.
| Methods | Year | Pose-RAF-DB (%) | Pose-AffectNet (%) |
|---|
| | | (>) | (>) | (>) | (>) |
|---|
| RAN [22] | 2020 | 86.74 | 85.2 | 53.9 | 53.19 |
| MA-Net [15] | 2021 | 87.89 | 87.99 | 57.51 | 57.78 |
| VTFF [13] | 2021 | 87.97 | 88.35 | 60.61 | 61 |
| AMP-Net [39] | 2022 | 89.75 | 89.25 | 61.37 | 61.16 |
| MGR3Net [30] | 2023 | 88.07 | 88.13 | 57.98 | 58.45 |
| HAM [20] | 2023 | 92.47 | 91.76 | 62.99 | 63.25 |
| MM-Net [43] | 2023 | 89.74 | 89.07 | - | - |
| SLW-LDT [41] | 2025 | 89.33 | 88.71 | 58.47 | 57.62 |
| CC-KD [42] | 2025 | 90.15 | 89.07 | - | - |
| ADMF-ER [44] | 2025 | 90.62 | 91.13 | 64.92 | 65.25 |
| PCNN [38] | 2025 | 89.74 | 88.38 | - | - |
| FER-SDAM (Ours) | - | 90.22 | 91.77 | 65.76 | 66.51 |
In summary, FER-SDAM consistently exhibits reliable recognition capabilities regardless of whether it faces partial occlusion or significant pose deviations. These results validate the network’s exceptional adaptability in complex human–robot interaction scenarios, as well as the theoretical soundness of our attention coordination paradigm.
5.2. Ablation Study
To systematically evaluate the contribution of each individual component within the FER-SDAM framework, we conduct incremental ablation experiments on the AffectNet and RAF-DB datasets. The quantitative results are summarized in
Table 7.
Compared with the YOLOv8s baseline, the independent integration of either the MCA or TBEM module yields performance gains on AffectNet-7. However, the improvements are relatively constrained, with marginal fluctuations observed across AffectNet-8 and RAF-DB. This suggests that a decoupled enhancement of either local textures or global dependencies is insufficient to maintain consistent robustness across diverse data distributions. The simultaneous incorporation of MCA and TBEM outperforms any single-module configuration across all benchmarks. This performance boost validates the complementarity between local multi-scale feature refinement and long-range semantic modeling, effectively bridging the gap between fine-grained expression details and holistic context. The most significant performance leap is observed with the introduction of the AS mechanism. Specifically, the full FER-SDAM model achieves accuracies of 68.12%, 66.68%, and 88.87% on the three datasets, representing a substantial improvement of 2.12%, 4.08%, and 3.37% over the baseline, respectively. This steady advancement demonstrates that the AS mechanism effectively harmonizes heterogeneous attention responses, mitigating semantic conflicts and significantly enhancing the model’s discriminative power and stability in complex HRI scenarios.
5.3. Influence of the Sensitivity Coefficient
To investigate the sensitivity of model performance to the weight coefficient
in the attention consistency loss, we conducted comparative experiments on the RAF-DB, AffectNet-7, and AffectNet-8 datasets, with
varying from 0.0 to 0.7, ensuring that the proposed attention consistency loss
and the detection loss
are of the same order of magnitude. The results are illustrated in
Figure 5.
Overall, the model’s performance exhibits a trend of ‘initial fluctuation, peak attainment, and subsequent degradation’ as increases. When is relatively small (), the consistency constraint is insufficient to align the hierarchical attention maps, resulting in limited performance gains. As increases into the range of 0.1 to 0.3, the recognition accuracy on all three datasets improves significantly. Specifically, RAF-DB achieves its peak accuracy of 88.87% at both and , while AffectNet-7 and AffectNet-8 reach their optimal performance (68.12% and 66.68%, respectively) at .
It is noteworthy that a slight performance dip occurs at across all datasets, which may be attributed to a temporary optimization imbalance between the detection and consistency loss terms. When exceeds 0.4, the model begins to be affected by an over-constrained attention mechanism, and the accuracy across all datasets shows a sustained decline to varying degrees. At this point, the Attention Consistency Loss excessively influences the optimization process. Under these conditions, the deep semantic layers are overly constrained in order to align with the shallow attention distributions, resulting in reduced flexibility when modeling global dependencies. From an optimization perspective, this over-constraint may lead to negative transfer. Shallow attention often captures detailed but noisy local patterns, which are not always semantically relevant. When forced alignment becomes too strong, these noisy or misleading local signals are propagated to deeper layers, amplifying biases and interfering with the learning of high-level semantic representations. This creates an optimization conflict between the goal of minimizing attention divergence and the goal of maximizing the discriminative power specific to the task, thus affecting the representational capacity of the model and leading to a decrease in performance. Our experimental results indicate that the optimal trade-off is achieved when . At this value, attention alignment is sufficiently ensured without suppressing semantic diversity, thereby effectively avoiding negative transfer.
5.4. Visualization Analysis
To gain deeper insights into the underlying mechanisms of the hierarchical attention synergy (AS) mechanism, we employed the Grad-CAM algorithm to visualize and compare attention distributions across different model configurations (
Figure 6).
The baseline model (YOLOv8s) can roughly locate facial regions, but its attention distribution is relatively diffuse and susceptible to interference from background or irrelevant areas. When only the MCA (Variant A) is integrated, the model’s focus on locally emotion-sensitive regions (such as the corners of the eyes and nostrils) markedly increases while effectively suppressing background noise. Its attention distribution exhibits locally high-response peaks. Conversely, when only the TBEM (Variant B) is introduced to model long-range semantic dependencies, the model’s perception of overall facial structure significantly improves, with broader attention coverage. However, it lacks pronounced peak responses in key emotional regions. Furthermore, when MCA and TBEM are jointly trained but independently optimized (Variant C), the attention distribution stabilizes and concentrates primarily on core regions of emotional expression. However, the true performance leap occurs upon introducing the AS mechanism (FER-SDAM), which explicitly aligns the spatial distribution of shallow structural perception with deep global semantics through Attention Consistency Loss (ACL).
ACL enforces spatial consistency between local and global attention, establishing a strongly coupled co-optimization paradigm. This design effectively overcomes the semantic fragmentation issues caused by traditional “local–global independent optimization.” As shown in
Figure 5, FER-SDAM’s heatmap not only preserves the integrity of global facial structures but also exhibits highly focused and intensely activated responses at key expression action units (e.g., brow furrowing, lip corner elevation). This “hierarchically progressive, semantically aligned” attention evolution mechanism constitutes the core mechanism enabling the model’s high robustness under challenging conditions such as occlusion or extreme lighting: even when partial local features are missing due to occlusion, global semantic information can guide attention to dynamically refocus on remaining reliable emotion-sensitive regions via ACL, thereby maintaining stable recognition performance.
5.5. F1-Score and Confusion Matrix
In this study, we compared the F1 scores and normalized confusion matrices of FER-SDAM and the baseline model (YOLOv8s) on the AffectNet and RAF-DB datasets.
As shown in
Table 8, on the challenging AffectNet dataset, FER-SDAM achieved a 4.08% increase in precision while simultaneously improving the F1 score by 0.1. On the RAF-DB dataset, the F1 score also improved by 0.2. This indicates that FER-SDAM effectively balances precision and recall, ensuring robust performance even under class-imbalanced conditions.
In the normalized confusion matrices shown in
Figure 7 and
Figure 8, FER-SDAM exhibits a more pronounced diagonal dominance and lower off-diagonal confusion, indicating stronger discriminative power between visually similar facial expressions.
For easily distinguishable emotions such as ‘Happy’, both models achieve high accuracy on both datasets, while FER-SDAM further improves or maintains the performance of several challenging categories. On AffectNet (
Figure 7), FER-SDAM yields notable improvements in the recognition of ‘Neutral’, ‘Surprise’, ‘Disgust,’ and ‘Sad’. On RAF-DB (
Figure 8), FER-SDAM increases the recognition rates of ‘Surprise’, ‘Fear’, ‘Disgust’, and ‘Sad’ by 3%, 5%, 2%, and 1%, respectively, while simultaneously reducing the confusion among ‘Disgust’, ‘Fear’, ‘Neutral’, and ‘Angry’.
These results indicate that FER-SDAM exhibits stronger discriminative ability in distinguishing visually similar emotion categories, validating the effectiveness of hierarchical attention co-modeling in fine-grained facial expression modeling.
Moreover, the accuracy of ‘Fear’ and ‘Angry’ on AffectNet, as well as those of ‘Angry’ and ‘Neutral’ on RAF-DB, remains comparable between the two models. This suggests that the AS mechanism does not impact the performance of relatively easy categories.
5.6. Comparison of Computational Efficiency
We compare the computational overhead of each method and the results are shown in
Table 9.
The parameters of AMP-Net [
39], POSTER++ [
34] and PCNN [
38] are 59.44 M, 43.7 M and 51.00 M, respectively, while the proposed method is only 11.93 M, which reduces the parameters by about 80% compared with AMP-Net. In terms of computational complexity, the MACs of our method is only 1.79 G, which is about 62.2%, 78.9%and 87.9% lower than that of AMP-Net, POSTER++ and PCNN, respectively, which significantly reduces the computational burden of the model. The average inference time of each image on GPU is 10.29 ± 0.20 ms, which is basically the same as that of PCNN and significantly better than that of AMP-Net and POSTER++. The corresponding frame rate reaches 97.21 FPS, which is the highest among all methods, and fully meets the requirements of real-time and even high-speed scenes.
We further compared FER-SDAM with representative lightweight architectures to assess its edge-side deployment potential. As shown in
Table 9, although extreme-lightweight baselines like MobileNetV2 and ShuffleNetV2 achieve higher inference speeds, their recognition accuracy drops significantly. In contrast, FER-SDAM strikes a superior balance: it achieves an accuracy of 0.89—on par with heavyweight models—while maintaining an average inference time of
ms. The corresponding frame rate of 97.21 FPS far exceeds the 25 FPS threshold required for real-time human–robot interaction. These results demonstrate that FER-SDAM offers exceptional efficiency and robustness, making it a highly practical solution for real-world deployment on embedded robotic platforms.
5.7. FER-SDAM Applied to Emotional Robot Recognition
To evaluate the system’s performance on edge devices, this paper conducts a controlled comparison between FER-SDAM and the baseline model YOLOv8s on the robotic platform shown in
Figure 9(left). The robotic system integrates a high-resolution camera, an interactive display terminal, a mobile chassis equipped with a control motherboard and drive wheels, and an industrial PC (Intel i5 CPU + NVIDIA GeForce MX250 (2GB) GPU).
Both models were tested in real time using 256 × 256 image inputs under identical human–robot interaction (HRI) conditions, covering both the normal environment shown in
Figure 9 and typical non-ideal scenarios involving occlusion, pose changes, low-light conditions, and complex backgrounds. Each scenario was tested independently in 100 interaction sessions, with the recognition results serving as the trigger signal for the robot’s voice-based emotional feedback. Evaluation was based on three key metrics: average recognition accuracy, inference frame rate, and interaction delay (including the delay of the facial detector). The results are shown in
Table 10.
As shown in
Table 10, FER-SDAM demonstrates excellent operational stability and perception reliability in real-world environments. Although the baseline model, YOLOv8s, achieves a high frame rate, its interaction latency fluctuates more significantly under complex conditions (up to ±12 ms). In contrast, FER-SDAM maintains a stable latency of 55–64 milliseconds, ensuring more natural and fluid human–computer interaction. More importantly, the proposed method demonstrates superior accuracy in non-ideal scenarios. In environmental tests classified as complex, FER-SDAM maintained an accuracy of 90.0%, which is 18.0% higher than that of the baseline method. This confirms that our hierarchical attention coordination mechanism effectively mitigates environmental interference.
To further evaluate the model’s reliability,
Figure 9(right) shows exemplary qualitative results. As demonstrated in
Figure 9b,c, even when subjects wear masks or are in cluttered backgrounds, FER-SDAM maintains high-confidence recognition by focusing on visible emotion-sensitive regions (e.g., the eyes) through its collaborative attention mechanism. Under dim lighting (
Figure 9d), the model identifies subtle local muscle tension changes in the ‘Fear’ expression, showcasing robust feature extraction capabilities.
Finally, to explore the algorithm’s boundaries, we conducted a quantitative failure analysis focused on head pose variations. The results indicate that FER-SDAM maintains high robustness (accuracy
) for yaw angles within
. However, when the facial yaw angle exceeds 50° (as shown in
Figure 9f), the accuracy drops to approximately 62.0%. This degradation is primarily due to extreme geometric distortion and the significant loss of key facial features, reflecting the inherent physical perception limitations of monocular vision systems under drastic pose variations. Overall, these results validate FER-SDAM’s robustness, real-time performance, and suitability for complex real-world interactive scenarios.
6. Conclusions
In this paper, we present FER-SDAM, a synergetic dual-attention network specifically engineered for emotional service robots. By establishing a hierarchical modeling paradigm, the proposed framework successfully bridges the gap between shallow-level structural perception and deep-level global semantic dependencies. The core of our approach, the Attention Synergy (AS) mechanism, effectively harmonizes heterogeneous attention responses through structural regularization. This alignment not only alleviates the semantic conflicts inherent in multi-module learning but also fosters a coherent and interpretable attention pattern, which is fundamental for ensuring the perceptual stability of robots in unconstrained settings.
Experimental results demonstrate that FER-SDAM not only achieves an optimal balance between recognition accuracy and computational efficiency but also exhibits stable and robust performance under challenging conditions such as occlusion and large pose variations, thereby providing an efficient and well-rounded solution for facial expression recognition in service robotics applications. As a highly practical solution, FER-SDAM lays a solid technical foundation for the development of next-generation emotional robots, enabling them to integrate more deeply into social service scenarios and achieve complex human–robot emotional interactions.