-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from Mayank202004/main
Added new project plant disease detection under deep learning
- Loading branch information
Showing
29 changed files
with
6,351 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+2.18 MB
Deep_Learning/Plant Disease Detection/Final tensorflow Models/cotton.h5
Binary file not shown.
Binary file added
BIN
+2.18 MB
Deep_Learning/Plant Disease Detection/Final tensorflow Models/cucumber.h5
Binary file not shown.
Binary file added
BIN
+2.18 MB
Deep_Learning/Plant Disease Detection/Final tensorflow Models/grapes.h5
Binary file not shown.
Binary file added
BIN
+2.18 MB
Deep_Learning/Plant Disease Detection/Final tensorflow Models/guava.h5
Binary file not shown.
Binary file added
BIN
+2.18 MB
Deep_Learning/Plant Disease Detection/Final tensorflow Models/potato.h5
Binary file not shown.
Binary file added
BIN
+2.18 MB
Deep_Learning/Plant Disease Detection/Final tensorflow Models/rice.h5
Binary file not shown.
Binary file added
BIN
+8.66 MB
Deep_Learning/Plant Disease Detection/Final tensorflow Models/sugarcane.h5
Binary file not shown.
Binary file added
BIN
+2.19 MB
Deep_Learning/Plant Disease Detection/Final tensorflow Models/tomato.h5
Binary file not shown.
Binary file added
BIN
+2.18 MB
Deep_Learning/Plant Disease Detection/Final tensorflow Models/wheat.h5
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
# Plant Disease Detection using CNN | ||
|
||
This project implements a **Convolutional Neural Network (CNN)** to detect plant diseases using images of plant leaves. The model is built using **TensorFlow** and **Keras**, and the dataset used is sourced from **Kaggle**. | ||
|
||
## Table of Contents | ||
|
||
- [Introduction](#introduction) | ||
- [Dataset](#dataset) | ||
- [Installation](#installation) | ||
- [Model Architecture](#model-architecture) | ||
- [Training](#training) | ||
- [Results](#results) | ||
- [Usage](#usage) | ||
|
||
|
||
## Introduction | ||
|
||
Plant diseases can have a devastating effect on agricultural productivity. This project aims to detect plant diseases from images of plant leaves using CNNs, which are well-suited for image classification tasks. By identifying diseases early, we can potentially help farmers take corrective action sooner and minimize crop damage. | ||
|
||
## Dataset | ||
|
||
The dataset used for this project is sourced from **[Kaggle](https://www.kaggle.com/)**. It contains labeled images of healthy and diseased plant leaves from various plant species, such as: | ||
|
||
- Apple | ||
- Potato | ||
- Tomato | ||
- Grape | ||
- And more... | ||
|
||
Each image is categorized into one of several classes, including both healthy and various diseased categories. | ||
|
||
## Installation | ||
|
||
To set up the project environment, first clone the repository, then install the required dependencies listed in `requirements.txt`. | ||
|
||
### Clone the Repository | ||
```bash | ||
git clone https://github.com/your-username/ML-Nexus/tree/main/Neural%20Networks/Plant%20Disease%20Detection.git | ||
cd plant-disease-detection | ||
``` | ||
|
||
### Install Dependencies | ||
```bash | ||
pip install -r requirements.txt | ||
``` | ||
|
||
Dependencies include: | ||
- TensorFlow | ||
- Keras | ||
- Matplotlib | ||
|
||
|
||
## Model Architecture | ||
|
||
We employ a **Convolutional Neural Network (CNN)** to process the images and classify them into their respective categories. The architecture consists of: | ||
|
||
- **Input Layer:** Input size matching the image dimensions. | ||
- **Convolutional Layers:** For feature extraction (with filters for edges, textures, etc.). | ||
- **Pooling Layers:** To reduce spatial dimensions. | ||
- **Fully Connected Layers:** For classification. | ||
- **Output Layer:** Softmax for classification into plant disease categories. | ||
|
||
### Example CNN Layer Structure: | ||
```text | ||
1. Conv2D(32 filters, kernel_size=3x3, activation='relu') | ||
2. MaxPooling2D(pool_size=2x2) | ||
3. Conv2D(64 filters, kernel_size=3x3, activation='relu') | ||
4. MaxPooling2D(pool_size=2x2) | ||
5. Flatten() | ||
6. Dense(128, activation='relu') | ||
7. Dense(number_of_classes, activation='softmax') | ||
``` | ||
|
||
## Training | ||
|
||
The model is trained on the Kaggle dataset, which is split into training and validation sets. We use **categorical cross-entropy** as the loss function and **Adam** optimizer for the training process. | ||
|
||
To train the model, simply run: | ||
|
||
```bash | ||
python train_model.py | ||
``` | ||
|
||
Key training details: | ||
- **Epochs:** 50 (adjust based on performance) | ||
- **Batch Size:** 32 | ||
- **Validation Split:** 10% of the dataset | ||
- **test Split:** 10% of the dataset | ||
- **train Split:** 80% of the dataset | ||
|
||
## Results | ||
|
||
After training, the model achieves good accuracy in classifying the plant leaves as healthy or diseased. Below are some key metrics from the model: | ||
|
||
- **Test Accuracy:** X% | ||
- **Validation Accuracy:** Y% | ||
- **Loss:** Z% | ||
|
||
You can view the training process with graphs of accuracy and loss: | ||
|
||
```python | ||
import matplotlib.pyplot as plt | ||
plt.plot(history.history['accuracy']) | ||
plt.plot(history.history['val_accuracy']) | ||
plt.title('Model Accuracy') | ||
plt.ylabel('Accuracy') | ||
plt.xlabel('Epoch') | ||
plt.legend(['Train', 'Validation'], loc='upper left') | ||
plt.show() | ||
``` | ||
|
||
## Usage | ||
|
||
Once the model is trained, you can use it to predict plant diseases by passing images of leaves to the trained model. | ||
|
||
```python | ||
from tensorflow.keras.models import load_model | ||
import numpy as np | ||
from keras.preprocessing import image | ||
|
||
# Load model | ||
model = load_model('plant_disease_model.h5') | ||
|
||
# Load and preprocess image | ||
img = image.load_img('path_to_image.jpg', target_size=(150, 150)) | ||
img = image.img_to_array(img) | ||
img = np.expand_dims(img, axis=0) | ||
|
||
# Predict | ||
result = model.predict(img) | ||
``` |
Binary file added
BIN
+108 KB
Deep_Learning/Plant Disease Detection/assets/images/cotton_result-graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+98.3 KB
Deep_Learning/Plant Disease Detection/assets/images/grapes_result_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+102 KB
Deep_Learning/Plant Disease Detection/assets/images/guava_result_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+94 KB
Deep_Learning/Plant Disease Detection/assets/images/potato_result_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+111 KB
Deep_Learning/Plant Disease Detection/assets/images/sugarcane_result_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+103 KB
Deep_Learning/Plant Disease Detection/assets/images/tomato_result_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,272 changes: 1,272 additions & 0 deletions
1,272
Deep_Learning/Plant Disease Detection/ipynb files/Cotton_Classification.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
1,224 changes: 1,224 additions & 0 deletions
1,224
Deep_Learning/Plant Disease Detection/ipynb files/Grapes_Classification.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
1,200 changes: 1,200 additions & 0 deletions
1,200
Deep_Learning/Plant Disease Detection/ipynb files/Guava_Classification.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
1,214 changes: 1,214 additions & 0 deletions
1,214
Deep_Learning/Plant Disease Detection/ipynb files/Potato_Classification.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
Deep_Learning/Plant Disease Detection/ipynb files/Sugarcane_Classification.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
1,101 changes: 1,101 additions & 0 deletions
1,101
Deep_Learning/Plant Disease Detection/ipynb files/Tomato_Classification.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
Deep_Learning/Plant Disease Detection/ipynb files/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
tensorflow==2.14.0 | ||
matplotlib==3.7.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
# Plant Disease Detection Results | ||
The project focuses on creating multiple tensorflow models using CNN for disease detection of various plants. | ||
|
||
## Table of Contents | ||
- [Potato Image Classification](#potato-image-classification) | ||
- [Tomato Image Classification](#tomato-image-classification) | ||
- [Cotton Image Classification](#cotton-image-classification) | ||
- [Guava Image Classification](#guava-image-classification) | ||
- [Grapes Image Classification](#grapes-image-classification) | ||
- [Sugarcane Image Classification](#sugarcane-image-classification) | ||
|
||
## Potato Image Classification | ||
|
||
### Model Overview | ||
In this project, we aim to classify potato plant health into three categories: | ||
|
||
- **Early Blight** | ||
- **Healthy** | ||
- **Late Blight** | ||
|
||
### Results | ||
The classification model achieved an impressive accuracy of **98.02%** on the testing dataset. This high accuracy demonstrates the effectiveness of our model in distinguishing between healthy plants and those affected by early and late blight. | ||
|
||
|
||
### Performance Chart | ||
 | ||
|
||
|
||
|
||
|
||
|
||
--- | ||
|
||
## Tomato Image Classification | ||
|
||
### Model Overview | ||
In this project, we aim to classify tomato plant health into ten categories: | ||
|
||
- **Bacterial Spot** | ||
- **Early Blight** | ||
- **Late Blight** | ||
- **Leaf Mold** | ||
- **Septoria Leaf Spot** | ||
- **Target Spot** | ||
- **Tomato Yellow Leaf Curl Virus** | ||
- **Tomato Mosaic Virus** | ||
- **Two-Spotted Spider Mite** | ||
- **Healthy** | ||
|
||
### Results | ||
The classification model achieved an impressive accuracy of **98.43%** on the testing dataset. This high accuracy demonstrates the model's effectiveness in identifying various tomato diseases and distinguishing healthy plants. | ||
|
||
### Performance Chart | ||
 | ||
|
||
--- | ||
|
||
## Cotton Image Classification | ||
|
||
### Model Overview | ||
In this project, we aim to classify cotton plant health into four categories: | ||
|
||
- **Cotton Bacterial Blight** | ||
- **Cotton Curl Virus** | ||
- **Cotton Fusarium Wilt** | ||
- **Healthy** | ||
|
||
### Results | ||
The classification model achieved an accuracy of **97.40%** on the testing dataset, showcasing the model's capacity to effectively classify diseases in cotton plants. | ||
|
||
### Result Checking | ||
 | ||
|
||
|
||
### Performance Chart | ||
 | ||
|
||
--- | ||
|
||
## Guava Image Classification | ||
|
||
### Model Overview | ||
In this project, we aim to classify guava plant health into two categories: | ||
|
||
- **Anthracnose** | ||
- **Healthy** | ||
|
||
### Results | ||
The classification model achieved an impressive accuracy of **98.43%** on the testing dataset, indicating its proficiency in detecting guava diseases. | ||
|
||
### Result Checking | ||
 | ||
|
||
### Performance Chart | ||
 | ||
|
||
--- | ||
|
||
## Grapes Image Classification | ||
|
||
### Model Overview | ||
In this project, we aim to classify grape plant health into three categories: | ||
|
||
- **Grape Black Measles** | ||
- **Grape Black Rot** | ||
- **Healthy** | ||
|
||
### Results | ||
The classification model achieved an impressive accuracy of **99.37%** on the testing dataset. This high accuracy demonstrates the model's ability to classify grape diseases effectively. | ||
|
||
### Result Checking | ||
 | ||
|
||
### Performance Chart | ||
 | ||
|
||
--- | ||
|
||
## Sugarcane Image Classification | ||
|
||
### Model Overview | ||
In this project, we aim to classify sugarcane plant health into five categories: | ||
|
||
- **Healthy** | ||
- **Mosaic** | ||
- **Red Rot** | ||
- **Rust** | ||
- **Yellow** | ||
|
||
### Results | ||
The classification model achieved an accuracy of **95.83%** on the testing dataset. This result reflects the model's effectiveness in detecting sugarcane diseases. | ||
|
||
### Performance Chart | ||
 | ||
|
||
|
||
|
||
### Conclusion | ||
The results indicate that the model performs exceptionally well in identifying and classifying potato plant diseases. Further enhancement can be achieved by adding more data and training on additional plant varieties. | ||
The models can be deployed on web or app platform to help farmers detect crop diseases early and easily. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters