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.
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.
- π± 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
| 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 |
βββ README.md
βββ YOLOv8_plant_detection.ipynb
βββ apple.mp4
βββ requirements.txt
βββ track.py
git clone https://github.com/muqadasejaz/-Plant-Detection-using-YOLOv8pip install ultralytics opencv-python matplotlib-
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.
Open train.ipynb in Google Colab and run all cells.
After training, your model weights will be saved in the runs/train/weights/ directory
To test on new images or videos:
yolo task=detect mode=predict model=runs/train/weights/best.pt source='path/to/image_or_video'Run the tracking script to follow detected plants in real-time videos:
python track.pyThe 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.
Total Images: ~2,600
Image Type: RGB (JPEG/PNG)
Annotation Format: YOLOv8 (Bounding Boxes)
Split Ratio:
Train: 80%
Validation: 10%
Test: 10%
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
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
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.
| Metric | Value |
|---|---|
| Model | YOLOv8n |
| Epochs | 50 |
| Image Size | 640x640 |
| Precision | 0.91 |
| Recall | 0.89 |
| mAP@50 | 0.93 |
| mAP@50-95 | 0.87 |
- Healthy Leaf β 99% Confidence
- Tomato Leaf Mold β 95% Confidence
- Potato Early Blight β 92% Confidence
- Apple Scab β 93% Confidence
The model accurately identifies diseased areas, drawing bounding boxes with class names and confidence scores on both images and videos.
Image Output:
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
- YOLOv8 by Ultralytics β Official YOLOv8 repository and documentation.
- Roboflow: Plant Diseases Detection and Classification Dataset β Dataset used for model training and evaluation.
- PyTorch Documentation β Deep learning framework used to train and test the model.
- OpenCV Documentation β Used for image preprocessing and visualization.
- Ultralytics YOLO Docs β Detailed usage guide and examples for YOLOv8.
Muqadas Ejaz
BS Computer Science (AI Specialization)
AI/ML Engineer
Data Science & Gen AI Enthusiast
π« Connect with me on LinkedIn
π GitHub: github.com/muqadasejaz
This project is open-source and available under the MIT License.





