Computer vision in manufacturing isn’t a moonshot project — it’s a proven technology generating measurable ROI for companies that implement it correctly. The challenge isn’t building a model; it’s integrating it into production lines that run 24/7, can’t tolerate false positives, and need sub-100ms inference on edge hardware.
The most common failure: teams build a model that’s 99% accurate in the lab and 60% accurate on the factory floor — because the training data was collected under different lighting, angles, and environmental conditions than production. This guide prevents that.
High-Value Use Cases
| Use Case | Savings Potential | Difficulty | Typical ROI Timeline |
|---|
| Visual defect detection | 30-60% reduction in manual inspection | Medium | 6-12 months |
| Dimensional measurement | Replaces contact gauges, 10x faster | Medium | 3-6 months |
| Assembly verification | 90%+ reduction in missing-component defects | Low-Medium | 3-6 months |
| Safety monitoring | PPE compliance, zone violations | Low | 1-3 months |
| Predictive maintenance | Detect equipment wear before failure | High | 12-18 months |
| Inventory counting | Automated bin-level tracking | Low | 3-6 months |
| Weld quality inspection | X-ray/thermal defect detection | High | 12-18 months |
| Label/barcode verification | Ensure correct labeling before shipment | Low | 1-3 months |
Where to Start
Start with the easiest, highest-ROI use case — typically assembly verification or safety monitoring — to prove the technology before tackling complex defect detection.
Architecture: Edge vs Cloud
Edge Deployment (Recommended for Manufacturing)
Camera → Edge Device → Inference → PLC/Alert
(NVIDIA Jetson, Intel NUC)
↓
Local Dashboard + Cloud Sync (non-real-time)
Why edge: Latency <50ms, works without internet, data stays on-premises.
Cloud vs Edge Decision
| Factor | Edge | Cloud |
|---|
| Latency | <50ms | 200-2000ms |
| Internet dependency | None | Required |
| Data privacy | Data stays on-prem | Data uploaded |
| Cost model | CapEx (hardware) | OpEx (per-inference) |
| Model updates | Manual or OTA | Automatic |
| Compute limits | Hardware-bound | Elastic |
| Best for | Real-time reject/pass | Batch analysis, model training |
Hardware Selection
| Device | Performance | Power | Cost | Best For |
|---|
| NVIDIA Jetson Orin Nano | 40 TOPS | 15W | $500 | Single-line inspection |
| NVIDIA Jetson AGX Orin | 275 TOPS | 60W | $2,000 | Multi-camera, complex models |
| Intel NUC + OpenVINO | 10-20 TOPS | 25W | $800 | Lightweight classification |
| Raspberry Pi 5 + Hailo | 13 TOPS | 8W | $150 | Basic counting, PPE detection |
| Industrial PC + GPU | 100+ TOPS | 200W | $3,000+ | Multi-line, high-throughput |
Model Selection
| Task | Model | Speed (Jetson) | Accuracy | When to Use |
|---|
| Object detection | YOLOv8n | 3ms | Good | High-speed lines, simple defects |
| Object detection | YOLOv8m | 12ms | Better | Standard inspection |
| Classification | EfficientNet-B0 | 2ms | Good | Binary pass/fail |
| Segmentation | YOLOv8-seg | 15ms | Good | Precise defect boundary detection |
| Anomaly detection | PatchCore | 50ms | Excellent for novel defects | When you have few defect examples |
Model Selection Decision
Do you have labeled defect images?
├── Yes (500+ per class) → YOLOv8 (detection or segmentation)
├── Yes (few, <100) → Transfer learning or few-shot models
└── No (only "good" images) → Anomaly detection (PatchCore, PADIM)
Is defect location important?
├── Yes → Object detection (bounding box) or segmentation (pixel mask)
└── No → Classification (pass/fail)
Defect Detection with YOLOv8
from ultralytics import YOLO
# Train on custom defect dataset
model = YOLO("yolov8m.pt")
results = model.train(
data="defects.yaml",
epochs=100,
imgsz=640,
batch=16,
device=0
)
# Inference on production line
model = YOLO("best.pt")
results = model.predict(
source="rtsp://camera-line-3:554/stream",
stream=True,
conf=0.7
)
for result in results:
for box in result.boxes:
cls = result.names[int(box.cls)]
conf = float(box.conf)
if cls in ["scratch", "dent", "crack"] and conf > 0.8:
trigger_reject(line=3, defect_type=cls, confidence=conf)
Data Collection Strategy
Camera Setup
camera_specifications:
resolution: 2448x2048 # 5MP minimum for surface defects
frame_rate: 30fps
interface: GigE Vision or USB3
lens: "Telecentric for dimensional, macro for surface defects"
lighting:
type: "Diffuse dome or ring light"
note: "Lighting is 80% of vision success. Bad lighting = bad model."
mounting:
distance: "300-500mm (adjust for FOV requirements)"
vibration_isolation: "Required — factory vibration kills focus"
enclosure: "IP65 minimum for dust/coolant protection"
Lighting Guide
| Lighting Type | Best For | Example |
|---|
| Diffuse dome | Surface defects (scratches, dents) | Metal parts, plastic surfaces |
| Ring light | Flat surface inspection | PCB inspection, label verification |
| Backlighting | Silhouette/dimensional measurement | Gaskets, seals, o-rings |
| Structured light | 3D surface profiling | Solder joints, weld bead shape |
| Dark field | Surface texture, subtle scratches | Machined surfaces, glass |
Training Data Requirements
| Defect Complexity | Minimum Images | Ideal Images | Collection Method |
|---|
| Binary (pass/fail) | 200 per class | 1,000+ per class | Production camera, 2-3 days |
| Multi-class defects | 500 per class | 2,000+ per class | Production camera, 1-2 weeks |
| Anomaly detection | 1,000 good images | 5,000+ good images | Production camera, 1 week |
Data Augmentation
import albumentations as A
transform = A.Compose([
A.RandomBrightnessContrast(brightness_limit=0.3, contrast_limit=0.3, p=0.5),
A.GaussNoise(var_limit=(10, 50), p=0.3),
A.Rotate(limit=15, p=0.5),
A.HorizontalFlip(p=0.5),
A.RandomScale(scale_limit=0.1, p=0.3),
A.CLAHE(clip_limit=4.0, p=0.3), # Enhance contrast for subtle defects
], bbox_params=A.BboxParams(format='yolo'))
Integration with Factory Systems
PLC Communication
from pymodbus.client import ModbusTcpClient
plc = ModbusTcpClient('192.168.1.100')
def trigger_reject(line: int, defect_type: str, confidence: float):
"""Send reject signal to PLC via Modbus."""
plc.connect()
plc.write_register(100, 1) # Reject signal ON
plc.write_register(101, DEFECT_CODES[defect_type])
plc.close()
log_defect(line, defect_type, confidence)
MES (Manufacturing Execution System) Integration
import requests
def report_to_mes(inspection_result: dict):
"""Report inspection result to MES."""
requests.post("http://mes.internal/api/inspection", json={
"station_id": "INSP-LINE-3",
"part_serial": inspection_result["serial"],
"result": "PASS" if inspection_result["pass"] else "FAIL",
"defects": inspection_result.get("defects", []),
"timestamp": inspection_result["timestamp"],
"model_version": "v2.3",
"confidence": inspection_result["confidence"]
})
ROI Analysis
Example: Surface Defect Inspection
Current State (Manual Inspection):
- 3 inspectors × $55K/year = $165K/year
- Inspection rate: 1 part / 15 seconds
- Defect escape rate: 2-5%
- Customer complaint cost: ~$50K/year
With CV System:
- Setup cost: $80K (cameras, edge hardware, integration)
- Annual maintenance: $15K
- Inspection rate: 1 part / 0.5 seconds (30x faster)
- Defect escape rate: 0.1-0.5%
Year 1 ROI:
- Labor savings: $110K (keep 1 inspector for oversight)
- Quality improvement: $40K (reduced complaints/returns)
- Throughput increase: ~$30K (faster line speed)
- Total benefit: $180K
- Net Year 1 ROI: $180K - $95K = $85K (89% ROI)
Common Failure Modes
| Issue | Cause | Fix | Severity |
|---|
| High false positive rate | Training data doesn’t match production lighting | Collect data under production conditions | Critical |
| Model works in lab, fails on line | Domain shift (different angles, backgrounds) | Train on production images only | Critical |
| Inconsistent results | Vibration, focus drift | Mechanical stabilization, auto-focus | High |
| Slow degradation | Lens contamination, lighting aging | Scheduled cleaning, reference image checks | Medium |
| Edge cases | Rare defect types not in training data | Active learning pipeline for novel defects | Medium |
| Environment changes | Temperature/humidity affect lighting | Environmental monitoring + auto-calibration | Medium |
| Model drift | Product changes over time | Periodic retraining on recent data | Low-Medium |
Checklist
:::note[Source]
This guide is derived from operational intelligence at Garnet Grid Consulting. For manufacturing AI consulting, visit garnetgrid.com.
:::