Skip to content

Deep learning model for detecting plant diseases using CNN and Streamlit.

License

Notifications You must be signed in to change notification settings

shraddhagreddy/Plant_disease_prediction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Python TensorFlow Streamlit License: MIT

๐ŸŒฑ Plant Disease Prediction A deep learning web app to classify plant diseases from leaf images

๐Ÿ“Œ About

Plant Disease Prediction is a deep learning project that classifies plant diseases from leaf images, using convolutional neural networks and a deployable web interface.
Early detection of plant diseases is vital in agriculture โ€” farmers worldwide lose significant yield each year due to disease spread. With this tool, users (farmers, agronomists, researchers) can upload a leaf image and instantly obtain a diagnosis, helping mitigate losses.

The model is trained on the PlantVillage dataset and wrapped in a Streamlit app for ease of use.

โœจ Features

โœ… User-facing

  • Upload a leaf image (JPG/PNG) via web app โ†’ get disease prediction + confidence score
  • Visualize training history (accuracy & loss plots)

๐Ÿ›  Developer / Backend

  • CNN-based model trained on the PlantVillage dataset (38 classes)
  • Saved model (.h5) + class_indices.json for mapping
  • Support for retraining / extending to new classes

๐Ÿ“‚ Project Structure Plant_disease_prediction/ โ”‚โ”€โ”€ app/ # Streamlit app files โ”‚โ”€โ”€ model_training_notebook/ # Jupyter notebooks for training โ”‚โ”€โ”€ test_images/ # Sample test images โ”‚โ”€โ”€ Plant-Model/ # Trained models & class indices โ”‚ โ”œโ”€โ”€ plant_disease_prediction_model.h5 โ”‚ โ”œโ”€โ”€ class_indices.json โ”‚ โ”œโ”€โ”€ model-training.py โ”‚โ”€โ”€ README.md โ”‚โ”€โ”€ LICENSE

๐Ÿš€ Getting Started โœ… Prerequisites

Python 3.7+

TensorFlow / Keras

NumPy, Pandas

Matplotlib, Pillow

Streamlit

โš™๏ธ Setup Instructions

Clone the repository:

git clone https://github.com/shraddhagreddy/Plant_disease_prediction.git cd Plant_disease_prediction

Install dependencies:

pip install -r requirements.txt

Download the PlantVillage Dataset and place it inside your working directory.

๐Ÿ‹๏ธ Model Training

Run the training script:

python Plant-Model/model-training.py

This will:

Train the CNN on the dataset

Save the trained model as plant_disease_prediction_model.h5

Generate class_indices.json for mapping predictions

๐ŸŒ Running the Streamlit App

Run the web app with:

streamlit run app/app.py

Upload a leaf image (.jpg, .jpeg, .png)

Get instant disease predictions ๐ŸŽ‰

๐Ÿ“Š Example Results Training Performance

Model achieves ~92% validation accuracy (update after training).

Sample Prediction

Upload a leaf image โ†’ Prediction: Apple Scab ๐Ÿ๐Ÿ‚

๐Ÿ”ฎ Future Improvements

Add Grad-CAM visualizations for explainable AI

Deploy model to cloud (AWS/GCP/Heroku)

Improve accuracy with transfer learning (ResNet, EfficientNet)

Add mobile app integration for farmers

๐Ÿ›  Tech Stack

Language: Python

Frameworks: TensorFlow, Keras, Streamlit

Data: PlantVillage Dataset

Libraries: NumPy, Pandas, Matplotlib, Pillow

๐Ÿ‘ฉโ€๐Ÿ’ป Author

Shraddha Reddy ๐Ÿ“ง shraddhagreddy@gmail.com

๐Ÿ’ก Always open to collaboration & feedback!

๐Ÿ“œ License

This project is licensed under the MIT License ยฉ 2025 Shraddha Reddy. See the LICENSE file for details.

About

Deep learning model for detecting plant diseases using CNN and Streamlit.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published