Inspiration
A single unnoticed leaf spot can wipe out a harvest before anyone realizes what's wrong. At the same time, most people, from home gardeners to smallholder farmers, have no easy way to identify what plant they're even looking at, let alone whether it's sick. We wanted to put that expertise in everyone's pocket: point your phone camera at a leaf, and instantly know the species — and if something's wrong with it.
What it does
LEAF ID is a deep-learning powered leaf recognition tool. Upload or snap a photo of a leaf, and it:
- Identifies the plant species out of 84 classes spanning fruit trees, garden vegetables, and ornamental/medicinal plants
- Flags early signs of disease for 11 supported species
- Returns confidence scores so users know how certain the model is, not just a single guess
It's built as a lightweight Streamlit web app, deployed live on Hugging Face Spaces so anyone can try it instantly — no installation required.
How we built it
- Model: We fine-tuned an EfficientNet-B0 architecture (pretrained on ImageNet) using PyTorch, chosen for its strong accuracy-to-compute ratio — important since we wanted something that could eventually run on modest hardware, not just a beefy GPU server.
- Data: We merged three public Kaggle leaf datasets to get broader species coverage and more real-world variation in lighting, angle, and background than any single dataset offered alone.
- Pipeline: Images were preprocessed and augmented (rotation, flips, color jitter) to help the model generalize beyond "clean" lab-style leaf photos to the messier photos real users would actually take.
- Interface: We wrapped the trained model in a Streamlit app for a simple upload-and-predict experience, then deployed it to Hugging Face Spaces for public access.
Challenges we ran into
- Merging inconsistent datasets — different sources labeled species differently and had wildly different image quality/backgrounds, so we spent real time normalizing class names and filtering unusable images.
- Class imbalance — some species had hundreds of images, others barely a dozen, which pushed the model toward over-predicting the well-represented classes until we addressed it with augmentation and careful validation splits.
- Real-world vs. dataset photos — a model trained on clean, well-lit dataset images can struggle with a blurry, shadowy phone photo. Tuning augmentation to bridge that gap was an ongoing balancing act.
- Keeping inference lightweight — making sure the app stayed responsive on CPU-only hosting (no dedicated GPU) meant being deliberate about model size, which is part of why EfficientNet-B0 won out over larger backbones.
What we learned
- How much of a real-world ML project's difficulty lives in data wrangling, not model architecture — three datasets took far more effort to merge cleanly than the model took to fine-tune.
- The practical trade-offs between model accuracy and deployability, especially when targeting an audience (farmers, casual gardeners) who need something fast and accessible, not a research-grade pipeline.
- How to take a trained model all the way to a usable, public-facing product — from
.ptweights to a working Streamlit interface to a live, shareable demo.
What's next for LEAF ID
- Expanding disease coverage beyond the current 11 species
- Adding treatment/care recommendations alongside diagnosis
- Exploring on-device (mobile) inference so the app works offline in the field
- Growing the training dataset with user-contributed, labeled images over time
Log in or sign up for Devpost to join the conversation.