CyberFarm: How We Teach AI to Monitor Cows

Ayrat Galyamov24 May 2025

Problem

A large dairy complex keeps thousands of cows, and staff cannot watch them all. The biggest pilot site has more than 10 thousand animals, 4 buildings and 350 cameras. Feed is 50–60% of costs, and a cow that falls sick or goes lame is culled early, which loses years of milk. Hardware identification (ear tags, RFID) exists only at a few points such as the milking entrance, so nobody sees which animal skipped a meal or lay down after milking.

Example from the article: after the second milking, a cow does not go to drink or eat and lies down instead. Livestock experts and the literature treat this as a sign to check her.

Solution in brief

Cameras above the feed table and the control zones feed three modules: feed-area segmentation, cow Re-ID, and keypoint-based lameness assessment. RFID events label the Re-ID training crops automatically. Time spent per zone, once tied to a cow, becomes features for unsupervised anomaly detection. Experts later label the flagged cases for supervised models.

Questions this case answers
  • How to detect anomalies in individual animal behaviour from camera data when only a few identification points exist and animals must be recognized from video
  • How to build a re-identification training set automatically from sparse hardware identification events and camera crops
  • How to detect anomalies in animal behavior and health from camera data on a dairy farm
  • How to identify individual animals from video when only a few RFID readers exist on the site

Tools and methods

  • NVIDIA SegFormer — semantic segmentation of feed on the feed table
  • InsightFace, CNN with embedding head (ResNet50) — Re-ID embeddings of 128–512 dimensions
  • Milvus — vector database with nearest-neighbor search over cow embeddings
  • Keypoint detection — back angle, head sway and leg position for lameness
  • Unsupervised anomaly detection — flags atypical per-zone behavior
Continue reading — it's free

Google or a one-time email code. No password.