A Hybrid Facial Expression Recognition System Based on Machine Learning and Deep Learning Models
Main Article Content
บทคัดย่อ
Pain assessment through facial expressions is an important area of research because many patients cannot clearly communicate their pain levels. This study presents the first systematic comparison of continuous time-series versus tokenized sequence representations for facial action unit (AU)-based pain classification, introducing a novel application of NLP models (BERT) to discretized AU sequences treated as symbolic text. Two datasets were used: the UNBC-McMaster Shoulder Pain Archive (UNBC-SP) with about 48,000 frames, and the Multimodal Intensity Pain (MIntPain) dataset with about 187,900 frames. Action unit intensities were extracted using the Py-Feat library and then normalized, oversampled, and augmented. A range of models was tested, including random forest, support vector machine, recurrent neural networks, and BERT. Key contributions include: (1) demonstrating that continuous time-series models significantly outperform tokenized approaches (91% vs. 82% accuracy); (2) revealing that classical ensemble methods surpass deep learning on tokenized sequences in data-limited scenarios; and (3) establishing that disruptive augmentations harm performance while conservative methods maintain accuracy. The continuous-time series models achieved the best performance, reaching 91% accuracy on MIntPain and 84% on UNBC-SP, while the tokenized models peaked at 82%. The results suggest that preserving temporal details of facial action units provides an advantage for pain detection, especially with larger datasets, though tokenization may retain value in resource-limited settings. The study highlights the need for larger, more diverse datasets and for validation in real clinical settings to improve the reliability of automatic pain recognition.
Article Details

