Statistical Process Control Charts for CV Defect Detection

How to apply statistical process control charts to a CV defect-detection model: chart choice by metric, control limits, run rules and the retrain decision.

Statistical Process Control Charts for CV Defect Detection
Written by TechnoLynx Published on 12 Jun 2026

Statistical process control charts treat a computer-vision defect-detection model on a production line as a process that drifts like any other. You give it computed control limits and rule-based signals that distinguish normal line variance from a real shift. On an inspection line, the thing you chart is the model’s inspection output: defect rate, false-reject rate and score distributions. Each metric gets the chart type that matches its data, binomial, Poisson or continuous. The limits are set to hold a target in-control false-alarm rate. An out-of-control point is an investigation trigger, not an automatic retraining command.

A dashboard of raw accuracy gives no statistical basis for telling normal line variance from a real shift. If you want the wider context of where a vision model fits among the line’s other checks, see our piece on quality control engineering and where CV defect detection fits on the line.

How Do Statistical Process Control Charts Work, and What Do They Mean in Practice?

A control chart plots a quality characteristic against sample number or time. The chart has a centre line at the in-control mean and an upper and lower control limit, placed so that nearly every point falls inside them for as long as the process stays in control. Variation inside the limits counts as common-cause variation: the normal spread of a stable process. A point outside the limits suggests that an assignable (special) cause is present and sends someone looking for it.

The limits sit k standard deviations from the centre line. NIST’s e-Handbook notes that k = 3 has become the accepted standard. On a Shewhart chart, three-sigma limits mean about 0.27% of points from an in-control process will fall outside by chance. Put another way, the in-control average run length (ARL0) is about 370 samples between false alarms.

Control limits are a different thing from specification limits. Control limits tell you whether the process is producing consistent output. Specification limits tell you whether the product will work. That is why the chart is a monitoring instrument and not a detection accuracy metric like mAP@50-95.

Charts are used in two phases. In Phase I you collect reference data, check that the process is stable and derive the limits. In Phase II you monitor against those frozen limits. For attribute charts, AIAG guidance asks for at least 20 to 25 subgroups of verified-stable data before the limits are frozen. For variables charts, NIST notes that control should not be declared before at least twenty-five in-control samples of size four have been seen.

How Do You Apply SPC to a CV Model’s Output Instead of a Physical Measurement?

You treat the model running on the line as the process, and its inspection output as what you chart.

The verdict is the observed status, not the true defect status, and that difference matters. Work on p-charts with measurement error shows that when items are misclassified, the observed proportion of nonconforming items differs from the true one. If the misclassification is ignored, the chart is biased and may detect the wrong things. So a p-chart of model rejects tracks the model and the line together, and a change in either one moves the chart.

That puts a prerequisite in front of the chart. For human visual inspection, attribute agreement analysis (kappa against a standard and between appraisers) is the measurement-system check that must pass before inspection counts are trusted as chart input.

You can also go beneath the verdicts. A study on statistical process monitoring of neural networks charts the network’s embeddings (its hidden-layer representations) with nonparametric multivariate control charts to detect when the data stream becomes non-stationary. On one image-classification test set, the same study observed that misclassified samples had visibly different softmax-confidence distributions from correctly classified ones. That is one reason to chart scores and not only verdicts.

Which Metrics from an Inspection Model Belong on a Control Chart: Defect Rate, False-Reject Rate, or Score Distributions?

All three belong on charts: defect rate, false-reject rate and score distributions. Chart choice follows two splits. First, are you counting defectives (each part is good or bad) or defects (one part can carry several)? Second, is the sample size, or area of opportunity, constant or variable? Defective-unit data is binomial and defect counts are Poisson. A continuous score takes a variables chart such as I-MR.

Inspection metric What it is Chart Centre line and limits
Reject rate, fixed lot size Parts the model flags as defective, out of a constant n np-chart n p̄ ± 3√(n p̄(1 − p̄))
Reject rate, varying lot size Proportion flagged per lot p-chart p̄ ± 3√(p̄(1 − p̄)/nᵢ), recomputed per subgroup
False-reject rate Audited rejects found good, out of rejects audited p-chart (or np-chart if the audit sample is fixed) As above
Defects per part, constant inspection unit Detections per part when every part presents the same area c-chart c̄ ± 3√c̄, LCL set to zero if negative
Defects per part, varying inspection unit Detections normalised to part size or area u-chart ū ± 3√(ū/nᵢ)
Confidence score, one value per period Mean or percentile of the model’s score per interval I-MR chart x̄ ± 3·MR̄/1.128

On the p-chart and u-chart, the centre line is the pooled proportion: total defectives divided by total units inspected. It is not the average of the per-lot proportions. The AIAG SPC Reference Manual and ISO 7870-2 both require this pooling. The c-chart’s Poisson basis holds only if defects occur randomly and independently, with the same probability across the inspection unit, and the unit size stays constant. When unit size varies, use the u-chart. The p-chart has a matching assumption: each item is independent, with a constant defect probability within the subgroup.

