This project uses a Convolutional Neural Network (CNN) to classify potato leaf images into three categories:
- Potato___Early_blight
- Potato___Late_blight
- Potato___healthy
The model is trained using TensorFlow and Keras on the PlantVillage dataset.
- Total Images: 2152
- Classes: Early Blight, Late Blight, Healthy
- Image Size: 256x256
- Splits:
- Training: 80%
- Validation: 10%
- Testing: 10%
Sequential([
Resizing(256, 256),
Rescaling(1./255),
Conv2D(32, (3,3), activation='relu'),
MaxPooling2D(),
Conv2D(64, (3,3), activation='relu'),
MaxPooling2D(),
Flatten(),
Dense(128, activation='relu'),
Dense(3) # 3 output classes
])- Optimizer: Adam
- Loss: Sparse Categorical Crossentropy
- Metric: Accuracy
- EarlyStopping: Enabled to prevent overfitting
- Accuracy and loss are tracked for both training and validation sets.
- A sample batch of predictions (9 images) is visualized along with their predicted and actual labels.
- Clone the repository and install dependencies:
pip install -r requirements.txt
- Ensure the dataset folder path is:
../PlantVillagePotatoDataset/ - Run the Jupyter notebook:
jupyter notebook model.ipynb
Displays predictions with confidence scores and actual labels for 9 sample test images.
- Ignore model files, datasets, cache, logs, and system files to keep the repository clean.
A user-friendly web application is provided for potato disease classification using Streamlit.
- Upload a potato leaf image (JPG, JPEG, PNG)
- The app displays the uploaded image and predicts its condition: Healthy, Early Blight, or Late Blight
- Shows the prediction confidence score
- Clean, centered UI with clear result display
- Make sure you have all dependencies installed (see requirements.txt)
- Ensure the trained model file is available at:
../models/potato_disease_classification_v1.0.h5 - From the
server/directory, run:streamlit run server.py
- Open the provided local URL in your browser to use the app.
- The main page allows you to upload a potato leaf image.
- The left panel shows the input image.
- The right panel displays the predicted disease class and confidence.
- Supported classes: Early Blight, Late Blight, Healthy
- XAI Integration:
- Plan to integrate Explainable AI (XAI) techniques (such as Grad-CAM ) to provide visual explanations for model predictions, helping users and researchers understand which parts of the leaf image influenced the classification decision.