# Markerless tracking of user-defined features with deep learning

Transfer learning lets deep networks track user-defined body parts without markers

Alexander Mathis, Pranav Mamidanna, Taiga Abe, Kevin M. Cury, Venkatesh N. Murthy, Mackenzie W. Mathis and 1 more · arXiv · 2018-4-9

- **Problem** Motor control studies attach reflective markers to animals, which are intrusive and fix the trackable features in advance. Deep pose networks need tens of thousands of labeled images, which many labs cannot collect.
- **Method** DeepLabCut reuses DeeperCut's ImageNet-pretrained ResNet feature detectors. It replaces the output layers with one score-map per body part and trains all weights on a few hundred labeled frames.
- **Results** With 80% of frames for training, snout and tail base test error reached human variability. At a 10% training fraction, average pixel error stayed below 5 pixels.

## Why markers and hand-built models fall short

Motor control studies usually attach reflective markers to the animal, because markers allow tracking of body parts with high accuracy. Markers can be expensive and distracting to animals, and they have to be placed before recording, which fixes the features that can be tracked. Skeleton and active contour models avoid markers, but they need sophisticated body models that are hard to build and fit to data.

Deep networks give the best results on human pose benchmarks, so they look like the obvious alternative. Those benchmarks rely on large labeled sets, such as about 25,000 images in the MPII Human Pose data set, which is out of reach for many neuroscience labs. The authors argue that transfer learning closes that gap, and that about 200 labeled images can be enough.

## Reusing a pre-trained feature detector

The key idea is to keep only DeeperCut's feature detectors, which pair a ResNet backbone with a readout layer for each body part. The backbone is pre-trained on ImageNet, so the detectors start from general image features rather than from random weights. The authors expected this to work because those features already encode much of what a new body-part detector needs, so a few hundred labels can adapt them.

The softmax layer after the conv5 bank is replaced by deconvolutional layers that output a scalar field per body part, and this output also connects to the conv3 bank for finer features. Each body part gets its own score-map, which gives the probability that the part is at a particular pixel. During training, the target is 1 for every location within a distance variable of 17 pixels from the ground truth, with a scale factor of 0.8, unless otherwise noted.

Training minimizes a cross-entropy loss between predicted and target score-maps with stochastic gradient descent, using batch size 1 and rescaling augmentation from 50% to 150%.

## From labeled frames to predicted positions

The user first extracts distinct frames, cropping each to a region of interest as small as possible while still containing the behavior. The user then labels the chosen body parts by hand, and training updates both the readout layers and the network weights. Once trained, the network predicts score-maps on unseen frames, and the peak of each map gives the body-part location.

The peak's amplitude is read as a confidence value, so each predicted coordinate can carry a score. With several mice in one frame, predictions come from the local maxima of the score-map. Accuracy is the Euclidean distance between label sets, averaged as RMSE per body part, and RMSE is not the training loss.

## Trail-tracking accuracy against a human labeler

The authors extracted 1 080 frames from two cameras and seven mice, then labeled the snout, both ears and the tail base. One annotator labeled the same frames twice, more than a month apart, and the RMSE between the two label sets defines human variability.

With 80% of frames for training and 20% for testing, the snout and tail base test RMSE reached human variability. At a 10% training fraction the average pixel error stayed below 5 pixels, close to the snout size in the low-resolution camera. So the authors conclude that about 100 frames already generalize well.

## Does a deeper backbone help?

The default backbone is ResNet-50, and the authors also trained ResNet-101 and ResNet-101 with intermediate supervision. Training and test errors both fell a little, so depth helped only modestly in this comparison.

The authors note that the deeper networks do not overfit, but they do not offer a radical improvement. Because the gain stays small, the main results keep the ResNet-50 backbone.

## Sharing the backbone across body parts

The authors trained specialized networks on snout labels alone or tail labels alone, using three 50% splits, and compared them with the full network. Each network is scored on the body part it was trained for, so the comparison isolates the effect of the other labels. The full network outperforms the specialized networks nearly twofold.

The authors read this as evidence that the shared ResNet lets localization of one body part gain from labels on other parts. It also means that updating weights throughout the network beats relying on fixed feature representations.

## Novel mice and multi-animal frames

The network tracked a novel mouse that was absent from training, and the trajectory looked continuous, which the authors read as accurate training. Although it was trained only on single mice, it found body parts for each of several mice in one frame. Occluding mice caused failures, so the model is not error-free in social scenes.

The authors suggest that training with multi-mouse images or with pairwise terms between body parts would improve this. The paper contains no such variant.

## Flies and mouse digits

The fly data set has 589 frames from six animals and 12 points, with 95% of frames used for training. Flies not in the training set were tracked across orientations and against cluttered egg backgrounds.

For the mouse hand, the network predicts 13 points per frame, including the wrist. A single digit is about 15 pixels wide, so this error is a fraction of the digit width. The methods count 159 labeled frames across five mice, which differs from the 141 used for training.

## Confidence and iterative labeling

The score-map peak's amplitude falls when a digit tip is occluded by the joystick. For flies, the authors drew points only when probability exceeded 10%, which hides occluded legs. Low probability isn't always an error, since occlusion also produces it.

