Built to order

Tea Leaf Quality Classification using CNN

A tea leaf quality grader that turns a photo of plucked leaves into a quality grade. A ResNet or EfficientNet CNN, pretrained on ImageNet and fine-tuned on public tea-leaf image collections, classifies each leaf photo into quality grades and shows Grad-CAM overlays explaining which leaf regions drove the decision. The included notebook runs the full evaluation — accuracy, F1 and the confusion matrix — on the validation split during your build, with a design target of ~85%+ validation accuracy, so every reported number comes from your own training run.

Tea Leaf Quality Classification using CNN - project prototype demo screenshot

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

  1. Plucked-leaf images are loaded, resized to the classifier's input size and normalized with OpenCV.
  2. Training applies augmentation — rotation, flips, color jitter — so the model tolerates real collection-center photo variation.
  3. A pretrained ResNet or EfficientNet backbone is fine-tuned on the labeled tea-leaf collections, with the classifier head retrained for the grade classes.
  4. At inference, the model outputs a quality grade with a probability score for each uploaded leaf photo.
  5. Grad-CAM overlays visualize the image regions that drove the prediction, giving an inspectable explanation per grade.
  6. 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.

Download abstract (PDF)

Related guides

All guides
Blueprint-style technical illustration of multiple decision trees voting together into one final predictionStudents with basic Python and pandas skills who want a reliable first classifier for ML coursework and tabular data projects.

Random Forests Explained: Why Decision Trees Vote Better Together

Decision trees are readable but overfit; random forests fix this by training hundreds of varied trees on bootstrapped data with random feature subsets, then letting them vote. This guide explains Gini impurity, bagging, out-of-bag validation and the four hyperparameters that matter, with a complete scikit-learn workflow, honest feature-importance practices, and the mistakes students keep making.

Read guide
Illustration of object tracking showing video frames with bounding boxes and persistent ID labels following people and vehicles, comparing motion prediction and appearance matching.B.E./B.Tech Computer Science and Electronics students building video analytics projects — people counting, vehicle tracking, sports analysis — who have detection working and need

Object Tracking: DeepSORT and ByteTrack Explained

Detection finds objects per frame; tracking keeps their identities across frames. This guide explains tracking-by-detection, Kalman motion models, DeepSORT's appearance embeddings vs ByteTrack's low-confidence box recovery, tracking metrics (HOTA, IDF1, ID switches), and the tuning parameters that determine real-world quality.

Read guide
Illustration of image segmentation showing U-Net's U-shaped encoder-decoder with skip connections producing pixel masks, alongside Mask R-CNN detecting instances with masks.B.E./B.Tech Computer Science and AI/ML students moving from image classification or detection to pixel-level understanding — medical imaging, defect detection, autonomous driving

Image Segmentation: U-Net and Mask R-CNN

When projects need pixel-level answers, segmentation delivers. This guide explains semantic vs instance vs panoptic segmentation, U-Net's encoder-decoder with skip connections, Mask R-CNN's parallel mask head, Dice and IoU evaluation, paired augmentation, and how to choose the right architecture for your data and question.

Read guide
Get a quotation