This project uses Convolutional Neural Networks (CNNs) to detect and classify plant diseases from leaf images. Leveraging Python libraries for data processing, TensorFlow for model training, and Flask for deployment, this solution aims to offer scalable and efficient disease detection to support agricultural productivity.
- Overview
- Data Classification
- Project Structure
- Dependencies
- Steps Involved
- Usage
- Results
- Future Work
Plant diseases can cause significant agricultural losses. This project targets early disease detection by focusing on leaf images, which often display the first visible signs of disease. The system is built using CNNs for high accuracy in image classification, aiming to provide farmers and researchers with a practical tool for real-time disease diagnosis.
Images of various plant diseases are used for training the model. Each image is labeled based on the plant type and disease, creating a structured dataset for the CNN model to classify different diseases accurately. Key classification categories include:
- Plant species
- Healthy vs. diseased
- Specific diseases for each plant species
Plant_Disease_Detection/
├── data/ # Dataset of leaf images
├── notebooks/ # Jupyter notebooks for model training and evaluation
├── src/ # Source code for preprocessing, training, and Flask app
│ ├── preprocess.py # Data preprocessing script
│ ├── train.py # Model training script
│ ├── app.py # Flask web app for user interface
├── static/ # Static files for web interface (e.g., CSS)
├── templates/ # HTML templates for web interface
└── README.md # Project documentation
- Python 3.8+
- TensorFlow:
pip install tensorflow - PIL (Pillow):
pip install pillow - Seaborn:
pip install seaborn - Matplotlib:
pip install matplotlib - Flask:
pip install flask - Spicy:
pip install spicy
- Data Collection & Labeling: Gather and label images of plant leaves with various diseases.
- Data Preprocessing:
- Resizing and normalizing images.
- Applying data augmentation (rotation, flipping, etc.) to improve model generalization.
- Model Building:
- Build a CNN using TensorFlow.
- Train the model on labeled images.
- Optimize the model through hyperparameter tuning and validation.
- Deployment:
- Create a web interface using Flask to allow users to upload images and view the diagnosis results.
- Evaluation:
- Test the model on unseen data to ensure accurate disease detection.
-
Clone the repository:
git clone https://github.com/pranawk/Leaf_disease_analyzer.git cd Leaf_disease_analyzer -
Install dependencies:
pip install -r requirements.txt
-
Run the Flask application:
python src/app.py
The app will be available at
http://localhost:5000. Upload a leaf image, and the system will display the predicted disease.
The model achieved high accuracy in classifying diseases across multiple plant species. Key metrics:
- Accuracy: 92%
- Precision: 90%
- Recall: 92%
Example of predictions on test images:
- Healthy vs. diseased detection: 95% accuracy
- Disease-specific classification: 90% accuracy
- Expand Dataset: Include additional plant species and disease types.
- Mobile Integration: Develop a mobile-friendly interface or integrate with drones for real-time monitoring in fields.
- Cloud Deployment: Shift to cloud for handling larger datasets and real-time processing.