# Swin-FER: Swin Transformer for Facial Expression Recognition
## 4 Experiment Results and Analysis
### Comparison of Experimental Accuracy  
The accuracy of the Swin-Fer network structure proposed in this paper along with the accuracies of other methods introduced in the past five years on the FER2013 and CK+ datasets are compared in Table 6. Some representative research on FER2013 achieved more than 70% accuracy, which shows that facial expression recognition tasks in natural environments are challenging. Adjusting network structures and optimizing hyperparameters can help capture complex features in images, thus further improving model performance. This paper has explored using transformer methods to handle facial expression recognition tasks, focusing on designing the Swin-Fer network model. With the network parameters mostly unchanged, competitive experimental results were achieved, with an accuracy of 71.11%. In addition, the third column of Table 6 compares the accuracies of different network structures on the CK+ dataset, and these accuracies are for the most part very high, with the lowest accuracy reaching 96.25%. The method proposed in this paper, Swin-Fer, achieved 100%. These experimental results enhance confidence in the generalization ability of the model.  
To further compare the effectiveness of the proposed model, we conducted training on a larger dataset, AffectNet. AffectNet is a large-scale facial expression dataset designed for training and evaluating facial expression recognition models. It contains over one million facial images collected from the Internet, with approximately 45,000 manually annotated images for eight emotion categories. The images in the AffectNet dataset typically have a resolution of 256 \(\times\) 256 pixels. These images cover a wide range of facial expressions and poses, making the dataset suitable for research on emotion analysis and facial expression recognition. This resolution is appropriate for training and testing deep learning models, particularly those that require high-resolution inputs, such as transformer models. Table 7 shows the comparison of experimental accuracy across different methods on the AffectNet (eight emotions) dataset.  
As indicated in Tables 6 and 7, although the proposed method did not achieve the highest accuracy on the FER2013 dataset, it demonstrated superior performance on the AffectNet (eight emotions) dataset compared to other advanced models. The larger resolution  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Network** & **Fer2013** & **CK+** \\ \hline CNN using the Adamax optimizer [20] & 66\% & - \\ VGG16+SE Block [21] & 66.8\% & 99.18\% \\ DeepEmotion [22] & 70.02\% & 98\% \\ Swin transformer & 70.70\% & 96.25\% \\ Improved CNN based on center loss [23] & 71.39\% & 96.64\% \\ SSER [24] & 71.62\% & 97.59\% \\ Multi-Channel Attention Residual Network [25] & **72.7**\% & 98.8\% \\ ResNet-50 + pyramid + cascaded attention block + GRU [26] & - & 99.23\% \\ ViT+SE [27] & - & 99.8\% \\ Swin-Fer & 71.11\% & **100\%** \\ \hline \hline \end{tabular}
\end{table}
Table 6: Comparison of experimental accuracy of different methods on FER2013 and CK+ datasets.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Network** & **AffectNet (Eight Emotions)** \\ \hline EfficientFace [28] & 59.89\% \\ SL + SSL puzzling (B2) [29] & 61.32\% \\ Multi-Task EfficientNet-B0 [30] & 61.32\% \\ DAN [31] & 62.09\% \\ CAGE [32] & 62.30\% \\ Vit-base + MAE [33] & 62.42\% \\
**Swin-Fer** & **63.29\%** \\ \hline \hline \end{tabular}
\end{table}
Table 7: Comparison of experimental accuracy of different methods on AffectNet datasets.  
and color images of AffectNet likely better suit the capabilities of Swin-Fer, highlighting its strength in extracting feature information from high-resolution color images. This suggests that Swin-Fer, based on the Swin transformer for feature extraction, performs well in settings where input images are of larger spatial dimensions, allowing the model to extract more effective feature information.