π± 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.
- πΌοΈ 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
Component | Library / Tool |
---|---|
Model Building | Keras (TensorFlow) |
Image Processing | OpenCV, NumPy |
Web Framework | Flask |
Data Handling | scikit-learn, pickle |
Visualization | Matplotlib |
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
Download the PlantVillage dataset from Kaggle:
π₯ PlantVillage Dataset on Kaggle
-
Download the Dataset
- Clone or download the PlantVillage dataset into
archive/PlantVillage
.
- Clone or download the PlantVillage dataset into
-
Install Dependencies
pip install -r requirements.txt
-
Train & Export Model
- Run
main.ipynb
notebook to train the CNN model. - This will generate
cnn_model.pkl
andlabel_transform.pkl
.
- Run
-
Run the App
python app.py
-
Access the Web Interface
- Navigate to http://127.0.0.1:5000 in your browser.
- Training Accuracy: ~98%
- Validation Accuracy: ~96%
- Test Accuracy: ~95% (may vary based on dataset split)
- @Avnish1447
This project is licensed under the MIT License β see the LICENSE file for details.
Happy diagnosing! πΎπ¬π