อนุญาตภายใต้เงื่อนไข Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
เอกสารอ้างอิง
Miller, K. D.; Leticia, N.; Theresa, D. Cancer Treatment and Survivorship Statistics, 2022. CA Cancer J. Clin. 2022, 5, 409–436. https://doi.org/10.3322/caac.21731
Parikh, R. B.; Kirch, R. A.; Thomas, J. S. Early Specialty Palliative Care—Translating Data in Oncology into Practice. N. Engl. J. Med. 2013, 24, 2347–2351. https://doi.org/10.1056/NEJMsb1305469
Laura, A. P. M. Why and How to Integrate Early Palliative Care into Cutting-Edge Personalized Cancer Care. J. Clin. Oncol. Educ. Book 2024.
World Health Organization. Palliative Care; World Health Organization: Geneva, Switzerland, 2023; https://www.who.int/europe/news-room/fact-sheets/item/palliative-care (accessed June 1, 2023).
Clark, D.; Nicole, B.; Clelland, E. G. Mapping Levels of Palliative Care Development in 198 Countries: The Situation in 2017. J. Pain Symptom Manage. 2020, 794–807. https://doi.org/10.1016/j.jpainsymman.2019.11.009
Dowell, D.; Ragan, K.; Jones, C. CDC Clinical Practice Guideline for Prescribing Opioids for Pain—United States, 2022. MMWR Recomm. Rep. 2022. https://doi.org/10.15585/mmwr.rr7103a1
Cohen, B.; Leigh, J. R.; Charles, V. P. Opioid Analgesics; StatPearls Publishing: Treasure Island, FL, USA, 2017.
De, S.; Gioacchino, D. Using AI to Detect Pain through Facial Expressions: A Review. Bioengineering 2023, 548. https://doi.org/10.3390/bioengineering10050548
Ekman, P.; Friesen, W. V. Facial Action Coding System. Environ. Psychol. Nonverbal Behav. 1978. https://doi.org/10.1037/t27734-000
Safikhani, S.; Gries, K. S.; Trudeau, J. J. Response Scale Selection in Adult Pain Measures: Results from a Literature Review. J. Patient-Rep. Outcomes 2018, 2, 1–9. https://doi.org/10.1186/s41687-018-0053-6
Fang, R.; Hosseini, E.; Zhang, R. Survey on Pain Detection Using Machine Learning Models: Narrative Review. JMIR AI 2025, 4, e53026. https://doi.org/10.2196/53026
Wen, C. T.; Du, T.; Teo, J. C. Automated Pain Detection Using Facial Expression in Adult Patients with a Customized Spatial Temporal Attention Long Short-Term Memory (STA-LSTM) Network. Sci. Rep. 2025, 15, 13429. https://doi.org/10.1038/s41598-025-97885-5
Chen, Z.; Ansari, R.; Wilkie, D. J. Automated Detection of Pain from Facial Expressions: A Rule-Based Approach Using AAM. In Proceedings of SPIE; 2012; Vol. 8314, 83143O. https://doi.org/10.1117/12.912537
Takalkar, M. A.; Min, X. Image-Based Facial Micro-Expression Recognition Using Deep Learning on Small Datasets. In Proceedings of the International Conference on Digital Image Computing: Techniques and Applications (DICTA); 2017; pp 1–7. https://doi.org/10.1109/DICTA.2017.8227443
Hassan, T.; Seus, D.; Wollenberg, J.; Weitz, K.; Kunz, M.; Lautenbacher, S.; Garbas, J.-U.; Schmid, U. Automatic Detection of Pain from Facial Expression: A Survey. IEEE Trans. Pattern Anal. Mach. Intell. 2021, 43, 1815–1831. https://doi.org/10.1109/TPAMI.2019.2958341
Lautenbacher, S.; Hassan, T.; Seuss, D. Automatic Coding of Facial Expressions of Pain: Are We There Yet? Pain Res. Manag. 2022, 2022. https://doi.org/10.1155/2022/6635496
Chongwen, W.; Wang, Z. Progressive Multi-Scale Vision Transformer for Facial Action Unit Detection. Front. Neurorobot. 2022, 15. https://doi.org/10.3389/fnbot.2021.824592
Pouromran, F.; Lin, Y.; Kamarthi, S. Personalized Deep Bi-LSTM RNN Based Model for Pain Intensity Classification Using EDA Signal. Sensors 2022, 21, 8087. https://doi.org/10.3390/s22218087
Chen, Z.; Ansari, R.; Wilkie, D. J. Learning Pain from Action Unit Combinations: A Weakly Supervised Approach via Multiple Instance Learning. IEEE Trans. Affect. Comput. 2022, 31, 135–146. https://doi.org/10.1109/TAFFC.2019.2949314
Tran, M.; Siniukov, M.; Jin, Z.; Soleymani, M. Discrete Facial Encoding: A Framework for Data-Driven Facial Display Discovery. arXiv 2025, arXiv:2510.01662
Devlin, J.; Chang, M.-W.; Lee, K. BERT: Pre-Training of Deep Bidirectional Transformers for Language Understanding. In Proceedings of NAACL-HLT; 2019; pp 4171–4186.
Lucey, P.; Cohn, J. F.; Prkachin, K. M. Painful Data: The UNBC-McMaster Shoulder Pain Expression Archive Database. In Proceedings of the IEEE Int. Conf. Autom. Face Gesture Recognit. (FG); 2011; pp 57–64. https://doi.org/10.1109/FG.2011.5771462
Haque, M. A.; Bautista, R. B.; Noroozi, F. Deep Multimodal Pain Recognition: A Database and Comparison of Spatio-Temporal Visual Modalities. In Proceedings of the IEEE Int. Conf. Autom. Face Gesture Recognit. (FG 2018); 2018; pp 250–257. https://doi.org/10.1109/FG.2018.00044
Cheong, J. H.; Jolly, E.; Xie, T. Py-Feat: Python Facial Expression Analysis Toolbox. Affect. Sci. 2023, 781–796. https://doi.org/10.1007/s42761-023-00191-4
Prkachin, K. M. The Consistency of Facial Expressions of Pain: A Comparison across Modalities. Pain 1992, 51, 297–306. https://doi.org/10.1016/0304-3959(92)90213-U
Kunz, M.; Meixner, D.; Lautenbacher, S. Facial Muscle Movements Encoding Pain—A Systematic Review. Pain 2019, 160, 535–549. https://doi.org/10.1097/j.pain.0000000000001424
Dildine, T.; Atlas, L. The Need for Diversity in Research on Facial Expressions of Pain. Pain 2019, 160, 1901–1902. https://doi.org/10.1097/j.pain.0000000000001593
Atee, M.; Hoti, K.; Chivers, P.; Hughes, J. D. Faces of Pain in Dementia: Learnings from a Real-World Study Using a Technology-Enabled Pain Assessment Tool. Front. Pain Res. 2022, 3. https://doi.org/10.3389/fpain.2022.827551
Boonstra, A. M.; Stewart, R. E.; Köke, A. J. Cut-Off Points for Mild, Moderate, and Severe Pain on the Numeric Rating Scale for Pain in Patients with Chronic Musculoskeletal Pain: Variability and Influence of Sex and Catastrophizing. Front. Psychol. 2016, 7, 1466. https://doi.org/10.3389/fpsyg.2016.01466
Kohavi, R. A Study of Cross-Validation and Bootstrap for Accuracy Estimation and Model Selection. In Proceedings of the Int. Joint Conf. Artif. Intell. (IJCAI); 1995; pp 1137–1143.
Cawley, G. C. On Over-Fitting in Model Selection and Subsequent Selection Bias in Performance Evaluation. J. Mach. Learn. Res. 2010, 11, 2079–2107.
Chawla, N. V.; Bowyer, K. W.; Hall, L. O.; Kegelmeyer, W. P. SMOTE: Synthetic Minority Over-Sampling Technique. J. Artif. Intell. Res. 2002, 16. https://doi.org/10.1613/jair.953
Mujahid, M.; Kına, E.; Rustam, F.; et al. Data Oversampling and Imbalanced Datasets: An Investigation of Performance for Machine Learning and Feature Engineering. J. Big Data 2024, 11, 87. https://doi.org/10.1186/s40537-024-00943-4
Brian, K. I.; Seiichi, U. Time Series Data Augmentation. In Proceedings of the Int. Conf. Pattern Recognit. (ICPR); 2020.
Nie, Y.; Nguyen, N. H.; Sinthong, P. A Time Series Is Worth 64 Words: Long-Term Forecasting with Transformers. arXiv 2023, arXiv:2211.14730.
Girard, J. M.; Cohn, J. F.; Torre, F. D. L. Estimating Smile Intensity: A Better Way. Pattern Recognit. Lett. 2015, 16, 12–21. https://doi.org/10.1016/j.patrec.2014.10.004
Jiang, Z.; Yang, M.; Tsirlin, M.; Tang, R.; Dai, Y.; Lin, J. “Low-Resource” Text Classification: A Parameter-Free Classification Method with Compressors. In Findings of the Association for Computational Linguistics: ACL 2023; 2023; pp 6810–6828. https://doi.org/10.18653/v1/2023.findings-acl.426
Broomé, S.; Gleerup, K. B.; Andersen, P. H. Dynamics Are Important for the Recognition of Equine Pain in Video. In Proceedings of the IEEE/CVF Conf. Comput. Vis. Pattern Recognit. (CVPR); 2019; pp 12667–12676. https://doi.org/10.1109/CVPR.2019.01295