Computer Vision Quality Control System Development
On production lines where manual inspection can't keep up with conveyor speed (600+ items per hour), every missed defect risks reputation and financial loss. We've encountered situations where defects were only caught at final packaging, and rework cost more than the inspection itself. That's why we build systems that detect critical defects at every stage: from incoming raw materials to shipment.
Why Traditional Visual Inspection Is Inefficient?
The human eye tires after just 20 minutes of monotonous inspection — missed defects increase. At conveyor speed of 2–3 items per second, operators miss up to 20–30% of defective units. Automation based on CV eliminates this problem: the system works consistently, doesn't get distracted, doesn't get sick. Additionally, it's measurable — you know exact quality metrics.
How to Build a Quality Control System Based on Computer Vision?
We use a modular architecture: inspection stages (incoming, in-process, final, packaging) are combined into a single pipeline. Each stage has its own detectors: surface defects, geometry measurement, label verification, completeness check. The system decides whether the part passes or goes to quarantine.
Case: 40% defect reduction in automotive component manufacturing. A factory produced stamped parts: after stamping, operators visually inspected each one on the conveyor. Defect rate for cracks and incomplete stamping was 6% with manual inspection — 30% of defects were missed. We deployed a GigE Vision camera with lighting, YOLOv8 model on Jetson AGX Orin. Recall for critical cracks reached 99.2%, false positives 1.8%. Final defect rate dropped to 3.5%, system payback — 5 months. Average annual savings from defect reduction was 1.2 million rubles.
Multi-Point QC System Architecture
Stage 1: Incoming inspection of raw materials/components
↓
Stage 2: In-process inspection (on conveyor)
↓
Stage 3: Final inspection of finished product
↓
Stage 4: Packaging and labeling inspection
from dataclasses import dataclass, field
from enum import Enum
class QCStage(Enum):
INCOMING = 'incoming'
IN_PROCESS = 'in_process'
FINAL = 'final'
PACKAGING = 'packaging'
@dataclass
class QCResult:
product_id: str
stage: QCStage
timestamp: str
verdict: str # PASS / FAIL / QUARANTINE
defects: list[dict] = field(default_factory=list)
measurements: dict = field(default_factory=dict)
label_check: dict = field(default_factory=dict)
images: list[str] = field(default_factory=list)
class ProductQCSystem:
def __init__(self, config: dict):
self.defect_detector = DefectDetector(config['defect_model'])
self.measurement_engine = MeasurementEngine(config['reference_data'])
self.label_verifier = LabelVerifier(config['label_templates'])
self.completeness_checker = CompletenessChecker(config['bom'])
def inspect(self, image: np.ndarray,
product_id: str,
stage: QCStage) -> QCResult:
result = QCResult(product_id=product_id, stage=stage,
timestamp=get_timestamp(), verdict='PASS')
if stage == QCStage.FINAL:
# Full inspection
result.defects = self.defect_detector.inspect(image)['defects']
result.measurements = self.measurement_engine.measure(image)
result.label_check = self.label_verifier.verify(image)
completeness = self.completeness_checker.check(image)
# Determine verdict
has_critical_defect = any(d['severity'] == 'critical'
for d in result.defects)
measurement_ok = result.measurements.get('within_tolerance', True)
label_ok = result.label_check.get('verified', True)
complete = completeness.get('complete', True)
if has_critical_defect or not measurement_ok:
result.verdict = 'FAIL'
elif not label_ok or not complete:
result.verdict = 'QUARANTINE'
return result
Geometric Parameter Measurement
For contour detection we use the Canny algorithm (OpenCV documentation). After camera calibration, we measure actual dimensions.
class MeasurementEngine:
def __init__(self, calibration_data: dict):
# Calibration data: pixels_per_mm at known distance
self.pixels_per_mm = calibration_data['pixels_per_mm']
self.tolerance = calibration_data['tolerance_mm']
def measure(self, image: np.ndarray) -> dict:
# Find part contour
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
_, binary = cv2.threshold(gray, 0, 255,
cv2.THRESH_BINARY + cv2.THRESH_OTSU)
contours, _ = cv2.findContours(binary, cv2.RETR_EXTERNAL,
cv2.CHAIN_APPROX_SIMPLE)
if not contours:
return {'measured': False}
main_contour = max(contours, key=cv2.contourArea)
# Bounding rect for width/height
x, y, w, h = cv2.boundingRect(main_contour)
width_mm = w / self.pixels_per_mm
height_mm = h / self.pixels_per_mm
# Minimum area rectangle (rotated)
rect = cv2.minAreaRect(main_contour)
rect_w, rect_h = rect[1]
angle = rect[2]
return {
'width_mm': round(width_mm, 2),
'height_mm': round(height_mm, 2),
'rotation_angle': round(angle, 1),
'within_tolerance': self._check_tolerance(width_mm, height_mm),
'area_mm2': round(cv2.contourArea(main_contour) /
self.pixels_per_mm**2, 2)
}
Label and Marking Verification
class LabelVerifier:
def __init__(self, templates: dict):
self.ocr = PaddleOCR(use_angle_cls=True, lang='ru')
self.templates = templates # expected patterns for product
def verify(self, image: np.ndarray, product_sku: str) -> dict:
# OCR of label
ocr_result = self.ocr.ocr(image, cls=True)
extracted_text = '\n'.join([line[1][0] for line in ocr_result[0]])
template = self.templates.get(product_sku, {})
checks = {}
# Check required fields
for field_name, pattern in template.items():
match = re.search(pattern, extracted_text)
checks[field_name] = {
'found': bool(match),
'value': match.group() if match else None
}
all_found = all(v['found'] for v in checks.values())
return {
'verified': all_found,
'fields': checks,
'raw_text': extracted_text
}
SPC (Statistical Process Control) Integration
After each measurement, data goes to an SPC module that builds Shewhart control charts (X-bar/R chart) and automatically signals when the process goes out of control limits. Data is transmitted in real time, allowing prompt response to process shifts.
| QC System Metric | Typical Value |
|---|---|
| Defect recall (critical) | 98–99.5% |
| False rejection rate | 1–3% |
| Throughput | 600–3000 pcs/hour |
| Latency per part | 50–150 ms |
Our neural network-based system provides 1.3x higher recall than traditional threshold methods. This is confirmed by tests on 50+ production lines.
More on comparison with threshold methods
Threshold methods (brightness binarization, area filtering) give recall 70–85% at FPR 5–10%. Neural network detectors (YOLOv8) achieve recall 95–99% at FPR 1–3%. The difference is especially noticeable on complex textures and under unstable lighting.What's Included in the Work
We deliver not just code, but a complete solution:
- Technical specification with test protocol.
- Configured training and inference pipeline.
- Adapted equipment (cameras, lighting, controllers).
- API documentation and operator manual.
- Training of your engineers on the system.
- 12-month warranty support and extension option.
Estimated Timelines
| Project Scale | Timeline |
|---|---|
| Single product, single inspection point | 6–8 weeks |
| Multi-product system, multiple stages | 12–18 weeks |
| Enterprise QC with SPC and ERP integration | 18–28 weeks |
Cost is calculated individually — contact us to evaluate your project. Average payback period is 4–8 months.
Typical Mistakes When Implementing CV Inspection
- Poor lighting — even the best model fails if there are glares or shadows on the part. We pay attention to lighting design.
- Ignoring calibration — without precise camera calibration, geometry measurements are meaningless. We calibrate each system using a reference.
- Weak training dataset — 100–200 defect images is insufficient. We collect 1000+ images with augmentation.
- Lack of feedback loop — the model must be retrained on new defect types. We embed an active learning loop.
Why Choose Us
Our experience: 10+ years in industrial computer vision, over 50 implemented QC systems. We use proven tools: OpenCV, YOLOv8, PaddleOCR, PyTorch. We guarantee detection accuracy and metric transparency. Contact us to discuss your task — together we'll find an effective solution. Get a consultation on your task today.







