You are tasked with designing and deploying a deep learning-based computer vision system for real-time quality control on a high-speed manufacturing assembly line. The system must classify each product as ‘Pass’ or ‘Fail’ due to surface defects (scratches, cracks, misalignments).
Describe the complete end-to-end system design, from data acquisition and model selection to deployment and post-deployment maintenance.
Crucially, how would you address the challenges of real-time inference speed and the severe class imbalance due to the fact that defects are rare?

The Problem: 600 units per minute stream past a camera. Design the system that fills the question mark: real-time Pass/Fail within 100ms per unit, with defects occurring at only ~0.1%.
Answer
The solution is an Edge-AI Computer Vision Pipeline. It starts with a controlled imaging setup to capture consistent, high-quality images. The core is a lightweight CNN (e.g., MobileNetV2) fine-tuned via transfer learning, trained with a specialized loss (Focal Loss) to handle the rare-defect imbalance. Deployment runs on a local Edge GPU to guarantee low-latency inference, and a continuous MLOps loop monitors performance and retrains the model against new or subtle defects (concept drift).
(1) Data & Setup: Controlled environment (lighting/staging) plus high-resolution cameras; transfer learning reduces the need for large-scale defect collection.
(2) Imbalance Handling: Focal Loss (or weighted loss) combined with heavy data augmentation and oversampling of the rare ‘Fail’ class.
(3) Model Architecture: A lightweight CNN (MobileNetV2, EfficientNet-B0) chosen for speed over a large, deep network.
(4) Real-Time Deployment: Edge deployment on an industrial GPU (e.g., NVIDIA Jetson) with ONNX/TensorRT optimization and INT8 quantization to stay inside a sub-100ms budget.
(5) Post-Deployment MLOps: Log every classification (especially false negatives) and trigger periodic retraining to combat model drift.

Figure 1: The end-to-end pipeline. Solid arrows are the real-time inference path (capture → preprocess → edge CNN → actuator); the dashed loop is the offline MLOps path: logged hard examples and low-confidence frames flow back into retraining.
Clarify Before Designing:
(1) Throughput: line speed in units per minute, and the per-unit latency budget?
(2) Defect Ontology: a closed set of defect types, or can new types appear in production?
(3) Deployment Constraints: is cloud inference acceptable, or must everything run on-prem at the line?
(4) Data Availability: how many labeled ‘Fail’ examples exist today, and what is the true defect rate?
(5) Cost Asymmetry: the business cost of a false accept (defect escapes) versus a false reject (good unit scrapped)?
Leave a Reply