The problem
Tea quality starts at the pluck: two leaves and a bud commands a premium price, while coarse or damaged leaves drag a whole batch down. In practice, grading plucked leaf is done by experienced buyers at the collection center, eyeballing each basket in seconds — fast but subjective, and impossible to keep consistent across buying days and seasons. Leaf images, on the other hand, carry exactly the visual cues graders use: color, size, uniformity, damage marks. This project builds a CNN classifier that learns those cues: a pretrained ResNet or EfficientNet backbone is fine-tuned on public tea-leaf image collections, so the model starts from strong general vision features and only needs to learn leaf-specific grading distinctions. Grad-CAM overlays make each prediction inspectable, showing which leaf regions pushed the model toward its grade — the visual explanation that turns a black-box classifier into something you can defend in a viva.
How it works
- Plucked-leaf images are loaded, resized to the classifier's input size and normalized with OpenCV.
- Training applies augmentation — rotation, flips, color jitter — so the model tolerates real collection-center photo variation.
- A pretrained ResNet or EfficientNet backbone is fine-tuned on the labeled tea-leaf collections, with the classifier head retrained for the grade classes.
- At inference, the model outputs a quality grade with a probability score for each uploaded leaf photo.
- Grad-CAM overlays visualize the image regions that drove the prediction, giving an inspectable explanation per grade.
- The evaluation notebook computes accuracy, F1 and the confusion matrix on the validation split and runs a misclassified-samples review.
Tech stack:
- Python 3.10, PyTorch (CNN training and inference)
- torchvision (pretrained ResNet and EfficientNet backbones)
- Public tea-leaf image collections (ImageFolder-style datasets)
- OpenCV (preprocessing, Grad-CAM overlays)
- Jupyter notebook (evaluation with accuracy and F1)
- NumPy, scikit-learn (metrics and confusion matrix)
- Flask demo app with leaf-image upload interface
| Parameter | Value |
|---|---|
| Model | ResNet or EfficientNet CNN, ImageNet-pretrained, fine-tuned for leaf grades |
| Training data | Public tea-leaf image collections in ImageFolder layout |
| Design target | Target ~85%+ validation accuracy — actual accuracy, F1 and confusion matrix computed by the notebook during your build |
| Explainability | Grad-CAM overlays on every prediction |
| Augmentation | Rotation, horizontal flip, color jitter for photo variation |
| Evaluation | Accuracy, F1, confusion matrix on the validation split, computed during your build |
| Input | Plucked-leaf photographs |
| Output | Quality grade, probability score, Grad-CAM explanation overlay |
Project features
- ResNet/EfficientNet CNN pretrained on ImageNet, fine-tuned on public tea-leaf image collections
- Quality-grade classification of plucked-leaf photographs
- Grad-CAM overlays explaining which leaf regions drove each grade
- Data augmentation pipeline (rotation, flip, color jitter) for leaf-image robustness
- Evaluation notebook computing accuracy, F1 and the confusion matrix on the validation split
- Class-wise performance breakdown showing which grades confuse with each other
- Demo app for uploading leaf photos and viewing grades with explanations
- Configurable grade classes matching the buyer's labeling scheme
What is included
- Complete source code (dataset loading, augmentation, fine-tuning, inference, demo app)
- Jupyter training and evaluation notebook (buyer-run: train, evaluate, review misclassifications)
- Project report PDF (background, transfer learning design, methodology, evaluation, error analysis)
- PPT presentation for final review
- Viva Q&A preparation document (transfer learning, Grad-CAM, confusion matrix, augmentation)
- Setup guide (environment, dataset download, training, grading your own leaf photos)
Limitations & prerequisites
- The model can only grade leaves like the ones in its training collections: different tea varieties, growing regions or imaging conditions classify worse, and the report documents this coverage gap openly.
- Plucked-leaf appearance overlaps across adjacent grades, so the confusion matrix will show grade-pair confusions — the notebook reviews these misclassified samples explicitly.
- The system grades visual appearance only; liquor taste, aroma and chemical quality need human cupping and lab analysis, which no image classifier can replace.
Frequently Asked Questions
Why transfer learning instead of training from scratch?
Labeled tea-leaf datasets are small. Starting from an ImageNet-pretrained ResNet/EfficientNet gives the model strong general vision features, so fine-tuning only needs to learn leaf-specific distinctions — it converges faster and generalizes better on limited data.
What are the grade classes?
The classes match your labeling scheme — typically premium/standard/low or the plucking-standard categories in your dataset. The dataset loader and classifier head are configurable for any label set.
How does Grad-CAM help here?
It highlights the leaf regions that most influenced the grade — for example, a damaged leaf tip or pale coloration. In the demo app every prediction ships with its overlay, and the overlays double as error-analysis material when the model is wrong.
How is the model evaluated?
The included notebook computes accuracy, F1 and the confusion matrix on the validation split, plus a review of misclassified samples with their Grad-CAM overlays — the report documents the procedure and your own build's numbers.
What accuracy can I expect?
The design target is ~85%+ validation accuracy, but the honest number is the one your training run produces — the notebook computes it, and the report records your actual metrics rather than claiming a target as a result.
Can it replace a tea taster?
No. It grades the visual quality of plucked leaf — size, color, damage — which is what a buying-center grader checks at intake. Taste, aroma and liquor quality need human cupping and lab tests. Suitable for B.E./B.Tech final-year projects in Computer Science, AI/ML and Data Science.
Components & software requirements
- Python 3.10, PyTorch (CNN training and inference)
- torchvision (pretrained ResNet and EfficientNet backbones)
- Public tea-leaf image collections (ImageFolder-style datasets)
- OpenCV (preprocessing, Grad-CAM overlays)
- Jupyter notebook (evaluation with accuracy and F1)
- NumPy, scikit-learn (metrics and confusion matrix)
- Flask demo app with leaf-image upload interface
Delivery information
Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.
Support terms
Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.