Computer Vision for Quality Control is an imaging and analysis system that links a product image to a formal decision: pass, send for manual review, stop the operation, or log a defect. The model is only one part of the inspection station, alongside optics, lighting, mechanics, timing, rules, and integration with the production flow.
A project starts not with choosing a neural network, but with a defect sheet and the inspection point. You need to define exactly what counts as a defect, whether it is visible to a camera, when intervention is still possible, how much time you have to decide, and how the consequences of missing a defect differ from a false rejection.
Short answer: choose one SKU/operation and one observable defect class. Stabilize the part position, lighting, and camera; collect images across shifts and batches; align labeling with the quality team. Start in shadow mode, then move to advisory mode; enable automatic reject only after line acceptance and fail-safe validation.
Key points in one minute
- Not every defect is visible in the chosen spectrum and viewing angle.
- Image quality matters more than trying to “train a model on noise.”
- Classes are defined by the quality standard, not by labeling convenience.
- False accept and false reject have different costs and thresholds.
- The dataset should be split by time, batch, line, and SKU, not by random neighboring frames.
- The decision should be synchronized with the product using a stable identifier.
- Production drift includes not only the product, but also lighting, contamination, and changeovers.
Contents
- When machine vision is a good fit
- The OPTIKA Method
- Defect Sheet
- Where to Place the Inspection Point
- Camera, Optics, and Lighting
- How to Build the Dataset
- How to Choose the Model Type
- Metrics and Cost of Errors
- Edge, PLC, and MES
- From Signal to Action
- Monitoring and Drift
- Pilot Plan
- What to Accept from the Contractor
- Frequently Asked Questions
- How AI Dawn Implements Visual Inspection
- Conclusion
When machine vision is a good fit
A good candidate has a visually observable feature, repeatable positioning or the ability to stabilize it, a formal quality decision, and enough time to react. Examples: component presence, marking, geometry, color, scratch, contamination, weld quality, or packaging completeness.
A weak candidate is a hidden internal defect without a suitable sensor, a rare event with no examples or expert, a subjective notion like “looks bad,” or a process where detection happens too late to change the action. Sometimes you need not an RGB camera, but 3D, thermal imaging, X-ray, ultraviolet, or a standard sensor.
NIST on AI use in manufacturing classifies inspection and defect detection as computer vision use cases, while also naming data quality, cost, skills, cybersecurity, and legacy integration among the barriers. This is a systems problem, not just an ML problem.
The OPTIKA Method
OPTIKA is a six-part project framework:
- O — Object: SKU, surface, acceptable variants, and defects.
- P — Position: line point, viewing angle, fixation, and reaction window.
- T — Terms: takt time, cost of errors, traceability, and safety.
- I — Image: camera, lens, light, background, trigger, and quality gate.
- K — Classifier: rules, ML model, threshold, and uncertainty.
- A — Automation: PLC/MES, action, human review, log, and rollback.
If the system is unstable, OPTIKA suggests the troubleshooting order. First check object/position/image, then data/model, and only after that the production action.
Defect Sheet
For each class, record:
| Field | Example content |
|---|---|
| defect_id and name | single quality and production term |
| standard/tolerance | document, version, section, unit of measure |
| visual feature | shape, area, contrast, minimum size |
| class boundary | acceptable, rework, scrap, review |
| similar states | glare, dust, process mark |
| false accept cost | the defect moved downstream or to the customer |
| false reject cost | good product delayed/scrapped |
| expert | who resolves labeling disputes |
Do not combine different consequences into a single “defect” class. A minor cosmetic mark and a critical crack require different thresholds, routing, and reporting.
Where to Place the Inspection Point
Place the inspection point where the defect is already visible, but action is still useful. Early inspection reduces the amount of further processing on a defective part, but the surface may not yet be prepared or the geometry may not be complete. Final inspection sees the finished result, but the cause is already farther upstream in the process.
Describe the station cycle:
item id → trigger → fixation → frame series → quality gate → inference → decision → PLC acknowledgement → physical routing → MES record.
Check the maximum takt time, buffer, and behavior in case of frame loss, communication loss, or power loss. Lack of a decision must not be silently treated as PASS.
Camera, Optics, and Lighting
First, build an image where the defect is separable from the normal product. Choose field of view, working distance, object resolution, depth of field, shutter, frame rate, trigger type, and interface. Lighting can be front, side, ring, dome, coaxial, or transmitted — the choice should be validated on physical samples.
Control:
- position, vibration, and motion blur;
- glare, shadows, and external lighting;
- contamination on the lens and protective glass;
- exposure, focus, and dead pixels;
- color/geometric calibration;
- temperature and mounting stability.
The quality gate must flag an unusable frame separately from a normal product. Otherwise, the model is forced to guess from data that physically isn’t there.
How to Build a Dataset
Store item/batch/SKU/line/shift/timestamp/camera/recipe and the expert’s decision. You need normal products across the full acceptable range and defects of varying severity, including borderline examples and look-alike non-defects.
Annotation can be at the image level, bounding box, mask, or measurable geometry level. Choose the minimum level of detail that supports the decision and gives the operator an explanation. Agreement between two experts on a disputed sample set shows the quality of the standard itself.
Split train/validation/test by batch, time, line, or series so that almost identical neighboring frames do not land on opposite sides. A separate line acceptance set is collected after installation and is not used for tuning.
How to Choose the Model Type
| Task | Possible Approach | Output |
|---|---|---|
| feature present/absent | classification | class + confidence |
| find object/defect | detection | box + class |
| exact area/contour | segmentation | mask |
| few defects, stable normal condition | anomaly detection | anomaly map/score |
| size and tolerance | calibration + rules | measurement |
Start with a rule-based baseline if the feature is expressed through contrast, shape, or size. ML is justified when variability cannot be reliably described by rules. Multiple stages can be combined: a geometry rule checks position, the model looks for the defect, and the policy makes the decision.
Metrics and the Cost of Errors
Accuracy is useless without class composition. For each defect class, calculate the confusion matrix:
- false accept: a defect is accepted as good;
- false reject: a good part is rejected as defective;
- true detect: the defect is found;
- true pass: the normal part passes.
Also measure performance by SKU, line, shift, batch, severity, and operating-condition range; the share of unreadable frames; end-to-end latency; missed triggers; PLC/action mismatches; and manual-review rate.
The threshold is chosen based on the cost of errors and the capacity for manual review. A single global threshold may be wrong: a critical class gets a conservative rule, while a cosmetic one follows a different path. All acceptance values are set by the quality owner; there are no universal percentages.
Edge, PLC, and MES
Edge inference reduces dependence on external networks and helps maintain takt time, but it requires device, version, temperature, storage, and update management. The cloud can be used for training, fleet management, and analytics — the architecture depends on latency, data, and OT policy.
AWS guide on visual quality inspection at the edge emphasizes the interdisciplinary nature of the work: ML, software, vision hardware, domain knowledge, edge SDLC, and OT integration. NVIDIA industrial inference example also shows controlled lighting, multiple cameras, edge inference, and control documentation as one pipeline.
The integration contract includes item id, station id, timestamp, recipe/model version, result, defect class/location, image reference, confidence/quality flags, PLC acknowledgement, and the final physical action.
From Signal to Action
Increase autonomy in stages:
- offline: the model evaluates archived data;
- shadow: analyzes the line but does not affect it;
- assist: highlights the area for the operator;
- hold/review: holds the questionable part;
- bounded reject: automatically diverts the confirmed class;
- process feedback: signals a defect pattern to the process owner.
Automatic adjustment of equipment parameters is a separate control-loop project with functional safety requirements. The detector must not change the process mode on its own.
Monitoring and Drift
Drift appears as a new SKU, material, or supplier, surface changes, changeovers, a new camera, aging lighting, contamination, seasonal background changes, and a shift in the standard. The dashboard connects model signals with production signals.
Monitor image distribution, unreadable rate, confidence/uncertainty, manual rechecks, false accept/reject on a verified sample set, defects by batch/shift, latency, device health, and decision/action divergence.
Every version of the camera recipe, preprocessing, model, threshold, and PLC logic must be reproducible and roll back safely. Operator feedback does not go directly into the training set: it is confirmed by a quality expert.
Pilot Plan
- Choose one SKU, station, and defect class.
- Establish the baseline and the cost of the two errors.
- Create a defect spec and golden samples.
- Run an optical feasibility test.
- Install repeatable capture and a quality gate.
- Collect and label data by shift and batch.
- Compare rules, ML, and a hybrid baseline.
- Run offline and recorded-line eval.
- Start with shadow, then assist/hold.
- Make a decision on the line-acceptance set and runbook.
It’s convenient to include source data preparation and constraints in the business process audit before AI implementation.
What to accept from the contractor
- defect log and signed acceptance rubric;
- station layout, BOM, camera/light recipes, and calibration;
- dataset register, provenance, split, and label guide;
- baseline and model card with slice metrics;
- line-acceptance report and list of critical fails;
- PLC/MES contract, timing, and fail-safe states;
- traceability record from part to action;
- monitoring, revalidation, rollback, and incident runbook;
- source files/artifacts and the handoff procedure.
The AI Rassvet Computer Vision service page describes the development format; this material helps define requirements and acceptance. Frequently Asked Questions
How many images do you need for training?
There is no universal number. It depends on variation in the normal state, the number and rarity of defects, viewing angles, and the chosen approach. The decision is made based on the learning curve and a separate test set.
Can existing cameras be used?
Sometimes yes, if their resolution, optics, trigger, exposure, and stability provide the needed visual signal. This is confirmed by an optical feasibility test on the line.
What matters more — precision or recall?
It depends on the cost of false rejects and false accepts for a specific class. A critical defect usually requires a separate threshold and safety route.
Can parts be automatically rejected right away?
It’s better to go through offline, shadow, and assist/hold first. Bounded reject is enabled after line acceptance, sync verification, fail-safe checks, and manual override.
How do you detect unknown defects?
Anomaly detection can flag deviations from normal, but its sensitivity and false alarms are tested separately. An unknown deviation is usually sent for review rather than automatically labeled as a specific defect.
How do you estimate project cost?
Consider the audit, test rig, cameras/light/mechanics, data and labeling, model, edge, PLC/MES, line tests, and support. A general CAPEX/OPEX framework is included in the article
on AI implementation costs .How AI Rassvet Implements Visual Inspection
AI Rassvet can audit the inspection point, run an optical feasibility test, prepare data and labeling, develop a computer vision pipeline, integrate edge and PLC/MES, conduct offline/shadow/line acceptance, and set up monitoring, deployment, training, and support.
A safe first step is to choose one SKU, one defect, and one station, then document the baseline, imaging conditions, constraints, and acceptance criteria.
Discuss the project .Conclusion
Computer vision for quality control is a measurement and production system. Optics connects the object, position, requirements, image, classifier, and automation.
Stabilize the image before training, formalize defects and error costs, split data by batch, test the system on the real line, and increase autonomy step by step. Then the result will be a reproducible solution with traceability, not just a good model on demo images.
Stabilize the image before training, formalize defects and the cost of errors, split data by batch, test the system on the real production line, and increase autonomy in stages. Then the result will be a reproducible solution with traceability, not just a model that performs well on demo images.