4

Tea Grading System

A computer-vision system that grades processed tea from images and runs on-device on Jetson edge hardware—an end-to-end MLOps pipeline from data collection through a hybrid CNN model to real-time edge inference and BI analytics.

Tea Grading System: Edge-AI Quality Grading

From image capture to on-device grade, end to end

Project Overview

The Tea Grading System grades processed tea from images using computer vision, and is built to run on the factory floor on Jetson-class edge devices rather than in the cloud. It's a complete MLOps pipeline—six sequential stages, each an independently runnable module with its own tests and walkthrough notebook—that takes raw captures all the way to a real-time grade and business-intelligence signals.

The Pipeline

Data Collection → Data Validation → Feature Pipeline → Training → Edge Inference → Analytics
  • Data collection. Capture live from a camera or ingest a directory; convert .dng / .heic / raw images to a working format and hold out a test split.
  • Data validation. Check every image for correctness and consistency before it can reach training—guarding the pipeline against bad data.
  • Feature pipeline. Turn validated images into structured numerical features to complement the raw pixels.
  • Training. Fit a hybrid model—a CNN backbone over the image plus the engineered numerical features—so visual variability and process noise are backed by structured signals. Exported to ONNX for portable deployment.
  • Edge inference. Run the ONNX model on-device (live camera, single image, or batch), and reject out-of-distribution frames as "NOT TEA" with a confidence threshold.
  • Analytics. Turn raw inference outputs into business-intelligence signals for the operation.

Why Edge

Grading has to happen where the tea is, often with limited connectivity—so inference runs on the device. That constraint drove the choices: a portable ONNX artifact, an out-of-distribution reject path so the model doesn't confidently mis-grade a non-tea frame, and companion work on robustness to low light and sensor noise for real capture conditions.

Technology Stack

  • Vision / ML: PyTorch + torchvision (hybrid CNN), scikit-learn / XGBoost (engineered features), exported to ONNX and served with ONNX Runtime.
  • Edge & imaging: OpenCV for capture and enhancement; runs on Jetson-class hardware.
  • Serving / tooling: FastAPI, a config-driven modular design (~60 Python modules, 11 test suites), Docker, and per-stage notebooks documenting each step.

Skills Demonstrated

  • Applied computer vision—a hybrid image-plus-features model for a real grading task, not a toy classifier.
  • Edge AI / MLOps—the full lifecycle from data collection and validation to training, ONNX export, on-device inference, and analytics, as separable, tested stages.
  • Production robustness—out-of-distribution rejection and low-light / noise handling for messy real-world capture.
  • Pipeline engineering—a config-driven, modular architecture with tests and reproducible notebooks at every stage.

A complete edge-AI pipeline for processed-tea grading—data, to on-device grade, to BI.