Abstract
Objective and continuous pain assessment in veterinary medicine remains a significant challenge due to the diverse morphology of canine breeds and their natural instinct to mask discomfort. This paper introduces a novel two-stream deep learning architecture that integrates body keypoint data with raw video frames to automatically detect pain indicators. By utilizing a new expert-annotated dataset of veterinary patients, the proposed system achieves a 77% accuracy rate, offering a scalable solution for 24/7 automated monitoring.
Introduction
While pet owners often rely on intuition to identify when a dog is in pain, clinical veterinary medicine requires more objective and continuous assessment methods. Existing research has successfully applied computer vision to detect pain in species like mice and horses, primarily through facial grimace scales. However, a comprehensive system for dogs—accounting for their vast range of sizes and movement patterns—has been lacking. This study addresses this gap by developing an automated system capable of identifying orthopedic and neurological pain through body posture and gait analysis.
Methodology
The researchers developed a two-stream deep neural network to capture both spatial and temporal indicators of pain:
- Keypoint Stream (LSTM): This stream focuses on movement patterns. The system employs YOLOv5 for initial object detection and HRNet to extract 17 specific body keypoints, including the eyes, nose, elbows, and knees. These coordinates are processed by a Long Short-Term Memory (LSTM) network to analyze gait over time.
- RGB Stream (C-LSTM): Simultaneously, raw video frames are processed by a Convolutional LSTM (C-LSTM). This stream maintains spatial structures, allowing the model to detect subtle visual cues such as muscle tension or changes in coat texture that keypoints might overlook.
To handle the challenge of self-occlusion (e.g., a dog standing on three legs), the authors implemented a "missing data treatment" using body symmetry and temporal inference to estimate the location of hidden joints. Additionally, an Attention Mechanism was integrated into the LSTM to weight specific frames that are most indicative of pain within a clip.
Data and Preprocessing
The study leverages three datasets: StanfordExtra and TigDog for pose estimation validation, and the newly introduced Anonymous University Dog Behavior Dataset (AUDBD) for pain recognition. AUDBD contains over 6 hours of video from 61 real veterinary patients, categorized into "Orthopedic pain," "Neurological pain," and "No pain."
To account for morphological diversity, keypoints were normalized relative to a "root point" (the midpoint between the neck and tail), ensuring the model learns relative joint relationships rather than absolute size.
Results and Discussion
The integrated two-stream approach (C-LSTM + LSTM128) significantly outperformed single-stream alternatives:
- Accuracy: 77.0% (±4.6)
- F1-Score: 76.3% (±4.4)
In comparison, using keypoints alone yielded only 59.1% accuracy, while the I3D network achieved 74.6%. Qualitative analysis using Grad-CAM saliency maps confirmed that the model correctly prioritizes areas like the legs and head when assessing orthopedic pain, aligning with clinical observations of limping or distress.
Conclusion and Future Work
This research demonstrates the efficacy of combining skeletal movement data with raw visual information for canine pain detection. While the current model is limited to orthopedic and neurological pain, future work aims to integrate facial expression analysis (grimace scales) and expand the dataset to include a wider variety of breeds and pain types, such as internal organic issues. This marks a significant step toward non-invasive, automated veterinary diagnostic tools.
Summary updated