Skip to content

itsluckysharma01/Potato_Diseases_Detection_with_Deep_Learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฅ” Potato Skin Disease Detection Using Deep Learning

Python TensorFlow Keras License

๐Ÿ”ฌ An AI-powered computer vision system for detecting and classifying potato skin diseases using deep learning techniques.

๐Ÿ“‹ Table of Contents

๐ŸŽฏ Project Overview

This project implements a Convolutional Neural Network (CNN) using TensorFlow/Keras to automatically detect and classify potato skin diseases from digital images. The system can identify three main categories:

  • ๐Ÿƒ Healthy Potatoes
  • ๐Ÿฆ  Early Blight Disease
  • ๐Ÿ„ Late Blight Disease

๐ŸŽฅ Demo

Click to see sample predictions
Input: potato_image.jpg
Output: "Early Blight Disease" (Confidence: 94.2%)

๐ŸŒŸ Features

  • โœ… Multi-class Classification: Detects 3 types of potato conditions
  • โœ… Data Augmentation: Improves model robustness with image transformations
  • โœ… Interactive Visualization: Displays sample images with predictions
  • โœ… Optimized Performance: Uses caching and prefetching for faster training
  • โœ… Scalable Architecture: Easy to extend to more disease types
  • โœ… Real-time Inference: Fast prediction on new images

๐Ÿ“Š Dataset

๐Ÿ“ Dataset Structure

PlantVillage/
โ”œโ”€โ”€ Potato___Early_blight/     # ๐Ÿฆ  Early blight disease images
โ”‚   โ”œโ”€โ”€ image1.jpg
โ”‚   โ”œโ”€โ”€ image2.jpg
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ Potato___Late_blight/      # ๐Ÿ„ Late blight disease images
โ”‚   โ”œโ”€โ”€ image1.jpg
โ”‚   โ”œโ”€โ”€ image2.jpg
โ”‚   โ””โ”€โ”€ ...
โ””โ”€โ”€ Potato___healthy/          # ๐Ÿƒ Healthy potato images
    โ”œโ”€โ”€ image1.jpg
    โ”œโ”€โ”€ image2.jpg
    โ””โ”€โ”€ ...

๐Ÿ“ˆ Dataset Statistics

  • Total Images: 2,152
  • Classes: 3 (Early Blight, Late Blight, Healthy)
  • Image Size: 256ร—256 pixels
  • Color Channels: RGB (3 channels)
  • Data Split: 80% Train, 10% Validation, 10% Test

๐Ÿš€ Getting Started

๐Ÿ“‹ Prerequisites

Python 3.8+
TensorFlow 2.x
Matplotlib
NumPy

โšก Quick Start

  1. Clone the repository

    git clone https://github.com/yourusername/potato-disease-detection.git
    cd potato-disease-detection
  2. Install dependencies

    pip install -r requirements.txt
  3. Run the notebook

    jupyter notebook POTATO_Skin_Diseases_Detection_Using_Deep_Learning.ipynb

๐Ÿ’ป Usage

๐Ÿ”ง Training the Model

The notebook includes the complete pipeline:

  1. Data Loading & Preprocessing

    # Load dataset
    dataset = tf.keras.preprocessing.image_dataset_from_directory(
        "PlantVillage",
        image_size=(256, 256),
        batch_size=32
    )
  2. Data Augmentation

    # Apply data augmentation
    data_augmentation = tf.keras.Sequential([
        tf.keras.layers.RandomFlip("horizontal_and_vertical"),
        tf.keras.layers.RandomRotation(0.2)
    ])
  3. Model Configuration

    IMAGE_SIZE = 256
    BATCH_SIZE = 32
    CHANNELS = 3
    EPOCHS = 50

๐ŸŽฏ Making Predictions

# Load your trained model
model = tf.keras.models.load_model('potato_disease_model.h5')

# Make prediction
prediction = model.predict(new_image)
predicted_class = class_names[np.argmax(prediction)]

๐Ÿ—๏ธ Model Architecture

๐Ÿง  Network Components

  1. Input Layer: 256ร—256ร—3 RGB images
  2. Preprocessing:
    • Image resizing and rescaling (1.0/255)
    • Data augmentation (RandomFlip, RandomRotation)
  3. Feature Extraction: CNN layers for pattern recognition
  4. Classification: Dense layers for final prediction

โš™๏ธ Training Configuration

  • Optimizer: Adam (recommended)
  • Loss Function: Sparse Categorical Crossentropy
  • Metrics: Accuracy
  • Epochs: 50
  • Batch Size: 32

๐Ÿ“ˆ Results

๐Ÿ“Š Performance Metrics

Metric Score
Training Accuracy XX.X%
Validation Accuracy XX.X%
Test Accuracy XX.X%
F1-Score XX.X%

๐ŸŽจ Visualization

The notebook includes:

  • โœ… Sample image visualization
  • โœ… Training/validation loss curves
  • โœ… Confusion matrix
  • โœ… Class-wise accuracy

๐Ÿ”ง Installation

๐Ÿ Environment Setup

# Create virtual environment
python -m venv potato_env

# Activate environment
# Windows:
potato_env\Scripts\activate
# macOS/Linux:
source potato_env/bin/activate

# Install packages
pip install -r requirements.txt

๐Ÿ“ Project Structure

potato-disease-detection/
โ”œโ”€โ”€ ๐Ÿ““ POTATO_Skin_Diseases_Detection_Using_Deep_Learning.ipynb
โ”œโ”€โ”€ ๐Ÿ“„ README.md
โ”œโ”€โ”€ ๐Ÿ“‹ requirements.txt
โ”œโ”€โ”€ ๐Ÿ“ PlantVillage/
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Potato___Early_blight/
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Potato___Late_blight/
โ”‚   โ””โ”€โ”€ ๐Ÿ“ Potato___healthy/
โ”œโ”€โ”€ ๐Ÿ“ models/
โ”‚   โ””โ”€โ”€ ๐Ÿ’พ trained_model.h5
โ””โ”€โ”€ ๐Ÿ“ results/
    โ”œโ”€โ”€ ๐Ÿ“Š training_plots.png
    โ””โ”€โ”€ ๐Ÿ“ˆ confusion_matrix.png

๐Ÿš€ Next Steps

๐Ÿ”ฎ Future Enhancements

  • Model Optimization: Implement transfer learning with pre-trained models
  • Web Application: Create a Flask/Streamlit web interface
  • Mobile App: Develop a mobile application for field use
  • More Diseases: Expand to detect additional potato diseases
  • Real-time Detection: Implement live camera feed processing
  • API Development: Create REST API for integration

๐ŸŽฏ Improvement Ideas

  • Hyperparameter Tuning: Optimize model parameters
  • Cross-validation: Implement k-fold cross-validation
  • Ensemble Methods: Combine multiple models
  • Data Balancing: Handle class imbalance if present

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

๐Ÿ› Bug Reports

If you find a bug, please create an issue with:

  • Description of the problem
  • Steps to reproduce
  • Expected vs actual behavior
  • System information

๐Ÿ’ก Feature Requests

For new features, please provide:

  • Clear description of the feature
  • Use case and benefits
  • Implementation suggestions

๐Ÿ“„ License

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

๐Ÿ™ Acknowledgments

  • PlantVillage Dataset: For providing the potato disease dataset
  • TensorFlow Team: For the amazing deep learning framework
  • Open Source Community: For inspiration and resources

๐Ÿ“ž Contact


โญ Star this repository if you found it helpful!

๐Ÿ€ Happy coding and may your potatoes be healthy!

"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors