  Background: Pain assessment in individuals with neurological conditions,
especially those with limited self-report ability and altered facial
expressions, presents challenges. Existing measures, relying on direct
observation by caregivers, lack sensitivity and specificity. In cerebral palsy,
pain is a common comorbidity and a reliable evaluation protocol is crucial.
Thus, having an automatic system that recognizes facial expressions could be of
enormous help when diagnosing pain in this type of patient.
  Objectives: 1) to build a dataset of facial pain expressions in individuals
with cerebral palsy, and 2) to develop an automated facial recognition system
based on deep learning for pain assessment addressed to this population.
  Methods: Ten neural networks were trained on three pain image databases,
including the UNBC-McMaster Shoulder Pain Expression Archive Database, the
Multimodal Intensity Pain Dataset, and the Delaware Pain Database.
Additionally, a curated dataset (CPPAIN) was created, consisting of 109
preprocessed facial pain expression images from individuals with cerebral
palsy, categorized by two physiotherapists using the Facial Action Coding
System observational scale.
  Results: InceptionV3 exhibited promising performance on the CP-PAIN dataset,
achieving an accuracy of 62.67% and an F1 score of 61.12%. Explainable
artificial intelligence techniques revealed consistent essential features for
pain identification across models.
  Conclusion: This study demonstrates the potential of deep learning models for
robust pain detection in populations with neurological conditions and
communication disabilities. The creation of a larger dataset specific to
cerebral palsy would further enhance model accuracy, offering a valuable tool
for discerning subtle and idiosyncratic pain expressions. The insights gained
could extend to other complex neurological conditions.
