This repository contains a complete end-to-end pipeline for detecting livestock (sheep) in aerial drone imagery using Ultralytics YOLOv8.
It includes dataset information, training configurations, evaluation metrics, model outputs, and a Google Colab training notebook.
This project demonstrates how modern lightweight vision models can be applied to agricultural monitoring, automated livestock tracking, and UAV-based population analysis.
- Project Overview
- Dataset
- Dataset Details & Insights
- Model Architecture
- Training Pipeline
- Training Configuration
- Evaluation & Metrics
- Results & Visualizations
- Colab Notebook
- Acknowledgements
Livestock management is increasingly adopting drone-based automation to monitor large herds in rough or inaccessible terrain.
This project develops a YOLOv8n-based object detection model capable of detecting sheep from aerial images captured by UAVs.
The primary goals of this project:
- Detect livestock from a bird's-eye view
- Handle shadows, occlusions, and environmental variation
- Provide a lightweight detector that can run on edge hardware
- Offer a reproducible training and evaluation pipeline
The dataset used for this project is hosted on Roboflow Universe:
🔗 Aerial Sheep Dataset
https://universe.roboflow.com/riis/aerial-sheep
- Total Images: 1,727
- Annotations: 55,435 bounding boxes
- Classes: 1 (sheep)
- Split:
- Train: 1,203
- Valid: 290
- Test: 234
- Average Objects/Image: 32.1
- Image Resolution: 8.29–8.85 megapixels
- Median Resolution: 3840 × 2160
The dataset offers realistic aerial views with:
- Harsh sunlight
- Strong shadows
- Tree occlusion
- Rocky terrain
- Grass of varying textures
- Sheep blending into the background
- Small object size in high-resolution frames
- Crowded flock regions
- Variable lighting conditions
This project uses YOLOv8n ("nano" variant) from Ultralytics.
- Very lightweight
- Real-time inference
- Minimal GPU requirements
- Strong performance for small-object detection
- Good baseline before upgrading further
- C2f blocks
- SPPF layer
- AdamW optimizer (auto-selected)
- Automatic mixed precision (AMP)
- Label caching & optimized dataloaders
Training was performed in Google Colab using:
- Tesla T4 GPU
- Ultralytics 8.3.228
- Torch 2.8.0
- Python 3.12
- Dataset import
- YOLOv8 setup
- Data caching
- Augmentations applied
- Training (10 epochs)
- Saving weights
- Final validation
- Curve generation
- Model:
yolov8n.pt - Epochs: 10
- Batch Size: 64
- Image Size: 448
- Optimizer: AdamW
- AMP: Enabled
| Augmentation | Purpose |
|---|---|
| Blur | Motion blur simulation |
| Median Blur | Noise reduction |
| CLAHE | Contrast enhancement |
| HSV | Color/brightness variation |
| Horizontal Flip | Mirror augmentation |
weights/best.ptweights/last.pt
| Metric | Score |
|---|---|
| Precision | 0.793 |
| Recall | 0.745 |
| mAP50 | 0.782 |
| mAP50-95 | 0.335 |
🔗 Google Colab Notebook:
https://colab.research.google.com/drive/1gL1J5PHfEaeRqdVnNoMy8k-WBHwfxsO7?usp=sharing
This repository includes the .pdf versions of the notebook.
-
Roboflow Universe – Aerial Sheep Dataset
https://universe.roboflow.com/riis/aerial-sheep -
Google Colab Notebook of the drone_livestock.ipynb
https://colab.research.google.com/drive/1gL1J5PHfEaeRqdVnNoMy8k-WBHwfxsO7?usp=sharing -
Ultralytics YOLOv8
https://github.com/ultralytics/ultralytics -
Google Colab GPU Environment