CoolFace
Apppublic

Atayaz/AugmentedGrapevineDiseaseCNN

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
App README

๐Ÿ‡ Grape Disease Classification with CNN and Transfer Learning

This project implements two deep learning models to classify grape leaf diseases:

  1. 1.`grapevine_cnn.py` โ€“ A Convolutional Neural Network (CNN) built from scratch
  2. 2.`grape_transfer_resnet.py` โ€“ A Transfer Learning model using ResNet50

Both models are deployed using Streamlit, allowing for training visualization and image-based prediction.


๐Ÿ“ Dataset

Dataset Used: Augmented Grape Disease Dataset Folder Name: Final Training Data

Each subfolder contains images labeled for a specific grape disease category:

  • โ€”Black Rot
  • โ€”ESCA
  • โ€”Leaf Blight
  • โ€”Healthy

โš™๏ธ How to Run

Install required packages:

bash
pip install -r requirements.txt

Run CNN model:

bash
streamlit run grapevine_cnn.py

Run Transfer Learning model:

bash
streamlit run grape_transfer_resnet.py

๐Ÿง  Model 1: CNN (grapevine_cnn.py)

Key Features:

  • โ€”5 Convolutional layers + 3 MaxPooling layers
  • โ€”Dropout layers for regularization
  • โ€”Precision, Recall, and Accuracy metrics
  • โ€”Uses train_test_split for dataset split
  • โ€”Accuracy and Loss visualizations with Matplotlib
  • โ€”Streamlit interface with image upload for prediction
  • โ€”Model saved as grape_cnn_model.h5

๐Ÿง  Model 2: Transfer Learning (grape_transfer_resnet.py)

Key Features:

  • โ€”Based on pre-trained ResNet50 (ImageNet weights)
  • โ€”Frozen convolutional base layers
  • โ€”Classification head with GlobalAveragePooling2D + Dense layers
  • โ€”Uses ImageDataGenerator with augmentation and validation split
  • โ€”EarlyStopping to prevent overfitting
  • โ€”Accuracy and Loss training curves
  • โ€”Streamlit image upload and prediction interface
  • โ€”Model saved as grape_resnet_model.h5

๐Ÿ–ผ๏ธ Streamlit Interface Includes:

  • โ€”Real-time training graphs: Accuracy & Loss
  • โ€”Upload your own grape leaf image for prediction
  • โ€”Displays predicted disease class with confidence

๐Ÿ’พ Model Output Files

ModelFile NameDescription
CNNgrape_cnn_model.h5Custom CNN from scratch
Transfer Learninggrape_resnet_model.h5ResNet50-based classifier