Skip to content

A computer vision-based project that uses YOLOv8 to detect and classify plant leaves in real time, helping identify healthy and diseased plants efficiently to support smart agriculture solutions.

License

Notifications You must be signed in to change notification settings

muqadasejaz/Plant-Detection-using-YOLOv8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌿 Plant Detection using YOLOv8

A computer vision-based project that uses YOLOv8 to detect and classify plant leaves in real time, helping identify healthy and diseased plants efficiently to support smart agriculture solutions.


🧾 Overview

This project focuses on real-time plant disease detection using the YOLOv8 (You Only Look Once) deep learning model.
The system is designed to accurately detect and classify plant diseases from images and videos. It also includes tracking functionality to follow detected plants or leaves across video frames using track.py.

The goal of this project is to help farmers and researchers identify plant diseases early, ensuring better crop health and productivity.


✨ Features

  • 🌱 Real-time plant and leaf detection using YOLOv8
  • 🧠 Trained on a robust open-source dataset
  • πŸ“Š High detection accuracy and confidence scoring
  • πŸŽ₯ Real-time object tracking using track.py
  • ☁️ Model training performed on Google Colab
  • πŸ’Ύ Dataset stored and accessed via Google Drive

🧰 Tools and Technologies

Category Tools / Libraries
Programming Language Python
Deep Learning Framework PyTorch
Object Detection Model YOLOv8 (Ultralytics)
Data Handling Roboflow
Visualization OpenCV, Matplotlib
Development Platform Jupyter Notebook / Google Colab / Kaggle

πŸ“‚ Project Structure

β”œβ”€β”€ README.md

β”œβ”€β”€ YOLOv8_plant_detection.ipynb

β”œβ”€β”€ apple.mp4

β”œβ”€β”€ requirements.txt

└── track.py


πŸš€ Usage

1. Clone the Repository

git clone https://github.com/muqadasejaz/-Plant-Detection-using-YOLOv8

2. Install Dependencies

pip install ultralytics opencv-python matplotlib

3. Dataset Setup

  • Download the dataset from Roboflow Plant Disease Dataset

  • Upload it to your Google Drive

  • Mount Google Drive in your Colab notebook:

    from google.colab import drive
    drive.mount('/content/drive')
  • Extract and link the dataset path in your code.

4. Train the Model

Open train.ipynb in Google Colab and run all cells. After training, your model weights will be saved in the runs/train/weights/ directory

5. Perform Detection

To test on new images or videos:

  yolo task=detect mode=predict model=runs/train/weights/best.pt source='path/to/image_or_video'

6. Tracking

Run the tracking script to follow detected plants in real-time videos:

python track.py

πŸ“Š Dataset

The dataset used for this project is sourced from Roboflow Universe . It is titled β€œPlant Diseases Detection and Classification” and contains labeled images of various healthy and diseased plant leaves for multiple species.

🧠 Overview

Total Images: ~2,600

Image Type: RGB (JPEG/PNG)

Annotation Format: YOLOv8 (Bounding Boxes)

Split Ratio:

Train: 80%

Validation: 10%

Test: 10%

🌿 Classes

The dataset covers multiple types of plant diseases along with healthy leaves. Below are some example classes:

Apple Scab

Apple Rust

Corn Leaf Blight

Corn Gray Spot

Potato Early Blight

Potato Late Blight

Tomato Bacterial Spot

Tomato Leaf Mold

Tomato Mosaic Virus

Healthy Leaf

πŸ”— Dataset Source

This dataset was prepared and published by contributors of Graduation Project 2023 on Roboflow Universe.
It was curated for research and experimentation in plant disease detection and classification using computer vision models such as YOLOv8.

πŸ“Ž Dataset Link: Plant Diseases Detection and Classification – Roboflow Universe

πŸ“š Source Platform: Roboflow


πŸ“ˆ Results

The YOLOv8 model was trained and tested on the Plant Diseases Detection and Classification dataset from Roboflow.
The results demonstrate that the model performs efficiently in detecting and classifying plant diseases across multiple species.

πŸ”¬ Model Performance

Metric Value
Model YOLOv8n
Epochs 50
Image Size 640x640
Precision 0.91
Recall 0.89
mAP@50 0.93
mAP@50-95 0.87

🌿 Detection Examples

  • Healthy Leaf β†’ 99% Confidence
  • Tomato Leaf Mold β†’ 95% Confidence
  • Potato Early Blight β†’ 92% Confidence
  • Apple Scab β†’ 93% Confidence

πŸ–ΌοΈ Visualization

The model accurately identifies diseased areas, drawing bounding boxes with class names and confidence scores on both images and videos.

Image Output:

output

output1

output3

output4

output5

output6

Demo Output:

The model was also tested on real-time plant videos. It successfully detected diseased regions frame-by-frame and displayed bounding boxes with corresponding class names and confidence scores.

yolo.mp4

πŸ”– References


πŸ‘€ Author

Muqadas Ejaz

BS Computer Science (AI Specialization)

AI/ML Engineer

Data Science & Gen AI Enthusiast

πŸ“« Connect with me on LinkedIn

🌐 GitHub: github.com/muqadasejaz


πŸ“Ž License

This project is open-source and available under the MIT License.

About

A computer vision-based project that uses YOLOv8 to detect and classify plant leaves in real time, helping identify healthy and diseased plants efficiently to support smart agriculture solutions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published