HerdSense: proving the keypoint model's accuracy

I caught a test that overstated accuracy (112 of 158 test images were already in the training data) and rebuilt it by source video.

  • HerdSense, co-founder
  • 2025 to now
  • Machine learning

Background

HerdSense is building a camera system that spots early lameness in dairy cows.

Its keypoint model finds each cow in a camera frame and places 25 points on its body. Measures of how the cow walks are computed from those points, so everything after the model depends on them being right.

In November 2026 I found that the test behind our keypoint accuracy was not a fair one.

Data and method

The images come from HerdSense's pilot recordings, public videos of cows walking, and two public cattle datasets.1

1HerdSense pull request #786, Nov 2026. Private repository, no public page.

The first test set was split by clip. 112 of its 158 test images came from the public datasets, which the model's starting weights had already been trained on, and some videos sat on both sides of the split under different batch names.1

A test built that way partly measures images the model has already seen, so it overstates accuracy.

I rebuilt the split by source video. Every image from one recording now sits in training, validation or test, never in two. Public images go in training only, and the rest is split 50/25/25.1

I then trained hock-v2, a two-stage model: RF-DETR finds the cow, and DINOv2 places the 25 points on it. It is scored as a whole, so if the first stage misses a cow, all of that cow's points count as misses.2

2HerdSense hock-v2 decision record and scoring code, Nov 6, 2026. No public page.

Accuracy is PCK@0.1: the share of points placed within 10% of the longer side of the cow's bounding box from where a person marked them.2

Result

The accuracy HerdSense publishes now comes from recordings the model never trained on.

112 of 158 test images in the first split were already in the training data1

0.952 PCK@0.1 for hock-v2 on held-out images split by recording3

3HerdSense hock-v2 run record, Nov 6, 2026. No public page.

By source, hock-v2 scores 0.971 on pilot recordings and 0.941 on public videos.3

These scores measure where keypoints land on images. They are not a lameness score, and nothing has been measured on lameness clips.3

  • Already in training112
  • Unseen46
The first test set: 112 of its 158 images came from public datasets the model's starting weights had trained on.
  • All0.952
  • Pilot recordings0.971
  • Public videos0.941
hock-v2's PCK@0.1 on held-out test images split by recording. Measured on keypoint images, not lameness clips.

Recommendation

Split every HerdSense dataset by recording, keep the public images that starting weights trained on in training only, and publish accuracy only from held-out recordings, so every published number is measured on recordings the model has never seen.

What did not work

Earlier, in April 2026, we tried a vision-language model to pre-label lameness in clips. Its labels agreed with human reviewers 41% of the time (71% leaving out clips marked unknown), and it called cows lame too often, so we dropped model pre-scoring.4

4HerdSense research log, labelling audit, Apr 10, 2026. No public page.

What I did

I found the overlap, rebuilt the split by source video, built the two-stage trainer and trained hock-v2.12

I also checked the pre-labels against the human reviewers' scores. The scores themselves were the reviewers' work.4

Next project

CalRecycle: rebuilding the recycling fund's forecasts