Accurate measurement of spontaneous pain in animal models is critical for studying pain mechanisms, developing analgesics, and maintaining animal welfare. The Mouse Grimace Scale (MGS) is an established, noninvasive method that scores pain-related facial expressions, but it depends on manual scoring of static images and is subject to observer variability and labor intensity. Existing automated methods increase throughput but often require tightly controlled imaging conditions, fixed viewing angles, and provide limited temporal resolution or interpretability regarding individual facial action units.
To overcome these limitations, the authors present LabGrymace, an open-source, artificial intelligence–driven framework for automated, frame-by-frame analysis of pain-related facial dynamics in freely moving mice. LabGrymace is implemented on the LabGym behavioral analysis platform and aims to quantify continuous facial kinematics without manual frame selection or restrictive recording setups.
LabGrymace employs deep-learning–based facial feature detection and tracking to extract continuous measures of facial movement from video recordings of freely behaving mice. The system focuses on core facial regions implicated in pain-related expressions—ears, eyes, and nose—and produces frame-level kinematic descriptors of movement and appearance over time. This continuous recording allows assessment of temporal dynamics of facial action units rather than relying on single static frames.
By operating on unconstrained video of freely moving animals, LabGrymace aims to reduce the need for highly standardized imaging conditions and manual intervention. The approach provides both classification of pain-related facial actions and time-resolved quantitative outputs suitable for downstream analyses.
To generate an interpretable, quantitative pain metric, the authors calibrated facial dynamics against graded chemogenetic activation of nociceptors. Using this calibration, they identified which kinematic features—derived from movements of ears, eyes, and nose—showed the strongest association with pain intensity. The preprint reports that this feature-selection process informed the relative weighting of different facial action units in the final score.
The calibration against a controlled, graded nociceptive input provides a systematic basis for mapping facial kinematics to an intensity scale, facilitating reproducibility and interpretation of the computed pain values. The paper indicates that the authors used this experimental calibration to guide the construction of a composite pain measure rather than relying on ad hoc weighting.
The kinematic features most strongly associated with nociceptor activation were integrated into a weighted composite pain score. This score reflects the differential contributions of individual facial action units, providing an interpretable quantitative metric that captures both the magnitude and temporal dynamics of pain-related facial behavior.
LabGrymace produces continuous pain scores over time and can classify pain-related facial actions on a frame-by-frame basis. Because the composite score is based on calibrated, weighted contributions from multiple facial regions, it is intended to produce a more nuanced measure than binary or single-feature outputs.
The preprint reports that LabGrymace generated dose-dependent pain responses and generalized across distinct pain modalities tested by the authors. Specifically, the framework produced scalable pain scores for both visceral pain induced by MgSO4 and somatic pain induced by capsaicin. The authors state that LabGrymace accurately classified pain-related facial actions and produced continuous pain scores without the need for manual frame selection or restrictive recording conditions.
These validation experiments demonstrate that the composite pain score responds in a graded manner to manipulations intended to vary nociceptive input and that the approach can be applied across at least the two reported pain modalities. The preprint does not report peer review; it is presented as an unrefereed preprint on bioRxiv.
LabGrymace is provided as an open-source resource and the manuscript directs readers to a GitHub repository for code and supplementary material (link given in the paper). The framework is built atop the LabGym behavioral platform, and the authors emphasize the tool’s scalability, interpretability, and flexibility for assessing spontaneous pain in laboratory mice.
The preprint includes a competing interest statement: one author is the founder of, and another author is a consultant to, a company that provides services and support for automated behavioral analysis. Funding sources are declared in the paper. Because this report is a preprint, its findings and claims have not been certified by peer review.
For implementation details, algorithmic parameters, dataset specifics, and code usage instructions, users should consult the authors’ GitHub repository and the supplementary materials referenced in the preprint; the manuscript itself provides the conceptual framework and validation approach but detailed protocol steps and full code documentation are available from the linked resources.