This repository contains a deep learning-based image classification project to detect and classify leaf diseases in potato and tomato plants using Convolutional Neural Networks (CNNs) built with PyTorch.
Agriculture plays a vital role in sustaining the global economy and food supply. However, the productivity of crops is significantly impacted by plant diseases, many of which manifest visibly on the leaves. Manual identification of leaf diseases is time-consuming, labor-intensive, and often inaccurate, especially in large-scale farming.
The objective of this project is to develop an automated system for classifying plant leaf diseases using deep learning techniques. The system will be trained on a dataset containing images of healthy and diseased leaves, specially of potato and tomato plants, with multiple classes of diseases. By leveraging Convolutional Neural Networks (CNNs), the model will learn to accurately distinguish between various disease types and healthy leaves.
This solution aims to assist farmers and agricultural experts by providing a fast, scalable, and accurate method to diagnose tomato and potato plant diseases early, thereby improving crop management, reducing losses, and increasing yield.
- Preprocess and augment image data to enhance model robustness.
- Train a CNN to classify leaf images into appropriate disease categories.
- Evaluate the model using metrics such as accuracy, precision and recall.
The datset that I have used for the project is taken from the Kaggle website (https://www.kaggle.com/datasets/arjuntejaswi/plant-village/data) Well kaggle is a famous website known for organizing many data science competition and for delivering dataset.
This dataset consist of 15 different types of leafs, the total size of the dataset is 20605 outof which 2475 are of pepper bell leafs, 2152 are of potato leafs and 15978 images are of tomato leafs.
-
Pepper__bell___Bacterial_spot -> 997 images.
-
Pepper__bell___healthy -> 1478 images.
-
Potato___Early_blight -> 1000 images.
-
Potato___healthy -> 152 images.
-
Potato___Late_blight -> 1000 images.
-
Tomato_Bacterial_spot -> 2127 images.
-
Tomato_Early_blight -> 1000 images.
-
Tomato_healthy -> 1591 images.
-
Tomato_Late_blight -> 1909 images.
-
Tomato_Leaf_Mold -> 952 images.
-
Tomato_Septoria_leaf_spot -> 1771 images.
-
Tomato_Spider_mites_Two_spotted_spider_mite -> 1676 images.
-
Tomato__Target_Spot -> 1404 images.
-
Tomato__Tomato_mosaic_virus -> 373 images.
-
Tomato__Tomato_YellowLeaf__Curl_Virus -> 3202 images.
- Mean per channel (BGR): [0.41131156 0.47504014 0.45880439]
- Std per channel (BGR): [0.19125798 0.15119882 0.17416257]
- Shape: height: 256, width: 256, channels: 3
| Model | Accuracy | Loss | Precision | Recall |
|---|---|---|---|---|
| Custom | 100 | 0.00 | 1.00 | 1.00 |
As we can see that my custom cnn_model can accurately classify the images so I haven't used any IMAGENET models to classfiy the images, as of more detail on the cnn architecture i have provided the python notebook.
