Using DeepLabCut for 3D markerless pose estimation across species and behaviors

Tanmay Nath, Alexander Mathis, An Chi Chen, Amir Patel, Matthias Bethge, Mackenzie Weygandt Mathis

TL;DR

DeepLabCut is an open-source Python toolbox that brings state-of-the-art markerless pose estimation to the animal kingdom. By leveraging transfer learning, it allows researchers to track complex behaviors across species—from fruit flies to hunting cheetahs—with human-level precision using as few as 100–200 labeled training images.

What Problem Does This Paper Address?

Quantifying animal behavior is a cornerstone of neuroscience, genetics, and ethology. Traditionally, researchers had to choose between two sub-optimal methods: invasive physical markers (like reflective beads glued to an animal) or "blob tracking" software that fails in complex, dynamic environments.

While deep learning has revolutionized human pose estimation, these models are typically "data-hungry," requiring thousands of labeled examples to function. For a scientist running a specific experiment with a unique camera angle or species, labeling 10,000 frames is a prohibitive bottleneck. DeepLabCut addresses this "small data" challenge, providing a robust, user-friendly way to achieve high-accuracy tracking without markers.

Methods

DeepLabCut is built upon DeeperCut, a state-of-the-art human pose estimation model. The key technical innovation is the use of transfer learning.

  1. Architecture: The system uses deep residual networks (ResNet-50 or ResNet-101) that have been pre-trained on ImageNet (a massive dataset of general objects).
  2. Transfer Learning: Because the network already "understands" visual primitives like edges and textures, it only needs a small amount of task-specific data to learn to identify a mouse’s snout or a cheetah’s hock.
  3. Active Learning Loop: The toolbox introduces an iterative refinement process. A user trains an initial model, runs it on new videos, extracts "outlier frames" where the model is uncertain or fails, manually corrects those frames, and feeds them back into the training set. This "human-in-the-loop" approach rapidly increases the model's robustness to occlusions and lighting changes.
  4. Software Ecosystem: The paper introduces a self-contained Python package featuring a Graphical User Interface (GUI) for labeling and project management, making it accessible to researchers without extensive programming backgrounds.

Datasets

The authors demonstrate the tool's versatility across several diverse datasets:

  • Laboratory Models: Mice (open-field behavior and complex hand articulations), fruit flies (3D movements), and zebrafish.
  • Clinical/Veterinary: Human babies (gait analysis) and horses.
  • The "Wild" Benchmark: A particularly challenging new dataset of hunting cheetahs in the wild. This dataset features extreme motion blur, varying backgrounds (grass, dust), and diverse lighting conditions, serving as a stress test for the algorithm's generalization capabilities.

Key Insights and Ideas

  • Efficiency of Transfer Learning: The most striking insight is that human-level accuracy can be achieved with remarkably little data—often fewer than 200 frames. This shifts deep learning from a "big data" luxury to a standard laboratory tool.
  • Robustness over Heuristics: Unlike previous methods that relied on "thresholding" (separating a dark animal from a light background), DeepLabCut learns deep visual features. This makes it immune to common issues like reflections on glass walls, shadows, or "cluttered" natural backgrounds.
  • Species Agnostic: The underlying geometry of the subject doesn't matter to the network. Whether it's a multi-legged insect or a four-legged mammal, the training process remains identical.
  • Confidence Scores: The model outputs a "likelihood" for each body part. This allows researchers to automatically filter out frames where a body part was occluded (hidden) from the camera's view.

Key Results

  • Accuracy: On an 800x800 pixel dataset, DeepLabCut achieved a labeling error of less than 5 pixels with only 100 training frames. With 500 frames, accuracy improved to 2.7 pixels, matching the variability of human annotators.
  • Speed: The system is capable of real-time or near-real-time processing. On a standard GPU, it runs at 10–90 FPS (depending on frame size). With batch processing, it can reach up to 1000 FPS.
  • Generalization: The model successfully tracked cheetahs across different individuals and environments, even when the animal's size in the frame changed dramatically as it ran toward a "camera trap."

Limitations and Future Work

  • Hardware Requirements: While the tool can run on a CPU, it is 10–100x slower. Efficient use requires a dedicated NVIDIA GPU, which may be a barrier for some labs.
  • Occlusions: DeepLabCut performs frame-by-frame prediction and does not currently "guess" the location of a body part if it is completely hidden behind another object (though the confidence score flags these moments).
  • 3D Complexity: While the paper demonstrates 3D reconstruction using multiple cameras, this still requires standard external camera calibration (e.g., using a checkerboard) to triangulate the points. Future iterations may look to integrate these steps more seamlessly.

Summary updated

BibTeX
@inproceedings{nath2019using,
  author = {Tanmay Nath and Alexander Mathis and An Chi Chen and Amir Patel and Matthias Bethge and Mackenzie Weygandt Mathis},
  title = {{Using DeepLabCut for 3D markerless pose estimation across species and behaviors}},
  booktitle = {Nature Protocols},
  year = {2019},
  doi = {10.1038/s41596-019-0176-0},
}
Figure