Muhammad Rafi Arsya
All Projects
Completed · 2026
Crop Disease Detector
An AI model that identifies plant diseases from a single leaf photo — trained on 87,000+ images using MobileNetV2 Transfer Learning, deployed live on Hugging Face Spaces.
Machine Learning Transfer Learning TensorFlow Agriculture Gradio Hugging Face
Status
Live on HF Spaces
Year
2026
Type
ML / Computer Vision
Model
MobileNetV2
Accuracy
~97%
Classes
38 disease classes
Overview

Crop Disease Detector is a deep learning computer vision system built to help farmers and agricultural workers identify plant diseases instantly — just by photographing a leaf. The model can classify 38 distinct disease conditions across 14 common crop types, from apple scab to tomato mosaic virus.

The model is trained on the PlantVillage dataset containing over 87,000 leaf images using MobileNetV2 Transfer Learning — a lightweight but powerful CNN architecture pre-trained on ImageNet. Fine-tuning was performed with data augmentation (random flips, rotation, zoom) to improve generalization on real-world images.

The final model achieves ~97% validation accuracy and is deployed as an interactive web app via Gradio on Hugging Face Spaces — making it freely accessible to anyone with a browser, no setup required.

Key Features
Real-Time Inference
Upload any leaf photo and get an instant diagnosis with confidence score — no queue, no waiting. Deployed on Hugging Face Spaces for zero-friction access.
MobileNetV2 Transfer Learning
Built on a pre-trained ImageNet backbone, fine-tuned on 87,000+ PlantVillage leaf images. Achieves high accuracy with a model small enough to run efficiently on CPU.
38-Class Disease Classification
Covers 38 disease/healthy categories across 14 crops — apple, blueberry, cherry, corn, grape, orange, peach, pepper, potato, raspberry, soybean, squash, strawberry, and tomato.
Data Augmentation Pipeline
Training includes random horizontal/vertical flips, rotation, zoom, and contrast adjustments to make the model robust to real-world photo conditions like angle, lighting, and background.
Gradio Interactive UI
The app is wrapped in a clean Gradio interface — drag and drop a leaf image, hit submit, and see the predicted disease class with a top-5 confidence breakdown in seconds.
How It Works

The system follows a standard deep learning pipeline — data preparation, model training with transfer learning, evaluation, and deployment.

1
Step 1
Dataset Preparation
PlantVillage dataset loaded and split 80/20 into train and validation sets. Image size normalized to 224×224 px to match MobileNetV2 input. Labels one-hot encoded for 38 classes.
2
Step 2
Transfer Learning with MobileNetV2
MobileNetV2 pre-trained on ImageNet loaded as the base model with frozen layers. A custom classification head added on top: GlobalAveragePooling → Dense(256, ReLU) → Dropout(0.3) → Dense(38, Softmax).
3
Step 3
Training & Fine-Tuning
Model trained using Adam optimizer with learning rate scheduling. After initial training, top layers unfrozen for fine-tuning with a lower learning rate to adapt ImageNet features to leaf morphology.
4
Step 4
Evaluation
Model evaluated on validation set achieving ~97% accuracy. Confusion matrix generated to identify most common misclassifications between visually similar disease classes.
5
Step 5
Deployment on Hugging Face
Model exported as .h5 and wrapped in a Gradio app. Deployed to Hugging Face Spaces for free public access — no installation needed, runs directly in the browser.
Supported Disease Classes (Sample)

The model is trained to identify 38 classes including both diseased and healthy conditions:

Apple — Scab
Apple — Black Rot
Apple — Cedar Rust
Apple — Healthy
Corn — Gray Leaf Spot
Corn — Common Rust
Grape — Black Rot
Grape — Leaf Blight
Potato — Early Blight
Potato — Late Blight
Tomato — Bacterial Spot
Tomato — Mosaic Virus
Tomato — Late Blight
Tomato — Healthy
Pepper — Bacterial Spot
+ 22 more classes
Build Progress
Completed
Data Preparation100%
Model Training100%
Fine-Tuning100%
HF Deployment100%
Tech Stack
Python TensorFlow Keras MobileNetV2 NumPy Gradio Hugging Face Matplotlib
By the Numbers
~97%
Val Accuracy
38
Disease Classes
87K+
Training Images
14
Crop Types
How to Use
① Upload
Go to the Hugging Face Space and drag & drop a photo of a plant leaf — or use the sample images provided.
② Predict
Click Submit. The model runs inference in seconds and returns the predicted disease class with a confidence score.
③ Interpret
Review the top-5 predicted classes and their confidence percentages to understand the model's certainty and possible alternatives.
Try it live — no setup needed.
The model is deployed on Hugging Face Spaces. Open it in your browser, upload a leaf photo, and get an instant AI diagnosis for free.
Open on Hugging Face