CoolFace
Apppublic

Hwang713/EfficientNetV2B1-Leaf-Disease-Classification

sourceHugging Facemitupdated 8mo agoView on Hugging Face
0likes
App README

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

![HF Spaces](https://huggingface.co/spaces/McKlay/Plant-Disease-Detection-EfficientNetB1) ![Gradio](https://www.gradio.app/) ![License: MIT](https://opensource.org/licenses/MIT)

๐ŸŒฟ Plant Disease Detection with EfficientNetB1

Plant-Disease-Detection-EfficientNetB1 is a deep learning-powered app that identifies 15 types of plant diseases from leaf images using a fine-tuned EfficientNetB1 model trained on the PlantVillage dataset.

๐Ÿ“ธ Upload an image, paste from clipboard, or use webcam input Get instant predictions on plant disease type โ€” with confidence score and class label.

๐ŸŒ Demo

Deployed on Hugging Face Spaces: ![Open in Spaces](https://huggingface.co/spaces/McKlay/Plant-Disease-Detection-EfficientNetB1)


๐Ÿง  Model Details

  • โ€”Model: EfficientNetB1 (Keras, Sequential API)
  • โ€”Classes: 15 plant disease types
  • โ€”Input Size: 240ร—240
  • โ€”Preprocessing: Normalization (0โ€“1), real-time data augmentation
  • โ€”Training:
  • โ€”Phase 1: Freeze base, train classification head
  • โ€”Phase 2: Unfreeze all, fine-tune at low learning rate (1e-5)
  • โ€”Validation Accuracy: ~97%

๐Ÿ““ Training Notebook (Kaggle)

The model was trained using TensorFlow and Keras on Kaggle. ๐Ÿ”— fine-tuning-efficientnetb1-plantdiseasedetection Includes:

  • โ€”Stratified 80/20 data split using ImageDataGenerator
  • โ€”Real-time augmentations
  • โ€”Early stopping and checkpointing (best weights only)
  • โ€”Final .h5 weights file exported

Features

  • โ€”Classifies 15 plant diseases
  • โ€”Supports upload, webcam, and clipboard paste
  • โ€”Outputs predicted class name and confidence score
  • โ€”Lightweight & fast inference โ€” powered by Gradio

โš ๏ธ Grad-CAM Note

Grad-CAM is disabled in this version due to using Sequential() with load_weights() To enable Grad-CAM, re-train with Functional API and access the last convolutional layer output.


๐Ÿ“ Folder Structure

bash
12_PlantDiseaseDetection-HF/
โ”œโ”€โ”€ app.py                   # Gradio interface
โ”œโ”€โ”€ inference_utils.py       # Model loading + prediction
โ”œโ”€โ”€ model/
โ”‚   โ”œโ”€โ”€ efficientnetb1_plant_final.weights.h5
โ”‚   โ””โ”€โ”€ class_names.json
โ”œโ”€โ”€ assets/                  # Demo/test images
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ README.md

Example Output

Input ImagePrediction
sample๐Ÿ… Tomato - Early Blight (99%)

Installation

To run locally:

bash
git clone https://github.com/McKlay/plant-disease-type-EfficientNetB1
cd plant-disease-type-EfficientNetB1
pip install -r requirements.txt
python app.py

Requirements

txt
tensorflow
gradio
opencv-python
numpy
Pillow

๐Ÿ‘จโ€๐Ÿ’ป Author

Developed by Clay Mark Sarte Built with TensorFlow + Gradio Deployed to Hugging Face Spaces


โš ๏ธ Disclaimer

This tool is for educational use only. Not intended for use in real-world agricultural decisions or medical treatment.