Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Animal Detection Using YOLO and Faster R-CNN

A comparative deep learning project evaluating YOLOv8, YOLOv5, and Faster R-CNN for multi-class animal detection. This repository contains the complete training pipeline, trained models, evaluation notebooks, and benchmarking results on a custom 27-class animal detection dataset.

The project was developed as the computer vision component of an Animal Alert System, where accurate and real-time detection of wildlife and domestic animals is essential for timely monitoring and alerts.


Features

  • Comparative study of YOLOv8, YOLOv5, and Faster R-CNN
  • Custom object detection dataset with 27 classes
  • Complete training notebooks for all models
  • Trained model weights
  • Benchmark notebooks comparing model performance
  • Training curves, PR curves, F1 curves, and confusion matrices
  • Real-world inference examples
  • Modular repository structure for reproducibility

Project Structure

Animal-Detection-Using-YOLO-and-Faster-RCNN/
│
├── dataset/
│
├── docs/
│   ├── images/
│   └── results/
│       ├── yolov8/
│       ├── yolov5/
│       └── faster_rcnn/
│
├── models/
│   ├── yolov8/
│   ├── yolov5/
│   └── faster_rcnn/
│
├── notebooks/
│   ├── train_yolov8.ipynb
│   ├── train_yolov5.ipynb
│   ├── train_faster_rcnn.ipynb
│   ├── YOLOv8_vs_YOLOv5_Final_Clean.ipynb
│   └── YOLOv8_vs_FasterRCNN_Comparison.ipynb
│
├── requirements.txt
└── README.md

Dataset

The models were trained on a custom object detection dataset containing 27 classes, covering wildlife, domestic animals, and humans.

Category Classes
Wild Animals Bear, Deer, Elephant, Fox, Gaur, Indian Pangolin, Leopard, Lion, Monitor Lizard, Monkey, Nilgai, Peacock, Rabbit, Rat, Tiger
Domestic Animals Buffalo, Camel, Cat, Cow, Dog, Donkey, Goat, Hen, Horse, Sheep
Human Person

The dataset combines publicly available datasets with manually annotated images.

Dataset Access

The complete training dataset is not included in this repository due to its size and licensing considerations.

If you are interested in obtaining the dataset for academic, educational, or research purposes, please contact:

Models

YOLOv8

  • One-stage detector
  • Optimized for real-time inference
  • Highest overall benchmark performance

YOLOv5

  • Lightweight detector
  • Strong baseline for comparison
  • Faster than two-stage detectors

Faster R-CNN

  • Two-stage detector
  • Strong localization capability
  • Benchmark for high-accuracy detection

Training Configuration

Parameter Value
Image Size 640 × 640
Classes 27
Training Images 27,138
Validation Images 3,392
Batch Size 16

Performance Comparison

YOLOv8 vs YOLOv5

Metric YOLOv8m YOLOv5
Precision 0.874 0.733
Recall 0.825 0.693
mAP@0.50 0.885 0.746
mAP@0.50:0.95 0.662 0.460

YOLOv8 vs Faster R-CNN

Metric YOLOv8m Faster R-CNN
mAP@0.50 0.885 0.822
mAP@0.50:0.95 0.662 0.539
Average Recall 0.825 0.664
Inference Time 14.6 ms 44.6–125 ms

Key Findings

  • YOLOv8 achieved the highest overall detection performance.
  • YOLOv8 consistently outperformed YOLOv5 in precision, recall, and mAP.
  • Faster R-CNN produced competitive detection quality but required significantly longer inference time.
  • YOLOv8 offered the best balance between accuracy and real-time performance, making it the preferred model for deployment in the Animal Alert System.

Benchmark Visualizations (Yolov8)

YOLOv8 PR Curve

YOLOv8 F1 Curve

YOLOv8 Confusion


Repository Contents

Training

  • YOLOv8 Training Notebook
  • YOLOv5 Training Notebook
  • Faster R-CNN Training Notebook

Benchmarking

  • YOLOv8 vs YOLOv5 Comparison
  • YOLOv8 vs Faster R-CNN Comparison

Models

  • YOLOv8 Best Weights
  • YOLOv5 Best Weights
  • Faster R-CNN Best Checkpoint

Related Project

This repository focuses exclusively on model development, benchmarking, and evaluation.

The complete Animal Alert System application (Flask backend, authentication, webcam detection, image/video processing, alerts, and user interface) is maintained separately.


Technologies Used

  • Python
  • PyTorch
  • Torchvision
  • Ultralytics YOLO
  • OpenCV
  • NumPy
  • Pandas
  • Matplotlib
  • Jupyter Notebook

Copyright Notice

The images included in this repository are provided solely for educational, research, and demonstration purposes. All rights to the original images remain with their respective copyright owners where applicable.

The sample images are included only to demonstrate the performance of the object detection models and are not intended for commercial use or redistribution. If you are the copyright holder of any image and have concerns regarding its use, please contact the repository owner.


License

This project is licensed under the MIT License.

About

This repository contains the complete training pipeline, trained models, evaluation notebooks, and benchmarking results on a custom 27-class animal detection dataset.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages