Skip to content

Adityagupta-dev/Crop-Disease-Prediction-and-Treatment-Recommendation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plant Disease Detection System

Overview

The Plant Disease Detection System is an AI-powered web application built with Streamlit that helps farmers and gardeners identify diseases in tomato and watermelon plants. By simply uploading a photo of a plant leaf, users can receive instant disease diagnosis along with specific treatment recommendations and prevention measures.

Features

  • Real-time Disease Detection: Upload leaf images and get immediate analysis
  • Multi-crop Support: Currently supports tomatoes (10 classes) and watermelons (4 classes)
  • Treatment Recommendations: Provides specific product recommendations and application instructions
  • Prevention Tips: Offers guidance on preventing future disease occurrences
  • Interactive UI: User-friendly interface with intuitive navigation and visualization
  • Visual Analysis: Displays probability distribution of detected diseases

Models

The system utilizes two deep learning models:

Tomato Disease Model

  • Architecture: EfficientNetB0 (fine-tuned)
  • Classes: 10 classes (9 diseases + healthy)
  • Accuracy: ~97% on test set
  • Disease Categories:
    • Tomato Mosaic Virus
    • Target Spot
    • Bacterial Spot
    • Tomato Yellow Leaf Curl Virus
    • Late Blight
    • Leaf Mold
    • Early Blight
    • Spider Mites
    • Septoria Leaf Spot
    • Healthy

Watermelon Disease Model

  • Architecture: MobileNetV2
  • Classes: 4 classes (3 diseases + healthy)
  • Accuracy: ~95% on test set
  • Disease Categories:
    • Anthracnose
    • Downy Mildew
    • Mosaic Virus
    • Healthy

Installation and Setup

Prerequisites

  • Python 3.7+
  • TensorFlow 2.x
  • OpenCV
  • Streamlit
  • NumPy
  • Matplotlib
  • Pillow

Installation Steps

  1. Clone the repository:

    git clone https://github.com/yourusername/plant-disease-detection.git
    cd plant-disease-detection
  2. Create a virtual environment (optional but recommended):

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install the required packages:

    pip install -r requirements.txt
  4. Download the pre-trained models and place them in the models directory:

    • models/Tomato_EfficientNetB0_finetuned_final.h5
    • models/Watermelon_MobileNetV2_final.h5
    • models/confusion_matrix.png
    • models/Watermelon_MobileNetV2_training_history.png
    • models/Tomato_EfficientNetB0_finetuned_training_history.png
    • models/Head image.jpg
  5. Run the application:

    streamlit run app.py
  6. Access the application in your web browser at http://localhost:8501

How to Use

  1. Navigate to the "Disease Detection" page using the sidebar menu
  2. Select the crop type (tomato or watermelon)
  3. Upload a clear image of your plant leaf
  4. Review the detection results and treatment recommendations

Best Practices for Image Capture

  • Take photos in good natural light
  • Make sure the leaf is in focus and clearly visible
  • Include the entire leaf in the frame
  • Avoid shadows or glare on the leaf surface

Treatment Recommendations

The system provides Rallis product recommendations based on the detected disease, including:

  • Specific product name and formulation
  • Application instructions with dosage and frequency
  • Prevention measures to avoid recurrence

Technical Implementation

The application is built using:

  • Streamlit: For the web interface
  • TensorFlow/Keras: For loading and running the disease detection models
  • OpenCV: For image preprocessing
  • Matplotlib: For visualization of prediction probabilities
  • NumPy: For numerical operations

Future Enhancements

  • Add support for additional crops (e.g., cucumbers, peppers)
  • Implement multiple disease detection in a single image
  • Add severity estimation for detected diseases
  • Integrate with weather data for risk prediction
  • Add multi-language support

Contact Information

For support, feature requests, or collaboration:

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A CNN based machine learning project that predicts the crop disease (for now its for watermelon) and recommends treatment for them(Rallis products)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages