Skip to content
All projects
AI ยท

Shopfloor Defect Vision

Deployed an on-edge computer-vision inspector that flags surface defects on a moving production line at 60 FPS, replacing slow manual spot-checks.

Python OpenCV ONNX Runtime C++ Docker FastAPI

Problem

Manual QA sampled one in fifty units and still missed hairline defects. Cloud inference was a non-starter โ€” the line could not wait on a round trip, and the factory floor had no reliable uplink.

Architecture

A classical OpenCV pre-processing stage normalizes lighting and isolates the part, then a quantized ONNX model classifies defects entirely on an edge box.

# Lighting varies across the shift; normalize before the model ever sees a frame.
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
norm = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8)).apply(gray)
defect = session.run(None, {"input": preprocess(norm)})[0]
  • Throughput: pipelined capture โ†’ preprocess โ†’ infer holds 60 FPS on a single GPU.
  • Edge-first: runs in a sealed Docker container, no cloud dependency.
  • Explainability: every reject is saved with a heatmap for line-lead review.

Impact

  • Defect escape rate cut from ~3% to under 0.4%.
  • 100% inspection coverage replaced 2% manual sampling.
  • Line operators retrain the model on new defect types without my involvement.