Scores deserve a place on the chart too. A pass/fail outcome carries far less information than a measured value. An attribute chart therefore needs a much larger sample to detect the same shift with the same power, while a variables chart such as I-MR catches small shifts earlier and with less data. On an I-MR chart, read the moving-range panel first: its limits must be stable before the individuals limits mean anything.

How Do You Set Control Limits That Catch Real Drift Without Flooding the Line with False Alarms?

Start with three-sigma limits, computed for attribute charts from at least 20 to 25 stable baseline subgroups. Recompute p-chart and u-chart limits for every subgroup’s own size. The sigma multiplier k sets the width of the limits. A smaller k (say 2) makes the chart more sensitive to real shifts and raises false alarms, while a larger k (say 3.5) cuts false alarms and slows detection. Control charts are also designed to a target in-control ARL instead. ARL0 values of 200 or 370 are typical, and an ARL0 of 500 means stricter false-alarm control.

Worked Example: P-Chart Limits When Lot Sizes Vary

Take an assumed pooled reject rate of p̄ = 0.02 and apply the p-chart formula to two lot sizes.

  • Lot of 200 parts: σ = √(0.02 × 0.98 / 200) ≈ 0.0099, so the UCL ≈ 0.02 + 0.0297 ≈ 0.050. The LCL works out negative and is clamped to zero.
  • Lot of 1,500 parts: σ = √(0.02 × 0.98 / 1500) ≈ 0.0036, so the UCL ≈ 0.031 and the LCL ≈ 0.009.

Draw a single flat line between those values and it raises false alarms on every large lot and misses real shifts on every small one. On a line where shift volumes swing, a frozen limit line makes a CV monitoring chart misleading.

High-Yield Lines and the Zero Lower Limit

On a high-yield line, where the defect rate is close to zero, the standard formula breaks. When p̄ is close to zero or c̄ is below 1, the lower limit collapses to zero and the upper limit becomes artificially tight. Any nonzero point can then raise an alarm, and you need exact limits or an attribute CUSUM instead. The collapse has a second cost. Once the LCL collapses to zero, the chart loses sensitivity. A point below a positive LCL should be investigated just like one above the UCL, because it might be a real improvement or a recording error. For a model, a sudden fall in rejects is just as worth a look as a rise.

Test for overdispersion before you touch the limits. Real attribute data often carries more variance than the binomial or Poisson model assumes, for example when defects cluster within batches. A chi-square goodness-of-fit test shows whether that is happening, and simply widening the limits to absorb the excess hides the signal the chart exists to find.

When Three-Sigma Shewhart Limits Are Too Slow

Shewhart charts are not efficient at catching small shifts in the process average. The I-MR chart is less sensitive to small sustained shifts than CUSUM or EWMA charts, and a CUSUM or EWMA overlay complements it where that sensitivity is needed. An EWMA chart plots a weighted average of the current and past sample proportions, and that weighting makes it sensitive to small shifts.

For pass/fail streams, a 2026 paper on a binomial EWMA chart for multiple-stream processes (arXiv 2604.12095) recommends λ ≈ 0.2 with L ≈ 1.4 to target ARL0 ≈ 370, and λ ≈ 0.15 with L ≈ 1.55 for ARL0 ≈ 500. In the paper’s simulations at ARL0 ≈ 370, the average run length to detect a moderate shift of δ = 0.20 in the monitored proportion was 3 to 6 samples. Those L values belong to that specific chart construction, not to every EWMA, so treat them as a starting point to check by simulation on your own baseline. The same paper warns that classical methods assume normal, independent data, and binomial defect-rate monitoring often violates that assumption.

Limits estimated from a small sample are a separate trap. A paper on bootstrapped limits for score-based MEWMA drift charts (arXiv 2507.16749) found, in simulated examples, that its nested-bootstrap limits held the pointwise false-alarm rate close to the 0.001 target. That chart monitors model scores, not attribute counts.

Which of the Standard Run Rules (e.g. The Western Electric / Nelson Rules) Actually Make Sense to Enable on a CV Inspection Chart, and Which Generate Noise on a High-Throughput Line?

Enable a small, deliberate subset: the three-sigma point rule plus one or two run or trend rules that match the drift you expect, and leave the over-control rule (N-4) and zone rules off low-count reject charts, where they mostly add noise. Every extra rule buys sensitivity with false alarms. NIST’s e-Handbook says a plain three-sigma Shewhart chart gives a false alarm about every 371 points on average, and adding the Western Electric (WECO) rules raises that to roughly one in every 91.75 points. A paper on sensitising runs rules (arXiv 1007.3225), citing Palm, gives a slightly different in-control ARL of 94.75 with the Western Electric rules.

The sensitivity gained is real: a sustained 1-sigma shift takes about 44 subgroups on average to trigger WE-1 alone, but about 10 with WE-1 and WE-4 together.

