๐ฌ An AI-powered computer vision system for detecting and classifying potato skin diseases using deep learning techniques.
- ๐ฏ Project Overview
- ๐ Features
- ๐ Dataset
- ๐ Getting Started
- ๐ป Usage
- ๐๏ธ Model Architecture
- ๐ Results
- ๐ง Installation
- ๐ Project Structure
- ๐ค Contributing
- ๐ License
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
Click to see sample predictions
Input: potato_image.jpg
Output: "Early Blight Disease" (Confidence: 94.2%)
- โ 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
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
โโโ ...
- 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
Python 3.8+
TensorFlow 2.x
Matplotlib
NumPy-
Clone the repository
git clone https://github.com/yourusername/potato-disease-detection.git cd potato-disease-detection -
Install dependencies
pip install -r requirements.txt
-
Run the notebook
jupyter notebook POTATO_Skin_Diseases_Detection_Using_Deep_Learning.ipynb
The notebook includes the complete pipeline:
-
Data Loading & Preprocessing
# Load dataset dataset = tf.keras.preprocessing.image_dataset_from_directory( "PlantVillage", image_size=(256, 256), batch_size=32 )
-
Data Augmentation
# Apply data augmentation data_augmentation = tf.keras.Sequential([ tf.keras.layers.RandomFlip("horizontal_and_vertical"), tf.keras.layers.RandomRotation(0.2) ])
-
Model Configuration
IMAGE_SIZE = 256 BATCH_SIZE = 32 CHANNELS = 3 EPOCHS = 50
# 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)]- Input Layer: 256ร256ร3 RGB images
- Preprocessing:
- Image resizing and rescaling (1.0/255)
- Data augmentation (RandomFlip, RandomRotation)
- Feature Extraction: CNN layers for pattern recognition
- Classification: Dense layers for final prediction
- Optimizer: Adam (recommended)
- Loss Function: Sparse Categorical Crossentropy
- Metrics: Accuracy
- Epochs: 50
- Batch Size: 32
| Metric | Score |
|---|---|
| Training Accuracy | XX.X% |
| Validation Accuracy | XX.X% |
| Test Accuracy | XX.X% |
| F1-Score | XX.X% |
The notebook includes:
- โ Sample image visualization
- โ Training/validation loss curves
- โ Confusion matrix
- โ Class-wise accuracy
# 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.txtpotato-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
- 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
- Hyperparameter Tuning: Optimize model parameters
- Cross-validation: Implement k-fold cross-validation
- Ensemble Methods: Combine multiple models
- Data Balancing: Handle class imbalance if present
We welcome contributions! Please see our Contributing Guidelines for details.
If you find a bug, please create an issue with:
- Description of the problem
- Steps to reproduce
- Expected vs actual behavior
- System information
For new features, please provide:
- Clear description of the feature
- Use case and benefits
- Implementation suggestions
This project is licensed under the MIT License - see the LICENSE file for details.
- PlantVillage Dataset: For providing the potato disease dataset
- TensorFlow Team: For the amazing deep learning framework
- Open Source Community: For inspiration and resources
- Author: Lucky Sharma
- Email: panditluckysharma42646@gmail.com
- LinkedIn: https://www.linkedin.com/in/lucky-sharma918894599977
- GitHub: https://github.com/itsluckysharma01
โญ Star this repository if you found it helpful!
๐ Happy coding and may your potatoes be healthy!