Statistical process control (SPC) tools turn a stream of inspection results into a judgement about the process: control charts compare current output with limits calculated from a stable baseline, so the line can tell expected variation from a change worth investigating. On a computer vision inspection station, that means feeding inspection results (reject fractions, defect counts, measured features) into control charts instead of reacting to each reject as it appears, with CUSUM or EWMA running beside the Shewhart chart. Charts on the model’s own inputs and outputs also signal drift, and that signal helps decide when to retrain.
A line that watches a model’s raw verdicts alone reacts late. Accuracy against labelled data will not quickly settle what a run of rejects means, because on a line labels arrive days late and the accuracy figure moves only after the line has already shipped decisions. For language models, the same problem of judging quality before deployment is covered in our guide to task-specific evaluation harnesses for LLM deployment. Our piece on drift monitoring on a production CV inspection line covers the model-side instruments; this page covers the SPC layer that quality teams already run, and how to make CV output fit it.
How Statistical Process Control Tools Work in Practice
SPC runs in two phases. In Phase I, historical data is used to calculate preliminary control limits; points outside those limits are investigated, confirmed assignable causes are removed, and the limits are recalculated until the chart shows a process in control. Phase II is real-time monitoring against the limits Phase I produced. A signal in Phase II means rejecting the assumption that current data comes from the same population as the baseline, and the engineer follows the out-of-control action plan (OCAP) to look for the cause.
The core distinction is between common-cause variation, which is an expected part of the process, and assignable (special) causes, which are worth hunting down. Control charts cannot reduce variability on their own, but they stop two expensive mistakes: over-reacting to common causes (which can make things worse) and ignoring real assignable-cause signals.
Control limits are not specification limits. Specification limits come from a design engineer or from what the customer or next process step needs; control limits are calculated from observed data and describe what the process currently does, and putting specification limits on a control chart is misleading. “In control” means only that the process is statistically predictable; a predictable process can still sit at the wrong level.
Control charts are one tool among several. The NIST/SEMATECH e-Handbook lists histograms, check sheets, Pareto charts, cause-and-effect diagrams, defect concentration diagrams, scatter diagrams and control charts as the key monitoring and investigating tools, and within control charts it covers Shewhart, CUSUM, EWMA and multivariate charts.
Which Statistical Process Control Charts Fit a CV Verdict Stream?
The chart type follows the data type and subgroup size, so the first step is to be precise about what the model emits per part. The detector producing that stream is covered in how real-time object recognition works on the inspection line. Pass/fail and defect counts are attributes data, which the NIST handbook defines as classifying units into buckets such as conforming and nonconforming.
Chart Choice by CV Output
| What the CV model emits | Data type | Chart | Main caveat |
|---|---|---|---|
| Pass/fail per part, varying number of parts per window | Fraction nonconforming | p chart | Assumes a stable defect probability and independent units (binomial basis) |
| Pass/fail per part, fixed number of parts per subgroup | Count nonconforming | np chart | Preferred when subgroup size is constant |
| Several defects can be found on one part | Count of nonconformities | c chart (constant inspection unit) or u chart (per unit) | Poisson model; skewed, so zone rules need care |
| A measured feature (dimension, gap, area from a Mobile SAM segmentation mask) | Variable | X-bar and R, or individuals chart | The vision gauge must be calibrated and pass a gauge study first |
| Input-feature distance per image or window | Variable | Three-sigma chart, plus CUSUM for drift | CUSUM suits drift across batches; watch for autocorrelation |
The pass/fail charts have two weaknesses. Attribute charts are less informative than variables charts: a shift on a variables chart often hints at the cause, while a change in the number of nonconforming items may give no hint at all. They are also slow to see small changes. In a worked example by Lawson, with a centre line of 0.231 and subgroups of 50, the probability that the next subgroup falls inside the p chart limits is at least 0.90 for any true proportion between 0.15 and about 0.30.
Our judgement is to treat the p chart as the line’s headline chart, then add at least one variables chart wherever the model exposes a continuous quantity.
CUSUM and EWMA belong beside the Shewhart chart, not instead of it. A three-sigma Shewhart chart takes around 44 points to react to a one-standard-deviation shift, while CUSUM and EWMA get there in about ten, according to Analyse-it. The conventional CUSUM settings are k of 0.5 with h of 4 or 5 to catch a one-sigma shift, and EWMA lambda usually starts between 0.10 and 0.20. Running both covers the sudden excursion and the slow drift.
How Do You Set Control Limits When the Inspection Verdict Comes from a CV Model Rather than a Manual Gauge?
Limits for a CV station come from Phase I on the line, with the model version frozen, not from the pilot dataset. The gap between pilot cell and full line is covered in scaling AOI inspection models from pilot cell to full line.
The mechanics follow standard practice, with a few CV-specific choices:
- Collect at least 20 to 25 subgroups before trusting the limits; Lawson’s Phase I example treats fewer than 25 as a reason to collect more data and recompute.
- Form rational subgroups so that variation within a subgroup reflects only common causes, typically consecutive parts grouped together with subgroups spaced apart in time. For a camera that sees every part, we would subgroup by short production windows aligned with shifts, lots or changeovers, since lot, shift and setup are what to check when a signal fires.
- Take the baseline from a period when the process was actually in control; a baseline that contains drift teaches the chart to treat the problem as normal.
- Investigate each out-of-control point, remove those with confirmed and preventable causes, recalculate, and repeat until the chart shows no assignable causes.
- Document every cause found in an OCAP, so that a Phase II signal points to what can be adjusted. For a CV station, the OCAP should name model-side causes (camera moved, lighting changed, new model version deployed) next to process-side ones.
Fix CUSUM and EWMA parameters before you plot: they encode the shift size that matters to the process, not what the data happens to show. Limits are recalculated only when the process has really changed, for example after a confirmed improvement, never to make signals go away. A model update counts as a real change to the measurement system, so it calls for a fresh baseline check rather than a silent carry-over of old limits.
Can You Trust the Vision Station? Gauge R&R and Cp/Cpk Before Charting
A validated measurement system study must come before SPC and any capability analysis, because a gauge that contributes a large share of total variation can cause false alarms or mask real special causes, and makes Cp and Cpk meaningless. The Automotive Industry Action Group (AIAG) guideline accepts a measurement system under 10 percent %GRR, calls 10 to 30 percent possibly acceptable depending on the application, and rejects anything over 30 percent.
For machine vision measurement, Vision Systems Design (2022) describes the sequence: calibrate pixel coordinates to real-world units with traceable artefacts and distortion correction, run a Type 1 gauge study of at least 30 inspections on one calibration artefact to establish bias, then run a Gauge R&R, typically three measurements on at least 10 parts by three operators. The parts should span the full range of process variation.
That protocol is written for measured dimensions. A pass/fail classifier needs the same thinking adapted: repeatability becomes whether the same part, re-presented several times, gets the same verdict, and reproducibility becomes whether verdicts agree across cameras, stations, shifts and model versions. Parts near the decision boundary are the ones that matter in that study, because a classifier that flips on borderline parts injects noise straight into the p chart.
Process capability indices apply to measured characteristics with specification limits, so on a CV station they belong to the vision-measured features, not to the reject rate. Cp measures whether the process spread fits within the specification width, and Cpk adds centring. The NIST handbook notes that Cp, Cpk and Cpm assume normally distributed data and need about 50 independent values to be valid, and capability should only be calculated on a process already shown to be in control. A commonly used threshold treats Cpk above 1.33 as capable. One useful cross-check: on a stable process Ppk equals Cpk, and Ppk falling well below Cpk indicates a process that shifts or drifts over time.
How Do Western Electric and Nelson Rules Apply When the Signal Comes from a CV Model?
The Western Electric rules, codified in the company’s 1956 handbook, add four run tests to a Shewhart chart: one point beyond three sigma, two of three consecutive points beyond two sigma on the same side, four of five beyond one sigma on the same side, and eight in a row on one side of the centre line. Lloyd Nelson’s 1984 set of eight tests keeps that logic and adds trends (six points steadily rising or falling), oscillation (fourteen alternating points), stratification (fifteen points within one sigma) and mixture patterns.
Every rule you add buys sensitivity with false alarms. A single point beyond three sigma occurs about 0.27 percent of the time on a stable process, roughly one false alarm in 370 points. With all four Western Electric rules applied together, the combined rate rises to about one in 91.75 observations, per Champ and Woodall (1987) in Technometrics. Minitab applies Test 1 and Test 2 (nine points on one side) by default and leaves the rest to the user.
For a CV defect-rate chart, we would start with Rule 1 plus one run rule for sustained shifts, and add the trend rule for gradual drift. The stratification and mixture tests are best used as diagnostics for how subgroups were formed, not as routine alarms. Two cautions apply to the zone rules. The zone rules assume a roughly normal, symmetric distribution, so they should be used carefully on skewed c and u charts. And zones must be drawn from the control-chart sigma, never from tolerances.
The practical limit is your reaction capacity: switch on only the rules your reaction plan can actually handle. A rule set that fires every shift trains people to ignore the chart, which is worse than having fewer rules.
How Do You Separate Normal Variation from a Genuine Process Shift in Defect-Rate Data?
A genuine shift shows up as a pattern that common-cause variation is unlikely to produce: points beyond the limits, a shift in level, a change in spread, a trend or a cycle. Everything else inside the limits is the process behaving as it normally does, and adjusting the line to chase it can make things worse. The rule that fired hints at the kind of cause: a sudden event for the single-point rule, a shift for the same-side rules, a drift for the six-point trend rule.
When a rule fires, check the data first (a wrong gauge, a changed sampling method), then look for what changed at the time, remembering that a run rule fires at the end of the run, so the cause usually started at its beginning. On a CV line, “check the data first” means checking the inspection station before the process: camera position, exposure, lighting and model version.
Classifying rejects is a good way to find the cause of an attribute signal. In Lawson’s example, a Pareto diagram of nonconformity types in an out-of-control subgroup pointed to an inexperienced temporary operator, and classifying another subgroup’s defects led to a new batch of cardboard stock. Where the CV model already labels defect classes, start a p chart investigation with a Pareto of those classes for the flagged window. A statistical signal is a prompt for investigation, not an instruction to adjust the process.
How SPC Control Charts Warn You the CV Model Is Drifting
SPC can monitor the model as well as the product. One line of research applies SPC to neural networks to detect unreliable behaviour, for example tracking shifts in the distribution of embeddings with nonparametric multivariate charts, without needing labelled data. That matters on a line precisely because labels are slow.
Two studies show how this works on image models. A 2024 arXiv study applying SPC to out-of-distribution detection in medical imaging found three-sigma charts effective for flagging individual anomalous images, while CUSUM was better at detecting drift across batches, catching induced shifts after a few days where daily averaging hid the change from the three-sigma chart. The same study found basic image statistics such as mean and standard deviation inadequate for telling chest x-rays from other image types, so feature choice matters. Franck, Driscoll, Szajnfarber and Woodall propose a CUSUM on classifier calibration with dynamic control limits; in their image-classification case, new object subtypes began appearing at time point 3,501 and the chart signalled at 3,533. Their method needs only probability predictions and observed outcomes, not access to the model’s internals.
Process Shift or Model Drift: Reading the Charts Together
Running a product chart and a model-health chart side by side is what lets you attribute a signal:
| Defect-rate chart | Input or confidence chart | Most likely reading |
|---|---|---|
| Signals | In control | A real process change; follow the process OCAP |
| Signals | Signals | The inputs changed (lighting, camera, packaging, new part variant); the defect rate may be an artefact of the model |
| In control | Signals | Early model drift that has not yet moved the verdicts; investigate before it does |
| Signals right after a model update, with performance drops | Sudden, severe drift | Consider rolling back the update |
When a Signal Should Trigger Recalibration or Rollback
No source settles this for CV inspection specifically, so what follows is our judgement. A sudden, severe drift signal shortly after a model deployment that correlates with performance drops can warrant a rollback. Recalibrate or retrain when the inputs have changed legitimately and are staying changed (a new supplier’s packaging, a new part variant) and the model is the stale party. Fix the station, not the model, when the cause is physical: a moved camera, a failing light.
Franck and colleagues argue against simply recalibrating whenever their chart signals, because it is important to understand why predictions stopped matching outcomes: a model update, a new operating context or new object subtypes. Any automatic trigger also needs a duration or frequency condition, since thresholds set too aggressively cause flapping between versions.
Ownership follows the same split. In our view, the quality team owns the charts, the limits and the OCAP; the ML engineering team owns the model and its health charts; and the OCAP is the handoff, with entries that say “model-side cause suspected: escalate to the model owner with the flagged window’s images”. The reaction should be written down before the signal, including who investigates and what gets checked. Those control charts are part of the reliability artefacts that keep a line-side CV model running.
How Does Pairing SPC with CV Defect Detection Fit into an Industry 4.0 Quality Stack, and What Changes When the Inspection Data Is Continuous and High-Volume Rather than Periodic Subgroup Samples?
Lawson describes a quality information system (QIS) as the modern equivalent of filed check sheets, integrating quality records across sources and supporting real-time control charting from production machine interfaces. Where CV inspection sits relative to the rest of the line is the subject of quality control engineering for CV defect detection.
Three things change with full-volume data. First, independence breaks. The p chart assumes successive units are independent, and positively autocorrelated data underestimates sigma, producing limits that are too narrow and an inflated false-alarm rate. CUSUM and EWMA are more affected than Shewhart charts because they carry information forward.
Second, huge subgroups make the limits tight. The p chart limits are p̄ ± 3√(p̄(1 − p̄)/n), so they narrow with the square root of the subgroup size, and at thousands of parts per window a shift too small to matter operationally can breach them. Drift monitoring has met the same trap: in a 2022 supply-chain study, every Kolmogorov-Smirnov drift test was highly statistically significant at the sample sizes involved, yet none was operationally meaningful. Size subgroups for the shift you care about, not for the data you happen to have.
Third, we would add traceability across stations. Following parts between stations ties a defect signal at one camera to the upstream steps the part passed through; Re-ID for tracking parts across the line for SPC covers that piece.
Before Phase II, decide what shift size matters: how much movement in reject rate, confidence or a measured feature justifies stopping to investigate. That size is a decision about what matters to the process, not something the data shows. Quality and ML engineering on a manufacturing line have to agree on it together, before Phase II starts.