
Snap a leaf, get the disease, the fix, and care tips that match today’s weather. A Python + TensorFlow final year project with 98.55% test accuracy and the trained model included.
Python | TensorFlow | Keras | MobileNetV2 | Flask | Groq API (Llama 3.3 70B) | OpenWeatherMap API | HTML | CSS | JavaScript | Pillow | NumPy
LeafLens is a plant disease detection system built in Python. You upload a photo of a leaf. A MobileNetV2 model trained with TensorFlow decides which of 9 plant conditions it's looking at. The app then pulls treatment steps from a care database, checks the current weather in your city through OpenWeatherMap, and asks Groq's Llama 3.3 70B model to write care advice that accounts for both. It covers three houseplants you'll find on almost every Indian balcony: Money Plant (Pothos), Snake Plant and Spider Plant. On the held-out test split, the model hits 98.55% accuracy.
Think of it as a plant doctor that lives in a browser tab.
Say your money plant's leaves are going yellow and mushy at the edges. You take a photo, drop it on the Detect page, type "Pune" in the city box, and hit Analyze. A few seconds later you get the diagnosis (maybe Bacterial Wilt Disease), a confidence bar showing how sure the model is, the symptoms to cross-check, treatment and prevention steps, and a short AI-written note that knows it's humid and hot outside right now and adjusts the watering advice to match.
That's the whole loop. Upload, predict, explain. There's no login and no database server to configure. The care data sits in a single JSON file.
POST /api/predict, handled in routes/predict.py.services/model_service.py resizes the image to 224 x 224, scales pixels to the [-1, 1] range MobileNetV2 expects, and runs inference with leaflens_model.keras.class_names.json.services/care_engine.py looks up symptoms, causes, treatment, prevention and care basics (water, light, humidity, soil, temperature) in data/plant_care_db.json.services/climate_service.py fetches live temperature, humidity and conditions from OpenWeatherMap.static/js/app.js renders it as a confidence bar, tabbed care sections and an AI advice card.GET /api/health endpoint returns a simple status JSON, so you can show during the demo that the backend is alive..keras, .h5 and a quantised .tflite), so a mobile version is possible later.| Plant | Conditions | Images in Dataset |
|---|---|---|
| Money Plant (Pothos) | Healthy, Bacterial Wilt Disease, Manganese Toxicity | 1,305 |
| Snake Plant | Healthy, Anthracnose, Leaf Withering | 1,280 |
| Spider Plant | Healthy, Fungal Leaf Spot, Leaf Tip Necrosis | 1,350 |
That's 3,935 augmented images in total, built from roughly 80 to 93 original photos per class.
| Metric | Score |
|---|---|
| Test Accuracy | 98.55% |
| Mean AUC (One-vs-Rest) | 0.999+ |
| Healthy vs Diseased Accuracy | 99.5%+ |
| Precision / Recall / F1 (macro avg) | 0.99 / 0.99 / 0.99 |
The architecture is simple enough to explain on a whiteboard. It's a frozen MobileNetV2 backbone, then GlobalAveragePooling2D, a Dense layer of 128 with ReLU, Dropout of 0.3, and a final 9-way Softmax. Training used Adam, sparse categorical crossentropy and early stopping with patience 5, and ran for about 20 epochs.
The training notebook, leaflens_training.ipynb, includes more than 15 visualisations: confusion matrices (raw and normalised), ROC curves, precision-recall curves, per-class F1 charts, confidence distributions, a softmax heatmap and a gallery of the model's mistakes. Paste those straight into your report and half of your results chapter is done.
requestsIf you're browsing for more Flask projects with full source code, this one has one of the cleaner folder structures. Routes, services, templates and models each live in their own folder.
.tflite model.Here's the thing. LeafLens knows nine classes, and only nine. Show it a rose leaf or a tulsi leaf and it won't say "I don't know." It'll pick whichever of the nine looks closest, sometimes with high confidence. So demo it with the three supported plants. And if your examiner tries something random, explain that it's a closed-set classifier and that adding plants means adding data and retraining. That's a good viva answer, by the way, not a weakness.
The 98.55% also comes from a test split drawn from the same augmented dataset. Real photos taken in bad tube-light at 9 PM will score lower. Say that out loud in your presentation, because examiners trust students who know where their model breaks.
But the part that looks scary is actually easy. You don't have to train anything. The trained model ships in the models/ folder, so pip install, python app.py, and you're predicting. Most people get it running in about 15 minutes, and that's mostly TensorFlow downloading.
If you're a student who needs a working project for your college submission, final-year project, semester project, internship, or academic demonstration, this is for you. Whether you're studying BCA, B.Tech, MCA, M.Tech, Computer Science, IT, AI, Data Science, or another related field, you can choose a project that fits your requirements. If you need the source code, project report, documentation, or help setting up and running the project, CodeAj gives you the resources and support to get started faster.
LeafLens fits best if your guide wants something with real machine learning in it, not just a CRUD app with a "predict" button that returns random numbers. It works well as an AI final year project, a machine learning final year project, or a Python final year project, depending on how your syllabus words it.
You get the full codebase, the training notebook, the trained model files, the care database and the dataset folders. You also get a project report that already explains the architecture, dataset and results in college format, so you aren't writing 60 pages from a blank Word file two nights before submission. If something breaks on your laptop, our team will sit with you over a call and get it running. We've built and shipped a lot of AI and ML final year projects like this one, and we know exactly which step trips students up. If plant leaves aren't your thing, there's more image-based work in our computer vision projects section worth a look.
Add any of these professional upgrades to save time and impress your evaluators.
Personal session with an expert developer
We'll install and configure the project on your PC via remote session (Google Meet, Zoom, or AnyDesk).
1-hour live session to explain logic, flow, database design, and key features.
Want to know exactly how the setup works? Review our detailed step-by-step process before scheduling your session.
Fully customized to match your college format, guidelines, and submission standards.
Need feature changes, UI updates, or new features added?
Charges vary based on complexity.
We'll review your request and provide a clear quote before starting work.
Reviews