
Upload one photo of a crop, get the name back in under a second β plus a heat map showing exactly which pixels the CNN looked at. Complete Python final year project with training notebook, Flask app and source code.
Python 3.10 | TensorFlow 2.16 | Keras | MobileNetV2 | Grad-CAM | Flask 3 | Jupyter Notebook | scikit-learn | Pillow | Gunicorn | Nginx
Identifying a crop from a photograph sounds trivial until you're the one staring at an unlabelled field image. Extension officers, agri-tech data collectors and farm advisors do this every day, and it needs trained human eyes that aren't always standing where the camera is. CropVision AI automates that judgement using a Convolutional Neural Network.
The model is trained on the Agricultural Crops Image Dataset β roughly 800 photographs across 30 classes covering almond, banana, cardamom, chilli, clove, coconut, coffee, cotton, cucumber, fox nut, gram, jowar, jute, lemon, maize, mustard, olive and more. That works out to about 25 images per class, which is nowhere near enough to train a CNN from random weights. We tried. It stalled under 45% accuracy and refused to move.
So the project uses transfer learning instead: a MobileNetV2 convolutional backbone pretrained on ImageNet, extended with a custom conv and dense head, fine-tuned in two phases. Fully convolutional throughout, no LSTMs or attention blocks bolted on to look impressive. The final model hits roughly 90% top-1 accuracy and over 97% top-3 on held-out test images, against about 38% for the same-architecture-from-scratch baseline that's included in the notebook for comparison.
Predictions are explained with Grad-CAM, and the whole thing is served through a Flask web app with a JSON REST endpoint sitting alongside it.
Two pieces, and they're separate on purpose.
The first is crop_classification_training.ipynb, a Jupyter notebook that takes the raw dataset folder, cleans it, trains the model, evaluates it, and writes everything into an artifacts/ directory β the .keras model file, a labels.json, a metrics.json with per-class recall, plus training curves and a confusion matrix as PNGs.
The second is cropvision/, a Flask 3 application that loads those artifacts and turns them into a working website. You drag a photo onto the upload box, and you get back a ranked top-3 with confidence percentages, a Grad-CAM heat map overlaid on your image, and a toggle to flip between the original and the heat map.
Here's the part examiners actually like: the confidence threshold. If the model isn't sure, it doesn't fake it. Below 0.45 confidence the page says "closest match" instead of asserting an identification, because a closed-set classifier shown a random photo of a dog will still confidently tell you it's cardamom. Being honest about uncertainty is a design decision you can defend in a viva, and most student projects have nothing like it.
The source dataset stores the same photograph under multiple file extensions. If you don't catch that, identical images end up in both your training and test sets, and your accuracy number becomes fiction. The notebook runs exact MD5 hashing and perceptual dHash before splitting, drops the duplicates, then does a stratified 70/15/15 split so every one of the 30 classes appears in all three partitions. Class imbalance is handled with computed class weights and augmentation β flip, rotation, zoom, translation, contrast, brightness β applied on-GPU during training.
If your accuracy ever comes out suspiciously close to 100%, duplicate removal got switched off. That's the first thing to check.
top_k query parameter/model built automatically from metrics.json β test accuracy, dataset composition, per-class recall, training charts/api/predict accepting either a multipart file upload or a base64 string/health endpoint that returns 503 if the model didn't loaddeploy/Agricultural extension and advisory work. A field officer photographs an unknown crop and gets an identification plus the visual evidence behind it, without waiting on a specialist to be available.
Farmer-facing mobile apps. The JSON API can back an Android or Flutter client directly. Crop identification becomes the entry point to variety-specific advice on irrigation, fertiliser scheduling and pest control.
Agri-marketplace verification. Produce listings with photos get checked automatically against the declared crop type, so mismatches get flagged before the listing goes live.
Dataset labelling at scale. Big unlabelled image collections get pre-sorted by predicted class, and only the low-confidence cases get routed to a human annotator. Saves an enormous amount of manual work.
Agronomy teaching. Horticulture students use it as a self-test tool, and the Grad-CAM overlay shows which morphological features separate one crop from another.
Drone and ground survey pipelines. Survey imagery gets crop-type tags automatically, feeding acreage estimation and crop-pattern analysis downstream.
And it's the obvious first stage for a crop disease detection system, since disease models are almost always crop-specific. Same training pipeline, different dataset. If your guide asks "what's the extension of this work," that's your answer.
The hard part is Grad-CAM. Not running it β the code works out of the box and locates the backbone and final conv layer by inspection, so it survives a backbone swap. The hard part is explaining it in your viva when someone asks how gradients flowing back to a convolutional feature map turn into a heat map. Read that section of the notebook properly. Don't skip it the night before.
The easy part surprises people. Training the whole model takes 15 to 25 minutes on a normal laptop CPU, 3 to 5 minutes if you have a GPU. There's also smoke_test.py, which renders every single template against a stubbed model β so you can confirm the entire web app works without installing TensorFlow at all. Handy when your laptop is already struggling.
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.
You get the complete source code β the training notebook, every Flask route, the templates, the deploy configs, all of it β along with a project report you can actually submit and setup support if something breaks on your machine. TensorFlow installs are the usual culprit, especially on Python 3.12 where 2.16 doesn't play nice on every platform. If you're browsing more options in this space, our machine learning projects with source code collection has similar CNN and deep learning builds, the AI final year projects hub covers everything from chatbots to detection systems, and there's a dedicated Flask projects section if you specifically want Python web deployment on your resume. Pick the one that matches your syllabus, not the one with the flashiest screenshot.
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