Skip to Content
Back to projects

Founding data science

HerdSense Vet Labelling Pipeline

An automated pipeline that finds cow walking footage, pre-labels it with a vision model, and hands our vet a keyboard-first web inbox for review. Built at speed with Cursor and Claude Code.

The short version

  • HerdSense's lameness detection needs vet-labelled ground truth, and vet time is the scarcest resource in the company. I built the labelling pipeline that protects it.
  • One command takes raw footage to a published review batch: discover, deduplicate, quality-gate, extract cow clips, and pre-label each clip with a vision model.
  • Review happens in a Next.js and Supabase web inbox where one keystroke (1 to 5 on the Sprecher scale) scores a clip, saves it, and advances; reviewed labels feed straight back into retraining.
  • I built it in days by running Cursor and Claude Code subagents in parallel, keeping the repository's CLAUDE.md current, and shipping nothing without a ground-truth comparison the team could check.

Review speed

1 keystroke per clip

Pipeline

One command

Built with

Cursor + Claude Code

Dairy cows grazing in a green field

The pipeline, drawn

ONE COMMAND, START TO PUBLISHED BATCHDISCOVERFOOTAGEDEDUPLICATEVS SEENQUALITY-GATEEXTRACTCOW CLIPSRETRAINMODELVET SCORES1-5, ONE KEYPUBLISHBATCHPRE-LABEL(VISION MODEL)BETTER MODEL, SHARPER PRE-LABELS NEXT BATCH
The loop that turns raw footage into training data. Everything except the green box is automated; the vet only does the part that needs a vet.

The problem

HerdSense builds camera-based lameness detection for dairy farms, and a lameness model is only as good as its ground truth. Ground truth needs a vet. Our veterinary reviewer's time is the scarcest resource in the company, so every hour she spends hunting for files or fighting a clunky tool is an hour of labelled data we never get.

The pipeline

One command runs the whole flow: discover new footage, deduplicate it against everything we have already seen, quality-gate it, extract clips of individual cows walking, pre-label each clip with a vision model, and publish the batch for review. The pre-labels mean the vet starts from a draft rather than a blank page.

Review happens in a web inbox built for speed. Clips play one after another, and a single keystroke (1 to 5 on the Sprecher locomotion scale, the standard vets already use) scores the clip, saves it, and advances to the next. A binary lame-or-healthy label is derived from the score, and a weekly report keeps the team honest about throughput.

Reviewed labels flow straight back into model retraining, so every batch the vet scores makes the next model better.

Built with AI coding agents

I built the pipeline and the web app with Cursor and Claude Code. The speed came from learning to run subagents in parallel: independent tasks went to separate agents (one refactoring the ingest script whilst another wrote the reporting views) instead of everything waiting on me.

Two habits kept the codebase production-ready. The repository's CLAUDE.md stayed up to date, so every agent session started with current context instead of rediscovering the project, and I trimmed the generated code we did not need.

Nothing shipped without a ground-truth comparison. Every pipeline change was checked against known outputs before it went live, so the team could trust the data without taking my word for it. I also wrote a bootstrap document that gives any coding agent the context, connections, and playbooks to run labelling tasks end to end. A small data team got a production labelling system in days.

The stack

Next.js and Supabase for the review inbox (row-level security, migration-managed schema, and reporting views), Python for the pipeline, a vision model for pre-labelling, PostHog for event tracking, and Vercel for deployment.