Submitted:
25 November 2025
Posted:
26 November 2025
You are already at the latest version
Abstract
Keywords:
1. Introduction
2. Related Work
2.1. Deep Learning Approaches for Pain Recognition
2.2. Attention Mechanisms in Medical Image Analysis
2.3. Limitations of Existing Architectures
- Weak Inter-class Discrimination
- 2.
- Probability Mis-calibration
- 3.
- Dataset Bias and Limited Generalization
- 4.
- Lack of Uncertainty Quantification and Explainability
2.4. Research Gaps
3. Materials and Methods
3.1. Label Consolidation and Class Balancing (PSPI mapping)
| PSPI Range | New Label ID | Clinical Descriptor |
|---|---|---|
| 0 | 0 | No Pain |
| 1 | 1 | Mid Pain |
| 2 to 3 | 2 | Moderate Pain |
| 4 to 6 | 3 | Very Pain |
| 7 to 10 | 4 | Severe Pain |
3.2. Data Partitioning and Stratified Sampling
3.3. Image Preprocessing and Data Augmentation
3.4. Dataset Demographics and Bias Mitigation Analysis

3.5. Data Quality and Integrity Validation
4. Proposed Framework
4.1. Overview of the Entire Methodology
4.2. Dual-Attention Architecture
- Multi-head Spatial Attention
- 2.
- Enhanced Channel Attention with Triple Pooling
4.3. Regularization and Optimization Strategy
- Optimization Function
- 2.
- Label Smoothing Regularization
- 3.
- Dropout and regularization
- 4.
- Learning-rate scheduling
- 5.
- Training Protocol
5. Experimental Setup
5.1. Hyperparameter Optimization and Tuning Strategy
6. Results
6.1. Quantitative Performance Comparison with Baseline Models
6.1. Class-Wise Analysis and Confusion Matrix Interpretation
6.1. ROC–A, Calibration, and Reliability Evaluation
6.1. Ablation Studies on Attention, Augmentation, and Regularization Modules

6.1. Visual Interpretability and Grad-Cam-Based Clinical Insights

