Skip to content

About

Real-time cattle hip height measurement using YOLO11 pose estimation and OAK-D depth cameras. 91.3% mAP@50. PyQt5 GUI with live depth stream, ground calibration, and CSV export.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

CattleScanner 🐄

An automated, non-invasive system for measuring cattle hip height in real time using computer vision and depth sensing. The system combines a YOLO-based pose estimation model with an RGB-D stereo camera to detect cattle hip keypoints and compute accurate height measurements — no human intervention required.

Built as a capstone project at the University of Sydney (SOFT3888).


Demo

Connect an OAK-D camera, calibrate the ground plane, and start scanning. Detected cattle are tracked in real time with hip height measurements displayed live and exportable to CSV.


Features

  • Real-time hip height measurement via YOLO pose estimation + depth camera
  • PyQt5 GUI with live depth stream visualization and camera controls
  • Ground plane calibration using multi-frame temporal averaging
  • CSV export for data collection and downstream analysis
  • Mock device mode for testing without physical hardware
  • Comprehensive test suite with ~79–90% code coverage

Tech Stack

Component Technology
Pose Estimation YOLOv8 / YOLO11 (Ultralytics)
Depth Camera OAK-D / OAK-D Lite (DepthAI)
GUI PyQt5
CV & Depth Processing OpenCV, NumPy, SciPy
Object Tracking filterpy, lap, supervision
Model Training PyTorch, Ultralytics
Testing unittest, pytest

Project Structure

CattleScanner/
├── Integration/
│   └── GUI/
│       ├── main.py                  # App entry point
│       ├── requirements.txt
│       ├── cowscanner/
│       │   ├── gui.py               # Main PyQt5 GUI
│       │   ├── camera.py            # DepthAI camera interface
│       │   ├── mock_device.py       # Hardware simulator for testing
│       │   ├── calibration.py       # Ground plane calibration
│       │   └── utils.py             # Detection, tracking, CSV export
│       ├── Tests/                   # Unit test suite
│       └── resources/
│           └── cow_hip_height_model.tar.xz   # RVC2 on-device model
├── cattle-measurement-system/
│   └── model_training/              # Training pipelines (YOLOv8 / YOLO11)
├── Demos/                           # Hardware and NN demos
├── data/
│   └── cow_hip_heights.csv
└── README.md

Getting Started

Prerequisites

  • Python 3.9+
  • OAK-D or OAK-D Lite camera (optional — mock mode works without hardware)

Installation

git clone https://github.com/KAANSSAR/CattleScanner.git
cd CattleScanner/Integration/GUI
pip install -r requirements.txt

Run the App

# From the repo root
python3 -m Integration.GUI.main

# Or directly
cd Integration/GUI
python3 main.py

Run Tests

cd Integration/GUI
python -m unittest discover -s Tests

Usage

  1. Connect Camera — plug in OAK-D device and click "Connect Camera"
  2. Calibrate Ground — ensure no cattle are visible, click "Start Calibration" (averages 30 frames)
  3. Start Scan — click "Start Scan" to begin real-time detection and tracking
  4. Export — click "Complete Export CSV" to save measurements to data/cow_hip_heights.csv

No hardware? Click "Enable Test Mode" to use the mock device with synthetic cattle.


Model Training

Three YOLO pose models were trained on the CattleEyeView dataset, all targeting a single hip_height keypoint:

Version Architecture mAP@50
V1 YOLOv8s-pose —
V2 YOLO11n-pose —
V3 YOLO11s-pose —
Best YOLO11n-pose 91.3%

To retrain from scratch, see cattle-measurement-system/model_training/Training.md.


Configuration

Parameter Location Default
Camera resolution camera.py 640×640
FPS camera.py 15
Calibration frames gui.py 30
Cow frame buffer gui.py 20

Hip heights are measured in millimetres relative to the calibrated ground plane. The camera is typically ~3000mm above ground.


Contributors

This project was built collaboratively as part of SOFT3888 at the University of Sydney.

Name GitHub / Contact
Kanishka Sarkar (https://github.com/KAANSSAR)
Daniel Gilerman [email protected]
Ananya Rajesh [email protected]
Jake Richards [email protected]
Tasneem Binte Rahman [email protected]
Aaron Khuu [email protected]
Abdullah Fashola [email protected]

Client: Luciano Gonzalez (University of Sydney)
Tutor: Xinrui Zhang


License

This project was developed for academic purposes at the University of Sydney. Please reach out before reusing or redistributing.

About

Real-time cattle hip height measurement using YOLO11 pose estimation and OAK-D depth cameras. 91.3% mAP@50. PyQt5 GUI with live depth stream, ground calibration, and CSV export.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages