Deep Graph Pose: a semi-supervised deep graphical model for improved animal pose tracking

Anqi Wu, E. Kelly Buchanan, Matthew R Whiteway, Michael Schartner, Guido T. Meijer, Jean‐Paul Noel, Erica Rodriguez, Claire Everett, Amy L. Norovich, Evan Schaffer, Neeli Mishra, C. Daniel Salzman, Dora E. Angelaki, Andrés Bendesky, John P. Cunningham, Liam Paninski

Abstract

Noninvasive behavioral tracking of animals is crucial for many scientific investigations. Recent transfer learning approaches for behavioral tracking have considerably advanced the state of the art. Typically these methods treat each video frame and each object to be tracked independently. In this work, we improve on these methods (particularly in the regime of few training labels) by leveraging the rich spatiotemporal structures pervasive in behavioral video — specifically, the spatial statistics imposed by physical constraints (e.g., paw to elbow distance), and the temporal statistics imposed by smoothness from frame to frame. We propose a probabilistic graphical model built on top of deep neural networks, Deep Graph Pose (DGP), to leverage these useful spatial and temporal constraints, and develop an efficient structured variational approach to perform inference in this model. The resulting semi-supervised model exploits both labeled and unlabeled frames to achieve significantly more accurate and robust tracking while requiring users to label fewer training frames. In turn, these tracking improvements enhance performance on downstream applications, including robust unsupervised segmentation of behavioral “syllables,” and estimation of interpretable “disentangled” low-dimensional representations of the full behavioral video. Open source code is available at https://github.com/paninski-lab/deepgraphpose .

Introduction

In neuroscience and behavioral biology, researchers require extreme precision when tracking animal movements, such as the position of a mouse's paw or a fruit fly's wing. While deep learning tools like DeepLabCut (DLC) have revolutionized the field, they often treat every video frame and every body part as independent entities. This lack of physical "common sense" leads to two primary issues: the need for extensive manual labeling and frequent tracking "glitches," where markers jump to random background locations or produce unrealistic, jittery movements.

Deep Graph Pose (DGP) addresses these limitations by adding a layer of physical and temporal logic to deep learning models. By leveraging body constraints and frame-to-frame smoothness, DGP achieves higher accuracy and robustness than current tools while requiring significantly fewer manual labels.

Methods

The core innovation of DGP is the integration of a Probabilistic Graphical Model (PGM) on top of standard deep neural networks. This allows the model to enforce several key constraints:

  • Spatial Constraints: The model uses spatial potentials to penalize unrealistic distances between connected body parts, ensuring, for example, that a paw remains within a physically plausible radius of the elbow.
  • Temporal Constraints: Temporal potentials enforce smoothness by assuming continuous paths rather than random jumps. Optical flow data is used to automatically adjust these weights based on the animal's speed.
  • Semi-Supervised Learning: DGP utilizes an Evidence Lower Bound (ELBO) objective to learn from both labeled and unlabeled data. This encourages the network to produce clear, "unimodal" confidence maps even for frames it hasn't explicitly seen.
  • Structured Variational Inference: To maintain computational efficiency over long videos, the authors approximate the complex distribution as a Gaussian Graphical Model.
Schematic of the DGP model architecture showing spatial and temporal constraints between frames and body parts.

Key Results

The researchers evaluated DGP across a diverse range of species and setups, including mice, fruit flies, and Siamese fighting fish. To establish a baseline, they created a "gold standard" test set by manually labeling 1,000 frames of a mouse-wheel dataset.

Key findings include:

  • Superior Accuracy with Sparse Data: DGP consistently outperformed DLC, particularly in the sparse-label regime. When using only 10-30% of available labels, DGP’s error rate was significantly lower.
  • Elimination of Glitches: Qualitative analysis shows that DGP traces remain physically grounded and smooth, whereas DLC traces frequently jump to incorrect locations.
  • Improved Downstream Science: Clean tracking is vital for behavioral analysis. When using an unsupervised model (ARHMM) to categorize behaviors, the jitter in standard tracking created false behavioral states. DGP’s tracking allowed for the correct identification of "resting" vs. "moving" states.
  • Better Geometry Capture: In video reconstruction tasks using Conditional Autoencoders (CAEs), DGP markers led to lower Mean Squared Error (MSE) compared to DLC markers, proving that DGP better captures the animal's true underlying geometry.
Tracking error (RMSE) for DLC, DGP-semi, and DGP models as a function of the training set fraction.

Conclusion and Future Work

Deep Graph Pose provides a robust framework for animal tracking that respects the physical realities of biology. While the current implementation has some computational overhead compared to simple forward-pass models, it offers a significant leap in data efficiency and tracking quality. Future work will focus on extending the model to 3D tracking using epipolar constraints and integrating the framework into user-friendly toolboxes for the broader biology community.

Source: Wu et al., "Deep Graph Pose: a semi-supervised deep graphical model for improved animal pose tracking," bioRxiv (2020). Link to Code

Summary updated

BibTeX
@inproceedings{wu2020deep,
  author = {Anqi Wu and E. Kelly Buchanan and Matthew R Whiteway and Michael Schartner and Guido T. Meijer and Jean‐Paul Noel and Erica Rodriguez and Claire Everett and Amy L. Norovich and Evan Schaffer and Neeli Mishra and C. Daniel Salzman and Dora E. Angelaki and Andrés Bendesky and John P. Cunningham and Liam Paninski},
  title = {{Deep Graph Pose: a semi-supervised deep graphical model for improved animal pose tracking}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2020},
  url = {https://openreview.net/forum?id=jlpj2vZVi2},
}
Figure