6.1. Statistical Validation and Confidence Interval Analysis
6.1. Comparative Discussion with State-of-the-Art Methods
7. Limitations and Future Work
8. Conclusions
Funding
Acknowledgments
References
- De Sario, G.D.; Haider, C.R.; Maita, K.C.; et al. Using AI to detect pain through facial expressions: a review. Bioengineering 2023, 10, 548. [Google Scholar] [CrossRef]
- Xin, X.; Lin, X.; Yang, S.; Zheng, X. Pain intensity estimation based on a spatial transformation and attention CNN. PLOS ONE 2020, 15, e0232412. [Google Scholar] [CrossRef] [PubMed]
- Karamitsos, I.; Seladji, I.; Modak, S. A Modified CNN Network for Automatic Pain Identification Using Facial Expressions. J. Softw. Eng. Appl. 2021, 14, 400–417. [Google Scholar] [CrossRef]
- Rathee, N.; Pahal, S.; Sheoran, P. Pain detection from facial expressions using domain adaptation technique. Pattern Anal. Appl. 2021, 25, 567–574. [Google Scholar] [CrossRef]
- Prkachin, K.M.; Solomon, P.E. The structure, reliability and validity of pain expression: Evidence from patients with shoulder pain. Pain 2008, 139, 267–274. [Google Scholar] [CrossRef]
- Cronin, N.J.; Finni, T.; Seynnes, O. Using deep learning to generate synthetic B-mode musculoskeletal ultrasound images. Comput. Methods Programs Biomed. 2020, 196, 105583. [Google Scholar] [CrossRef]
- Hu, J.; Shen, L.; Sun, G. Squeeze-and-excitation networks. In Proceedings of the IEEE conference on computer vision and pattern recognition; 2018; pp. 7132–7141. [Google Scholar]
- Woo, S.; Park, J.; Lee, J.-Y.; Kweon, I.S. CBAM: Convolutional Block Attention Module. In Proceedings of the European conference on computer vision (ECCV); 2018; pp. 3–19. [Google Scholar]
- Guo, C.; Pleiss, G.; Sun, Y.; Weinberger, K.Q. On calibration of modern neural networks. in international conference on machine learning, 2017, pp. 1321–1330: PMLR.
- Rajaraman, S.; Ganesan, P.; Antani, S. Deep learning model calibration for improving performance in class-imbalanced medical image classification tasks. PLOS ONE 2022, 17, e0262838. [Google Scholar] [CrossRef]
- Islam, M.; Glocker, B. Spatially varying label smoothing: Capturing uncertainty from expert annotations. In international conference on information processing in medical imaging, 2021, pp. 677–688: Springer.
- Javeed, M.U.; Aslam, S.M.; Sadiqa, H.A.; Raza, A.; Iqbal, M.M.; Akram, M. Phishing Website URL Detection Using a Hybrid Machine Learning Approach. Journal of Computing & Biomedical Informatics 2025, 9. [Google Scholar]
- Raza, A.; Zongxin, S.; Qiao, G.; Javed, M.; Bilal, M.; Zuberi, H.H.; Mohsin, M. Automated classification of humpback whale calls in four regions using convolutional neural networks and multi scale deep feature aggregation (MSDFA). Measurement 2025, 255. [Google Scholar] [CrossRef]
- Raza, A.; Javed, M.; Fayad, A.; Khan, A.Y. Advanced Deep Learning-Based Predictive Modelling for Analyzing Trends and Performance Metrics in Stock Market. J. Account. Finance Emerg. Econ. 2023, 9, 277–294. [Google Scholar] [CrossRef]
- Nauman, M.; Ashraf, S.; Javeed, M.U.; Aslam, S.M.; Farooq, U.; Raza, A. Deep transfer learning for COVID-19 screening: Benchmarking ResNet50, VGG16, and GoogleNet on chest X-ray images. International Journal of Advanced Computing & Emerging Technologies 2025, 1, 69–83. [Google Scholar]
- Javeed, M.U.; et al. Unveiling Ambivalence in Reviews: Using Sentence-BERT and K-NN for Airline Recommendations. Technical Journal 2025, 30, 51–59. [Google Scholar]
- Raza, A.; et al. A Hybrid Machine Learning Framework for Personalized News Recommendation. International Journal of Advanced Computing & Emerging Technologies 2025, 1, 49–62. [Google Scholar]
- Raza, A.; et al. Intelligent Image Gallery System Using Deep Learning for Automated Fruit and Vegetable Classification. International Journal of Advanced Computing & Emerging Technologies 2025, 1, 1–15. [Google Scholar]
- Sambyal, A.S.; Niyaz, U.; Shrivastava, S.; Krishnan, N.C.; Bathula, D.R. Ls+: Informed label smoothing for improving calibration in medical image classification. In International Conference on Medical Image Computing and Computer-Assisted Intervention, 2024, pp. 513–523: Springer.
- Gao, R.; et al. A Comparative Study of Confidence Calibration in Deep Learning: from Computer Vision to Medical Imaging. arXiv 2022, arXiv:2206.08833. [Google Scholar] [CrossRef]
- Pineau, J.; et al. Improving reproducibility in machine learning research (a report from the neurips 2019 reproducibility program). Journal of machine learning research 2021, 22, 1–20. [Google Scholar]
- Hutson, M. Artificial intelligence faces reproducibility crisis. Science 2018, 359, 725–726. [Google Scholar] [CrossRef] [PubMed]
- Song, I.; Kim, D.-S.; Park, J.-E.; Kim, S.; Jung, Y.; Park, S.; Kang, E.; Yang, B.R.; Choi, S.-E. A Review of Regulatory Policies for AI-Enabled Software as a Medical Device in the United States and Europe and Approval Status in Korea. Yakhak Hoeji 2025, 69, 201–211. [Google Scholar] [CrossRef]
- Simkó, A.; Garpebring, A.; Jonsson, J.; Nyholm, T.; Löfstedt, T. Reproducibility of the Methods in Medical Imaging with Deep Learning. In Medical Imaging with Deep Learning, 2024, pp. 95–106: PMLR.
- Loshchilov, I.; Hutter, F. Decoupled weight decay regularization. arXiv 2017, arXiv:1711.05101. [Google Scholar]
- Lucey, P.; Cohn, J.F.; Prkachin, K.M.; Solomon, P.E.; Chew, S.; Matthews, I. Painful monitoring: Automatic pain monitoring using the UNBC-McMaster shoulder pain expression archive database. Image Vis. Comput. 2012, 30, 197–205. [Google Scholar] [CrossRef]
- Papoutsakis, K.E.; Argyros, A.A. Integrating tracking with fine object segmentation. Image Vis. Comput. 2013, 31, 771–785. [Google Scholar] [CrossRef]
- Kaltwang, S.; Rudovic, O.; Pantic, M. Continuous pain intensity estimation from facial expressions. In International Symposium on Visual Computing, 2012, pp. 368–377: Springer.
- Lucey, P.; Cohn, J.F.; Prkachin, K.M.; Solomon, P.E.; Matthews, I. Painful data: The UNBC-McMaster shoulder pain expression archive database. In Proceedings of the 2011 IEEE International Conference on Automatic Face & Gesture Recognition (FG), Santa Barbara, CA, USA, 21–25 March 2011; pp. 57–64. [Google Scholar] [CrossRef]
- Sariyanidi, E.; Gunes, H.; Cavallaro, A. Automatic Analysis of Facial Affect: A Survey of Registration, Representation, and Recognition. IEEE Trans. Pattern Anal. Mach. Intell. 2014, 37, 1113–1133. [Google Scholar] [CrossRef]
- Murphy, K.P. Machine Learning: A Probabilistic Perspective; MIT Press, 2012. [Google Scholar]
- Ye, X.; Liang, X.; Hu, J.; Xie, Y. Image-Based Pain Intensity Estimation Using Parallel CNNs with Regional Attention. Bioengineering 2022, 9, 804. [Google Scholar] [CrossRef] [PubMed]
- Khomidov, M.; Lee, J.-H. The Novel EfficientNet Architecture-Based System and Algorithm to Predict Complex Human Emotions. Algorithms 2024, 17, 285. [Google Scholar] [CrossRef]
- Gao, Y.; Xie, Y.; Hu, Z.Z.; Chen, T.; Lin, L. Adaptive Global-Local Representation Learning and Selection for Cross-Domain Facial Expression Recognition. IEEE Trans. Multimedia 2024, 26, 6676–6688. [Google Scholar] [CrossRef]
- Oktay, O.; et al. Attention u-net: Learning where to look for the pancreas. arXiv 2018, arXiv:1804.03999. [Google Scholar] [CrossRef]
- AL Qurri, A.; Almekkawy, M. Improved UNet with Attention for Medical Image Segmentation. Sensors 2023, 23, 8589. [Google Scholar] [CrossRef]
- Xie, Y.; Yang, B.; Guan, Q.; Zhang, J.; Wu, Q.; Xia, Y. Attention mechanisms in medical image segmentation: A survey. arXiv 2023, arXiv:2305.17937. [Google Scholar] [CrossRef]
- Jiangtao, W.; Ruhaiyem, N.I.R.; Panpan, F. A Comprehensive Review of U-Net and Its Variants: Advances and Applications in Medical Image Segmentation. IET Image Process. 2025, 19. [Google Scholar] [CrossRef]
- Lei, Z.; Chen, H.; Wen, G.; Feng, K.; Liu, Z.; Yan, R.; Chen, X. A Synchronous Holo-Balancing Method for Flexible Rotors Based on the Modified Initial Phase Vector. Inf. Fusion 2022, 90, 95–110. [Google Scholar] [CrossRef]
- Shorten, C.; Khoshgoftaar, T.M. A survey on Image Data Augmentation for Deep Learning. J. Big Data 2019, 6, 60. [Google Scholar] [CrossRef]
- Perez, L.; Wang, J. The effectiveness of data augmentation in image classification using deep learning. arXiv 2017, arXiv:1712.04621. [Google Scholar] [CrossRef]
- Goceri, E. Medical image data augmentation: techniques, comparisons and interpretations. Artif. Intell. Rev. 2023, 56, 12561–12605. [Google Scholar] [CrossRef] [PubMed]