The authors propose using these scores to choose frames for extra labels, sampling near high or low probability. Fine-tuning on those frames in an active learning loop is offered as a way to fix edge cases.

## Limitations

Frames were picked at random, so sparse or noisy behaviors such as motion blur could be under-sampled. Large errors on test frames that differ from the training set can dominate the average. Predictions are made frame by frame without temporal filtering, and the authors left Kalman filtering out.

Occlusion between animals is only partly handled, and the authors suggest pairwise terms as a future addition. Speed figures apply only to 682 × 540 Drosophila frames at about 30 frames per second on a 1080-Ti GPU.

## Paper info

- **Authors**: Alexander Mathis, Pranav Mamidanna, Taiga Abe, Kevin M. Cury, Venkatesh N. Murthy, Mackenzie W. Mathis, Matthias Bethge
- **Venue**: arXiv · Preprint
- **First published**: 2018-4-9
- **Added**: 2026-11-11
- **Updated**: 2018-4-9
- **Version**: v1
- **arXiv**: 1804.03142
- **Category**: cs.CV · q-bio.NC · q-bio.QM · stat.ML
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1804.03142v1) · [PDF ↗](https://arxiv.org/pdf/1804.03142v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Alexander Mathis, Pranav Mamidanna, Taiga Abe, Kevin M. Cury, Venkatesh N. Murthy, Mackenzie W. Mathis, Matthias Bethge (2018). Markerless tracking of user-defined features with deep learning. arXiv:1804.03142v1. https://arxiv.org/abs/1804.03142v1

**BibTeX**

```
@misc{mathis2018markerless,
  title = {{Markerless tracking of user-defined features with deep learning}},
  author = {Alexander Mathis and Pranav Mamidanna and Taiga Abe and Kevin M. Cury and Venkatesh N. Murthy and Mackenzie W. Mathis and Matthias Bethge},
  year = {2018},
  eprint = {1804.03142},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1804.03142v1}
}
```

## Other paper commentary

- [Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering](https://refivu.com/en/papers/6c6f90a1-fe13-482d-9dc4-046620898e40-bottom-up-and-top-down-attention-for-image.md)
- [SwinIR: Image Restoration Using Swin Transformer](https://refivu.com/en/papers/16285f4a-51a3-41dc-9740-c5a9259d2b18-swinir-image-restoration-using-swin-transformer.md)
- [GhostNet: More Features from Cheap Operations](https://refivu.com/en/papers/54dc4d80-177d-40dc-bde2-a797c18077da-ghostnet-more-features-from-cheap-operations.md)
- [Visual Genome: Connecting Language and Vision Using Crowdsourced Dense Image Annotations](https://refivu.com/en/papers/f53fd829-f514-4443-ae13-a5df28e84536-visual-genome-connecting-language-and-vision-using.md)
- [CSPNet: A New Backbone that can Enhance Learning Capability of CNN](https://refivu.com/en/papers/3f885aa7-65fa-4ad8-bde8-f91e2cb0eb53-cspnet-a-new-backbone-that-can-enhance-learning.md)
- [Distance-IoU Loss: Faster and Better Learning for Bounding Box Regression](https://refivu.com/en/papers/d05dc1a3-dfd0-4eb2-bd4f-2b74602bcc42-distance-iou-loss-faster-and-better-learning-for.md)
- [Categorical Reparameterization with Gumbel-Softmax](https://refivu.com/en/papers/c907a642-9316-44dc-97d4-0d4eebe881fa-categorical-reparameterization-with-gumbel-softmax.md)
- [Unsupervised Domain Adaptation by Backpropagation](https://refivu.com/en/papers/5b06ce85-04aa-40bd-a8ba-094e15a092f1-unsupervised-domain-adaptation-by-backpropagation.md)
- [Spatial Transformer Networks](https://refivu.com/en/papers/6eb29eca-41eb-4d69-ace3-032bf11562a8-spatial-transformer-networks.md)
- [Bag of Tricks for Efficient Text Classification](https://refivu.com/en/papers/48b6ecfa-f1d3-4096-8e4a-50b65a867c17-bag-of-tricks-for-efficient-text-classification.md)

## Terms in this paper

- [ImageNet](https://refivu.com/en/terms/5eadad128667-imagenet)
- [Data Augmentation](https://refivu.com/en/terms/cc5618231f4a-data-augmentation)
- [ResNet](https://refivu.com/en/terms/ca7e0121c7a8-resnet)
- [transfer learning](https://refivu.com/en/terms/9c71d6928a00-transfer-learning)
- [cross-entropy loss](https://refivu.com/en/terms/14067bdf8b9f-cross-entropy-loss)
- [t-SNE](https://refivu.com/en/terms/488ecf7dbbcf-t-sne)
- [RMSE](https://refivu.com/en/terms/ad2579cf164a-rmse)
- [pose estimation](https://refivu.com/en/terms/1be5e96815e4-pose-estimation)
- [root mean square error](https://refivu.com/en/terms/294ef5467be4-root-mean-square-error)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/9875063c-f7bc-4b74-ac4c-90b07da3fab3-markerless-tracking-of-user-defined-features-with-deep)
