The goal
Soundness problems in racehorses are usually noticed when they are already obvious. The aim of this pilot is earlier: film every horse walking through the barn every day, from both sides, and compare each horse's walk with its own history rather than with a textbook. The constraints are real-world ones. The cameras are on a barn wall, the horses walk when they walk, the lighting changes, and seventy-odd bay and chestnut thoroughbreds look very much alike.
Capture and cloud pipeline
A Raspberry Pi drives two IP cameras facing each other across the walkway. A low-resolution substream is used only to detect motion and a horse; the full-resolution main stream records the clip, because low-resolution footage ruins keypoint accuracy. Clips from the two cameras are paired by timestamp and always kept together, since gait comparison needs both sides.
Each clip uploads to Google Cloud Storage, which publishes a message that triggers a serverless function on Modal. Within seconds the function has scanned the clip and classified it as keep or trash: a horse on the mat, side profile, full body in frame, moving, and the right size in the frame. The scanner keeps more real walks than the previous production version while discarding empty frames, multiple horses and off-mat traffic. Kept clips go to a GPU batch for pose estimation, first with an open model on rented GPUs and now with our own 45-point model. A z-score detector flags deviations from each horse's own baseline, and a local dashboard shows the results.
Identity: the hard part
Six months of learned re-identification failed: thoroughbreds are too alike for a visual embedding to separate reliably. What works is reading the freeze brand. Pose keypoints locate the shoulder, a crop at native resolution is cut from it, and a vision-language model reads the number and year digit on one side and the stud letters on the other. The candidate set is narrowed first with the stable's training schedule, so each read chooses one horse from three or four rather than one from seventy. Leg markings are read from pixel strips as a second check. Coat colour is never used alone.
On ground-truth sightings this gave about 93 percent precision. In a recent run, brands were read on 255 of 360 clip pairs for about six dollars of model cost, with one horse confirmed eleven times across four days. A manual override file allows a ten-second correction when the model is wrong.
Where it stands, honestly
This is a working pilot, not a clinical product, and we describe it that way. No horse yet has a multi-day gait baseline. The anomaly detector has only been exercised on synthetic walks. Barn walks are short, one or two stride cycles, which limits per-horse gait fingerprints. Body proportions did not repeat between the two cameras. Chestnut and bay cannot be told apart on these cameras. No alerts are delivered yet. What has been proven is the capture architecture, the paired-camera rule, the serverless classification, the GPU pose pipeline and an identity method that works where learned re-identification did not. The system does not "detect lameness", and we will not say that it does until the data says so.