| Model Name | Test Accuracy (%) | F1-Score (%) | Cohen’s κ | Macro-AUC | Micro-AUC | Validation Accuracy (%) |
|---|---|---|---|---|---|---|
| MicroPainNet | 86.27 | 86.0 | 0.842 | 0.982 | 0.983 | 82.10 ± 1.62 |
| SimpleCNN_Baseline | 84.56 | 84.1 | 0.829 | 0.981 | 0.981 | 81.42 ± 1.74 |
| PainXception | 87.34 | 87.0 | 0.851 | 0.986 | 0.987 | 82.85 ± 1.63 |
| Facial_ExpressionCNN_Proposed (DA-CNN) | 90.19 ± 0.94 | 90.0 | 0.876 | 0.991 | 0.992 | 83.60 ± 1.55 |
| Configuration | Spatial Attn | Channel Attn (Triple Pooling) | Data Augment | Label Smoothing | Accuracy (%) | F1-Score (%) | ECE (%) |
|---|---|---|---|---|---|---|---|
| Baseline CNN | ✗ | ✗ | ✓ | ✗ | 84.6 | 84.1 | 5.8 |
| + Spatial Attn | ✓ | ✗ | ✓ | ✗ | 87.8 | 87.0 | 5.3 |
| + Channel Attn | ✗ | ✓ | ✓ | ✗ | 87.3 | 86.5 | 5.4 |
| + Both Attn | ✓ | ✓ | ✓ | ✗ | 88.9 | 88.1 | 4.7 |
| + Full DA-CNN (Proposed) | ✓ | ✓ | ✓ | ✓ | 90.2 | 90.0 | 3.1 |
| Model | Attention Type | Data Augmentation | Accuracy (%) | F1-Score (%) | AUC | ECE (%) |
| Baseline CNN | None | ✓ | 84.6 | 84.1 | 0.962 | 5.8 |
| MicroPainNet | Channel (SE) | ✓ | 86.3 | 86.0 | 0.973 | 5.2 |
| PainXception | Spatial (Head-wise) | ✓ | 87.3 | 87.0 | 0.978 | 4.6 |
| DA-CNN (Proposed) | Dual (Spatial + Channel) | ✓ | 90.2 ± 0.94 | 90.0 | 0.992 | 3.1 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).