Rule Signal Worth enabling on a CV inspection chart?
1 point beyond 3σ (WE-1 / N-1) Abrupt change Always
9 in a row on one side (N-2) Sustained shift Yes; its in-control probability is about 0.0039
6 in a row rising or falling (N-3) Monotonic trend Yes where the process is prone to drift
2 of 3 in zone A (N-5), 4 of 5 in zone B (N-6) Moderate shift Consider on I-MR score charts; be cautious on attribute charts
14 alternating (N-4) Over-control Rarely relevant to a model’s output
15 in zone C (N-7) Variance reduction or wrong sigma Sometimes a sign of incorrectly computed sigma
8 in a row avoiding zone C (N-8) Mixture or bimodal output Yes where several product variants share one model

Nelson’s rules suit processes prone to drift and software-driven SPC where running eight rules costs nothing, while the Western Electric rules suit well-understood processes where a low false-alarm rate matters most. Attribute charts need one more caveat. Binomial and Poisson data can only land on specific values, which creates ladder effects. Zone-based rules that assume a continuous distribution then behave differently near the limits, and the false-alarm rate rises when limits are narrow. That is the main reason to keep zone rules on score charts and off low-count reject charts.

What Out-of-Control Signal Shows a Lighting Shift or Packaging Change Has Degraded the Model?

A step change, such as a new packaging film or a replaced lamp, is a sustained shift, and a sustained shift shows as a run: points that stay on one side of the centre line without necessarily crossing a limit. A slow change, such as an ageing light source or a lens gathering dust, shows as a trend. On an I-MR chart, seven or more consecutive points on one side suggest a sustained shift, six or more points steadily rising or falling indicate drift, and a single spike on the moving-range chart suggests a transient change rather than a sustained shift. The run length depends on the rule set: the I-MR guidance uses seven, while Nelson’s N-2 rule uses nine. Non-random patterns like these signal a change even when every point stays inside the limits.

A variables chart on scores, such as I-MR, detects small shifts earlier and with less data than the attribute reject-rate chart. The ImageNet-ES study (CVPR 2024) captured 202k images with a real camera while varying environmental and sensor factors. It found that existing out-of-distribution detection methods did not cope with those covariate shifts, and that controlling the camera sensor could improve performance substantially without increasing model size.

One ML-enabled SPC framework applied SPC to out-of-distribution detection and drift monitoring. In a simulation with 100 daily chest X-ray cases, it detected a drift in the out-of-distribution input percentage from 0–1% to 3–5% within two days, while keeping a low false-positive rate. That is a clinical medical-imaging setting, not a factory one. Its authors describe the framework as agnostic to data, modality and model.

How Does SPC Monitoring Connect to the Model Rollback and Retraining Decision on a Production Line?

An out-of-control signal tells you when to investigate. Whether to roll back, retrain or do nothing comes later, after triage. One production ML guide treats drift alerts as investigation triggers, not retraining commands. Pipelines, schemas, labels, instrumentation and metric definitions get checked first. The sequence it sets out runs detect, triage, decide, retrain or remediate, validate, release, govern, with entry and exit criteria at each stage.

Triage on an inspection line has a physical side too. Before anyone touches the model, check whether the camera, lighting, fixture or product changed. The neural-network monitoring study makes the same point in research terms: once a change is detected, establish how severe it is and in which data region it occurred, and only then adjust or rebuild the model.

The same guide sets out four conditions for retraining. A performance metric has declined beyond its documented alert threshold (a proxy signal alone is not enough). The cause has been confirmed as model drift and not a pipeline or measurement issue. Clean, representative retraining data is available. And the retrain will be followed by full evaluation and a controlled vision inspection system rollout with rollback criteria. For containment, it advises considering rollback to the prior model during investigation of a Red-severity alert, and rolling back if a Red alert or below-minimum performance appears during the post-release observation window. On the line, the control chart supplies that observation window: the retrained model has to bring the chart back inside its limits before it is trusted. The move from a validated model to one that keeps working is covered in our article on how CV defect-detection models survive the move from pilot to production.

Be honest about the thresholds. Published drift thresholds are starting points, not universal rules. A supply-chain monitoring study found every Kolmogorov-Smirnov drift test highly statistically significant at its large sample sizes, yet none operationally meaningful. The authors leave suitable alerting and retraining thresholds to future work. That is the argument for control limits derived from your own stable baseline, and against p-values computed on millions of frames.

Control charts sit beside the eval harnesses, regression suites and release-readiness reviews described in our overview of the artefacts that keep a line-side inspection model running. In the neural-network monitoring study, a larger reference sample reduced false alarms but blunted detection of real change, and when to refresh it without absorbing drifted data remains an open research question.

FAQ

Are Control Limits the Same as Specification Limits?

No. Control limits show whether a process is producing consistent output, and specification limits show whether the product will function as intended.

How Many Data Points Do I Need Before Freezing Control Limits?

AIAG guidance calls for at least 20 to 25 subgroups of verified-stable data before limits are frozen for monitoring. An I-MR chart needs at least 20 to 25 individual measurements in time order.