Skip to content

🌿 Plant Disease Detection Web App πŸ” | Detects crop diseases from leaf images using a CNN trained on the PlantVillage dataset. 🧠 Built with Keras, OpenCV & Flask. Upload and predict in real-time with high accuracy! πŸš€

License

Notifications You must be signed in to change notification settings

Avnish1447/Plant-Disease-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌿 Plant Disease Detector

License: MIT

Python Flask Keras OpenCV


πŸ“Œ Overview

🌱 Plant Disease Detector is a deep-learning web app that classifies leaf images into healthy or diseased categories using a custom Convolutional Neural Network (CNN). It leverages data augmentation, batch normalization, and dropout for robust performance, then wraps the trained model in a Flask interface for real-time predictions.


πŸ” Key Features

  • πŸ–ΌοΈ Image Classification: Detects multiple plant diseases from leaf photos
  • πŸŽ›οΈ Data Augmentation: Rotation, shifts, shear, zoom & flips for better generalization
  • πŸš€ Fast Inference: Lightweight Flask app serving predictions in seconds
  • πŸ“Š Visual Insights: Training/validation loss & accuracy plots for analysis
  • πŸ”„ Persistence: Save & load models with pickle for reuse

πŸ› οΈ Tech Stack

Component Library / Tool
Model Building Keras (TensorFlow)
Image Processing OpenCV, NumPy
Web Framework Flask
Data Handling scikit-learn, pickle
Visualization Matplotlib

πŸ“‚ Project Structure


plant-disease-detector/
β”œβ”€β”€ archive/                 # Dataset root
β”‚   └── PlantVillage/
β”œβ”€β”€ static/
β”‚   └── uploads/             # Uploaded images for Flask
β”œβ”€β”€ templates/
β”‚   └── index.html           # Flask UI template
β”œβ”€β”€ Output Graphs/           # πŸ“Š Plots for model performance (accuracy/loss)
β”‚   β”œβ”€β”€ Output (1).jpg
β”‚   β”œβ”€β”€ Output (2).jpg
β”‚   β”œβ”€β”€ Output (3).jpg
β”‚   β”œβ”€β”€ Output (4).jpg
β”‚   β”œβ”€β”€ Output (5).jpg
β”‚   β”œβ”€β”€ Output (6).jpg
β”‚   β”œβ”€β”€ Output (7).jpg
β”‚   β”œβ”€β”€ Output (8).jpg
β”‚   └── Output (9).jpg
β”œβ”€β”€ main.ipynb                # Jupyter notebook for training & export
β”œβ”€β”€ app.py                    # Flask application
β”œβ”€β”€ mod.py                    # Prediction helper functions (check function)
β”œβ”€β”€ cnn_model.pkl             # Trained model
β”œβ”€β”€ label_transform.pkl       # Label binarizer
β”œβ”€β”€ requirements.txt          # Python dependencies
└── README.md


πŸ”— Link to Dataset

Download the PlantVillage dataset from Kaggle:

πŸ“₯ PlantVillage Dataset on Kaggle


πŸš€ Deployment

  1. Download the Dataset

    • Clone or download the PlantVillage dataset into archive/PlantVillage.
  2. Install Dependencies

    pip install -r requirements.txt
    
    
  3. Train & Export Model

    • Run main.ipynb notebook to train the CNN model.
    • This will generate cnn_model.pkl and label_transform.pkl.
  4. Run the App

    python app.py
  5. Access the Web Interface


πŸ“Š Output Visualizations

1. Training and Validation Accuracy

2. Training and Validation Loss


🎯 Model Performance

  • Training Accuracy: ~98%
  • Validation Accuracy: ~96%
  • Test Accuracy: ~95% (may vary based on dataset split)

🀝 Authors

  • @Avnish1447

License

License: MIT

This project is licensed under the MIT License β€” see the LICENSE file for details.

Happy diagnosing! πŸŒΎπŸ”¬πŸ˜

About

🌿 Plant Disease Detection Web App πŸ” | Detects crop diseases from leaf images using a CNN trained on the PlantVillage dataset. 🧠 Built with Keras, OpenCV & Flask. Upload and predict in real-time with high accuracy! πŸš€

Topics

Resources

License

Stars

Watchers

Forks