Object Detection
ultralytics
yolo
agriculture
livestock
cattle
calving
animal-welfare
computer-vision
Run this model with HF Jobs
Run CowcatcherAI/Calvingcatcher on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/CowcatcherAI/Calvingcatcher. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/CowcatcherAI/Calvingcatcher on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use CowcatcherAI/Calvingcatcher with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use CowcatcherAI/Calvingcatcher with ultralytics:
from huggingface_hub import hf_hub_download from ultralytics import YOLO # pick the weights file from this repo's "Files and versions" tab weights = hf_hub_download("CowcatcherAI/Calvingcatcher", "<weights>.pt") model = YOLO(weights) source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
Upload README.md
Browse files15 unmodified lines16171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656619 unmodified lines86878889909192939495969798991001016 unmodified lines1081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691 unmodified line17117217317417517617717817918018118218318418518615 unmodified lines# CalvingcatcherCalvingcatcher is a family of YOLO models that detect the visual signs of **calving** in cattle frombarn camera images. It is the vision core of the CalvingCatcher system β an extra pair of eyes on thematernity pen that watches 24/7, so a farmer does not have to walk out to the barn every hour throughthe night.The models are trained by farmers on real barn footage. Rather than predicting a single "calving"label, they detect the individual indicators a farmer would look for β the water bag, protruding legs,a head, a raised tail β which lets the surrounding system reason about *how far along* a cow is insteadof only whether something is happening.**Latest and best model: `CalvingcatcherV9.pt`.**More about the full system: [jacobsfarm.github.io/website/projects/calvingcatcher](https://jacobsfarm.github.io/website/projects/calvingcatcher/)---## Detected classesAll models are 6-class Ultralytics YOLO detection models:| ID | Class | What it marks ||---|---|---|| 0 | `tail_up` | Raised tail β an early behavioural sign || 1 | `waterbag` | Visible amniotic sac, the first hard evidence of active calving || 2 | `legs` | Calf legs protruding || 3 | `head` | Calf head visible || 4 | `body` | Calf body emerging || 5 | `calf` | Newborn calf on the ground |---## Available models| File | Base | Train imgsz / epochs | Size | Notes ||---|---|---|---|---|| **`CalvingcatcherV9.pt`** | `yolo26m` | 1024 / 150 | 44 MB | **Recommended.** Best precision and recall of the series || `calvingcatcherV8.pt` | `yolo26m` | 1024 / 150 | 44 MB | Previous main model || `CalvingcatcherV7.pt` | `yolo26m` | 960 / 150 | 44 MB | Older 960 px generation, fewer false positives than V8 |All three are Ultralytics 8.4.14 `yolo26m` detection models. Earlier versions (V5, V5.1, V6, V7.1) andthe small/large variants appear in the benchmark below for context but are not published here.---## Quick start```bashpip install ultralytics19 unmodified linesprint("Possible calving in progress:", labels)```Run V9 and V8 at **`imgsz=1024`** and V7 at **`imgsz=960`** β these are the resolutions they weretrained at, and dropping to the 640 default costs a noticeable amount of recall on small, distantsubjects.---## BenchmarkPrecision, recall and total false positives across the model series. `M`/`S`/`L` are the Ultralyticssize variants, the number is the training resolution.| Version | Model | Precision % | Recall % | Total FP ||---|---|---|---|---|6 unmodified lines| V5.1 | M960 | 76.3 | 26.7 | 234 || V5 | M960 | 77.7 | 17.3 | 77 |V9 is the best model on both precision and recall. Recall has roughly tripled since V5 (17.3% β 49.6%)while precision has climbed as well.### Reading these numbersThe recall figures look low next to a typical single-class detector, and that is expected here. This isa hard six-class problem: the targets are small, often partly occluded by the cow herself, and severalof them β a water bag, a pair of legs β are only visible from certain angles and for a limited window.Every individual object in every individual frame counts against recall.In practice the system does not need to catch every object in every frame. The camera analyses the pencontinuously, and one confident detection is enough to start collecting footage. A calving lasts longenough that ~50% per-frame recall still means the event itself is caught reliably; what matters far morefor daily use is precision, so the farmer is not woken by false alarms.If you use these weights standalone, treat the confidence threshold as your main dial: raise it to cutfalse positives, lower it to catch earlier and weaker signs.---## How the full system uses these modelsThe published system around these weights works roughly as follows:1. An IP camera streams the maternity pen over RTSP.2. The model analyses a frame every few seconds.3. On a reliable detection, the system starts collecting frames and records several seconds of footage,so it has enough material to pick good imagery from.4. The clearest images are pushed to the farmer's phone through **Telegram** or **Home Assistant**,together with the confidence score, so the farmer can judge the situation before walking out.Everything runs locally on the farm β no footage leaves the premises.### Hardware- A consumer-grade PC, preferably with an NVIDIA GPU (GTX 1000-series or newer)- One or more IP/WiFi cameras reachable over RTSP- A PoE switch to power the wired cameras- LAN cabling for a stable connection- An internet connection for sending the alerts---## Limitations- **The AI can raise a false alarm.** Precision is high but not perfect; expect the occasionalunnecessary notification.- **It does not read ear tags.** The system tells you *something is happening in the pen*, not whichanimal it is.- **Physical checks remain essential.** This is a monitoring aid, not a replacement for a stockman'sjudgement. Human expertise stays indispensable.- Detection quality depends on camera placement, lighting and how much of the cow is visible; heavyocclusion, unusual angles and very distant views are the hard cases.- The machine running it must stay powered and online for alerts to arrive.- The models were trained on the maintainers' own barn footage and contain no imagery from other farms,which is good for privacy but means barns that look very different may need additional data.---1 unmodified line**AGPL-3.0.**These weights are trained with [Ultralytics](https://github.com/ultralytics/ultralytics), which islicensed under AGPL-3.0. Every checkpoint in this repository carries the Ultralytics AGPL-3.0 notice inits metadata, so the derived weights inherit that license.In practice this means that if you use these models in a network-accessible service, AGPL-3.0 requiresyou to make the corresponding source of that service available to its users. If that does not work foryour deployment, Ultralytics sells a commercial Enterprise License that removes the copyleft obligation βsee [ultralytics.com/license](https://www.ultralytics.com/license).---See also: [**Cowcatcher**](https://huggingface.co/CowcatcherAI/Cowcatcher) β the sibling model family thatdetects mounting behaviour for heat detection.15 unmodified lines16171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656619 unmodified lines86878889909192939495969798991006 unmodified lines1071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641 unmodified line16616716816917017117217317417517617717817918018115 unmodified lines# CalvingcatcherWe built Calvingcatcher to keep an eye on the maternity pen so we don't have to walk out to the barnevery hour through the night. It is a vision model that detect the visual signs of **calving**in cattle from ordinary barn cameras, and it forms the vision core of our CalvingCatcher system β anextra pair of eyes that watches 24/7.We are farmers, and we trained these models on our own barn footage. Instead of predicting a single"calving" label, we detect the individual signs we would look for ourselves β the water bag, protrudinglegs, a head coming through. That way the system around the model can reason about *how far along* a cowis, not just whether something is happening.**Our latest and best model is `CalvingcatcherV9.pt`.** It is what we run ourselves.More about the full system: [jacobsfarm.github.io/website/projects/calvingcatcher](https://jacobsfarm.github.io/website/projects/calvingcatcher/)---## What we detect| ID | Class | What it marks ||---|---|---|| 1 | `waterbag` | Visible amniotic sac β the first hard evidence of active calving || 2 | `legs` | Calf legs protruding || 3 | `head` | Calf head visible || 4 | `body` | Calf body emerging || 5 | `calf` | Newborn calf on the ground |The detection head carries one further class from an earlier experiment that we no longer use inproduction. Ignore anything outside the five classes above.---## The models| File | Base | Train imgsz / epochs | Size | Notes ||---|---|---|---|---|| **`CalvingcatcherV9.pt`** | `yolo26m` | 1024 / 150 | 44 MB | **What we recommend.** Best precision and recall we have || `calvingcatcherV8.pt` | `yolo26m` | 1024 / 150 | 44 MB | Our previous main model || `CalvingcatcherV7.pt` | `yolo26m` | 960 / 150 | 44 MB | Older 960 px generation, fewer false positives than V8 |All three are Ultralytics 8.4.14 `yolo26m` detection models. Our earlier versions (V5, V5.1, V6, V7.1)and the small/large variants show up in the benchmark below for context, but we don't publish them.---## Getting started```bashpip install ultralytics19 unmodified linesprint("Possible calving in progress:", labels)```Run V9 and V8 at **`imgsz=1024`** and V7 at **`imgsz=960`** β that is what we trained them at. Droppingback to the 640 default costs a noticeable amount of recall on small, distant subjects.---## How our models comparePrecision, recall and total false positives across the versions we trained. `M`/`S`/`L` are theUltralytics size variants, the number is the training resolution.| Version | Model | Precision % | Recall % | Total FP ||---|---|---|---|---|6 unmodified lines| V5.1 | M960 | 76.3 | 26.7 | 234 || V5 | M960 | 77.7 | 17.3 | 77 |V9 comes out ahead on both precision and recall. Our recall has roughly tripled since V5 (17.3% β49.6%) and precision climbed along with it.### How to read those numbersThe recall looks low next to a typical single-class detector, and we want to be upfront about why. Thisis a hard problem: the things we look for are small, often partly hidden by the cow herself, and some ofthem β a water bag, a pair of legs β are only visible from certain angles and for a limited window.Every individual object in every individual frame counts against recall.In daily use we don't need to catch every object in every frame. The camera watches the pencontinuously, and one confident detection is enough to start recording. A calving lasts long enough that~50% per-frame recall still catches the event reliably. What matters far more to us is precision β wedon't want to be woken for nothing.If you run these weights standalone, the confidence threshold is your main dial: raise it to cut falsealarms, lower it to catch earlier and weaker signs.---## How we use them1. An IP camera streams the maternity pen over RTSP.2. The model analyses a frame every few seconds.3. On a reliable detection we start collecting frames and record several seconds of footage, so we haveenough material to pick good imagery from.4. The clearest images go straight to our phones through **Telegram** or **Home Assistant**, with theconfidence score, so we can judge the situation before pulling on our boots.Everything runs locally on the farm. No footage leaves the premises.### What you need to run it- A consumer-grade PC, preferably with an NVIDIA GPU (GTX 1000-series or newer)- One or more IP/WiFi cameras reachable over RTSP- A PoE switch to power the wired cameras- LAN cabling for a stable connection- An internet connection to send the alerts---## What it won't do- **It will occasionally raise a false alarm.** Precision is good, not perfect.- **It does not read ear tags.** It tells you something is happening in the pen, not which animal it is.- **It does not replace walking the barn.** We treat it as a monitoring aid; physical checks stayessential and a stockman's judgement is still indispensable.- Detection quality depends on camera placement, lighting and how much of the cow you can see. Heavyocclusion, awkward angles and very distant views are the hard cases.- The machine has to stay powered and online, or no alert arrives.- We trained on our own barns only β there is no imagery from other farms in here. Good for privacy, buta barn that looks very different from ours may need extra data.---1 unmodified line**AGPL-3.0.**We train these weights with [Ultralytics](https://github.com/ultralytics/ultralytics), which is licensedunder AGPL-3.0. Every checkpoint here carries the Ultralytics AGPL-3.0 notice in its metadata, so thederived weights inherit that license.In practice: if you use these models in a network-accessible service, AGPL-3.0 requires you to make thecorresponding source of that service available to its users. If that doesn't work for your deployment,Ultralytics sells a commercial Enterprise License that removes the copyleft obligation β see[ultralytics.com/license](https://www.ultralytics.com/license).---See also: [**Cowcatcher**](https://huggingface.co/CowcatcherAI/Cowcatcher) β our sibling model familythat detects mounting behaviour for heat detection.
README.md+64-69