This project is an open vision initiative built using YOLOv8, a state-of-the-art object detection model developed by Ultralytics. It presents a complete pipeline for detecting animals from CCTV footage — suitable for both real-time and static image analysis.
The system is designed to be modular, scalable, and easy to deploy, and is particularly useful for:
- 🐄 Farm and livestock monitoring
- 🐘 Wildlife conservation and animal tracking
- 🚧 Roadside animal presence alerts
- 📷 General CCTV-based animal surveillance
This repository includes:
- ✅ Custom dataset loading and analysis
- ✅ Augmentation and data quality checks
- ✅ YOLOv8 model training and evaluation
- ✅ Inference interface for single images
- ✅ Example visualization of results
Source: Private Dataset
Classes:
['Bird', 'Cats', 'Cow', 'Deer', 'Dog', 'Elephant', 'Giraffe', 'Person', 'Pig', 'Sheep']Folder Structure:
└── train
├── images
└── labels
└── valid
├── images
└── labels
└── test
├── images
└── labels
Label Format (YOLO):
<class_id> <x_center> <y_center> <width> <height> # All values normalized (0–1)
- Upload the
.ipynbnotebook to Kaggle or run locally with Jupyter.
pip install ultralytics albumentations opencv-python matplotlib seaborn- Dataset structure check
- Class distribution visualization
- Sample image bounding box rendering
- Augmentation and quality validation
- Loads pretrained
yolov8s.pt - Trains for 25 epochs,
imgsz=640,batch=16 - Saves outputs to
runs/detect/animal-detection-yolov8/
Generates plots automatically:
- 📈 F1 Curve
- 🎯 Precision-Recall Curve
- ✅ Precision and Recall
- Run inference on a static image
- Output is visualized directly using
matplotlib - Extendable to webcam/video input
Sample YOLOv8 output with bounding boxes on animal classes:
📷 Image: valid/images/sample.jpg
→ Detected: Cow, Dog, Sheep with confidence > 0.5
→ Rendered bounding boxes in real-time
YOLOv8 provides performance metrics during and after training, including:
mAP@0.5,mAP@0.5:0.95- Precision, Recall, and F1 score
- Loss curves for training and validation
All metrics are logged automatically and plots are available under:
runs/detect/animal-detection-yolov8/
This project uses Python 3.8+ and runs in environments like Kaggle, Colab, or Jupyter.
pip install ultralytics albumentations opencv-python matplotlib seabornThe trained YOLOv8 weights aren’t published here please email kajalbhammar@gmail.com to request access.
Kajal Bhammar
AI/ML Developer
📧 Email: kajalbhammar@gmail.com
Feel free to reach out for collaboration or inquiries.
