Machine Vision Inspection Pilot Requirements Specification

Machine Vision Inspection Pilot Requirements Specification

Purpose and position

This document specifies what a machine vision inspection pilot must demonstrate before it can be considered for deployment. Every requirement is backed by a measurement rather than a convention. Observations made based on the case study: defect classification of submersible pump impellers.

Three positions govern it.

Nominal accuracy does not distinguish candidate systems. Five models evaluated on identical held-out data spanned 98.60% to 99.86% — a range entirely inside the measured label-error band. Every meaningful difference appeared only under imaging degradation, where cost varied by a factor of 4.2.

Failure direction matters more than failure rate. Under sensor noise, two models with comparable accuracy produced opposite behaviour: one missed 223 of 453 defects, the other missed none and over-flagged 195 good parts. The cost difference was 28×. A specification that constrains only accuracy permits either.

Operating point selection is worth more than model selection. Choosing the decision threshold from a cost matrix was worth 2.2× more than choosing the better model at the software default — and required no additional data, training or compute.


Part 1 — Screening, before procurement

Four tests that cost minutes and determine feasibility before any vendor conversation.

1.1 Resolution feasibility

px_per_mm            = pixels_measured / mm_actual
smallest_detectable  = 3 / px_per_mm

A defect requires 3–5 pixels across its smallest dimension. Below that, no algorithm detects it reliably. The remedy is optics — a different lens, a shorter working distance, a higher-resolution sensor — never software.

Gate: state the smallest defect of commercial concern and the resolution required to see it, before any model discussion.

1.2 Economic feasibility

Inspection ML earns its place when inspection cost per part exceeds roughly 5–6% of escape cost, or when capacity prevents 100% coverage.

Automated visual inspection is cheap per part. A business case therefore must not rest on displacing inspection labour. The defensible arguments are:

  • Capacity — 100% manual coverage impossible at line speed
  • Consistency — human inspection varies by inspector, shift and hour
  • Coverage — destructive tests cannot be applied universally
  • Feedback latency — detecting process drift in minutes rather than at end of shift
  • Measurement where none exists — quantifying a property currently judged subjectively

1.3 Human baseline

Establish what a person achieves on the same images, before automating.

In this study an untrained reviewer scored 20/20 on unfamiliar parts. That makes the task visually easy and places the 95% upper bound on human error at approximately 14% — so the model could not be shown to beat a human.

Gate: a stated human accuracy figure from at least 200 images and two inspectors. Twenty samples cannot distinguish a perfect human from a 10%-error human, and neither can a business case.

1.4 Trivial baseline

Before accepting any ML accuracy claim, establish what trivial arithmetic achieves.

Method Accuracy
Majority class 63.4%
Mean image brightness alone 79.6%
Four global statistics 85.6%
Best deep model 98.74%

Four numbers per image captured 63% of the total available improvement. The deep model's genuine contribution was 13 percentage points, not 36.

Gate: every accuracy claim reported against a trivial-feature baseline, not against the majority class.


Part 2 — Imaging specification

Lighting has accounted for 94% of measurement variance in a classical pipeline; fixturing for 0%. Sensor noise has been the binding constraint for learned models, costing up to 45 accuracy points at σ=25 where all models fell to or below the majority baseline.

Requirement Specification Evidence
Resolution at object plane stated px/mm, ≥3 px across smallest defect §1.1
Sensor noise σ ≤ 5 intensity units, measured all models collapse by σ=25; damage begins at σ=10
Illumination stability ≤2% CV of mean frame intensity achievable; dataset exhibited 4.12%
Clipping 0.00% of pixels at 0 and at 255, verified per frame brightness recovery capped at 84% where highlights saturate
Exposure locked; auto-exposure, HDR and scene enhancement disabled computational photography compresses dynamic range
Vignetting ≤10 units centre-to-corner, or flat-field corrected measured 11.7 units
Fixturing model-dependent — see §3.4 0% contribution for a global metric, 3.8–8.1 points for a CNN
Compression lossless in transit, or JPEG quality stated and tested q=30 cost 1.4–3.5 points

Sensor noise is the single most under-specified parameter in industrial vision procurement. Augmentation libraries emphasise geometric transforms, so noise robustness is rarely tested and rarely specified. It was the most damaging perturbation in this study by a wide margin.


Part 3 — Model requirements

3.1 Baseline and headroom

Report: majority class, trivial-feature baseline, and the candidate model. Report both the percentage-point gain and the error-rate reduction, since they support opposite conclusions:

Framing Figure
Points over trivial features +13.1
Share of available improvement 37%
Error-rate reduction 11.4×

3.2 Annotation ceiling

No accuracy claim is interpretable above the annotation ceiling.

In this study, 4 of 9 model errors were confirmed mislabelled, implying a label error rate of at least 0.56% and an annotation ceiling of approximately 99.44%. One model scored 99.86% — above the ceiling, meaning it had learned the annotator's mistakes.

Gate: a measured label error rate, from a random audit rather than from reviewing the model's errors. Error-only review systematically misses label errors where the model agreed with the wrong label, so it yields a lower bound, not an estimate.

Note the cost: distinguishing a 0.5% label error rate from 1% with confidence requires auditing roughly 3,000 images. This is why almost no project knows its label error rate, and why "our labels are good" is usually an assumption.

3.3 Test set independence

Near-duplicate images distributed across a train/test split inflate accuracy. In this dataset, 68 of 715 test images (9.5%) were near-duplicates of training images, visually confirmed.

Gate: a deduplicated test accuracy alongside the full figure.

Two cautions on method. Similarity thresholds must be calibrated against the comparison-set size — a threshold set against 800 candidates removed 14% of the test set; the same threshold against 6,633 removed 67.6%, because the maximum over N comparisons grows with N. And calibrate against a within-training null: what does maximum similarity look like between images that are definitely not duplicates?

3.4 Fixturing tolerance is model-dependent

Approach 25 px translation
Classical global statistic 0% of variance
Classical features + LightGBM −5.0 points
CNN, frozen features −5.9 to −8.1 points
CNN, fine-tuned −3.8 points

Specify metric and fixturing together. Global statistics tolerate repositioning; feature-level correspondence and convolutional models do not.

3.5 Data efficiency

Approach Accuracy from 1,500 images From 6,633 images
Frozen features 98.18% 98.60%
Fine-tuned 99.86% not required

Frozen features saturate; 4.4× more labelled data bought 0.42 points. Fine-tuning on 1,500 images beat frozen features with all 6,633.

Decision rule: frozen features where labelled data is plentiful and compute scarce; fine-tuning where labelled data is scarce and compute available. Annotation is usually the expensive half.


Part 4 — Operating point

4.1 The default threshold is not a choice anyone made

Model At software default (0.50) At cost optimum
Model A £4,820 £3,355
Model B £6,740 £2,445

At the default, Model A appeared £1,920 cheaper. At cost-optimal thresholds, Model B is £910 cheaper — the ranking reverses.

The default of 0.5 is optimal for nothing. With a 63.4% positive rate it is not even accuracy-optimal: moving to the cost optimum improved accuracy from 98.74% to 99.02% while reducing cost.

Gate: a cost matrix with sourced figures, a threshold sweep, and the selected operating point expressed as an inspection policy.

4.2 Sensitivity to the cost assumptions

The recommendation held at every escape cost tested, and above approximately £105 the answer stopped changing entirely — because the optimal policy drives false negatives to zero, at which point the escape-cost term vanishes from the objective.

Consequence: the business case does not depend on pricing an escape precisely. It requires only that an escape costs more than roughly £100. That removes the most common reason these cases stall.

4.3 The boundary diagnostic

An optimum resting on the edge of a search range means the objective is missing a constraint. In this work a threshold optimum landed on the sweep's lower bound; investigation showed false negatives had reached zero, so the boundary was real and the question changed to how few false positives can each model achieve at zero escapes — a more useful question.

Gate: for any reported optimum, state whether it rests on a boundary and why.

4.4 Precision is a function of the production defect rate

This is the most commonly violated requirement in vendor material.

True defect rate Model B precision Model A precision
63.4% (test set) 98% 95%
10% 76% 55%
5% 61% 37%
3% 47% 25%
1% 23% 10%

The models' false-positive rates transfer. Their precision does not. The absolute false-alarm burden grows roughly 90-fold from this balanced dataset to a 1%-defect line — from 0.1 to 9.1 false alarms per real defect.

Each model has a usable defect-rate floor:

Precision floor Model B works down to Model A works down to
50% 3.3% defect rate 8.4%
25% 1.1% defect rate 3.0%

Gate: every precision and alarm-rate figure quoted with the defect rate it assumes. A precision figure without a defect rate is not a specification.


Part 5 — Robustness envelope

The single most important addition to a conventional vision specification.

Nominal accuracy spanned 98.60% to 99.86% across five models — statistically indistinguishable given the label noise. Mean cost under degradation spanned £6,813 to £28,805, a factor of 4.2. The robustness suite is the only test that separated them.

5.1 Required perturbation suite

Minimum set, each applied to the raw image before any pipeline normalisation:

Perturbation Levels Represents
Gaussian noise σ = 10, 25 sensor gain, low light, cheap sensor
Blur k = 5, 11 focus drift, vibration, contamination
Brightness ×0.7, ×1.3 lamp ageing, ambient light change
Contrast ×0.6 lamp diffusion change, surface finish
Translation 10, 25 px fixture shift, part placement
Rotation 5°, 15° part orientation
JPEG q = 30 compression in transit

Perturbation order matters. The camera degrades the image; the pipeline normalises afterwards. Reversing them lets preprocessing "correct" a degradation it never saw.

Judge plausibility for the application and drop what cannot occur. Rotation proved near-meaningless here because the parts are radially symmetric — a 15° rotation of a circular impeller looks much the same, and two models improved under it.

5.2 The envelope as a specification

The selected model holds within 4 points of nominal accuracy under ±30% brightness, 0.6× contrast, 15° rotation, 25 px translation and JPEG q=30. It degrades severely under Gaussian noise (−26 points at σ=10) and heavy blur (−23 points at k=11). Sensor noise and focus stability are the binding constraints and must be monitored.

Gate: a stated envelope, measured, not asserted.


Part 6 — Failure direction

The requirement most often absent, and the one that determined deployability here.

6.1 The measurement

Under Gaussian noise σ=10, with comparable accuracy:

Model Accuracy FN (defects shipped) FP (good scrapped) Cost
Frozen, imagenet norm 89.37% 72 4 £37,985
Frozen, per-image norm 68.81% 223 0 £112,650
Fine-tuned 72.73% 0 195 £6,165

The fine-tuned model fails safe. The frozen models fail dangerous. 28× cost difference at comparable accuracy.

The pattern held across degradations: under blur k=11 the fine-tuned model produced 0 false negatives and 173 false positives, while the frozen models shipped 21–41 defects.

6.2 Preprocessing can invert failure direction

A per-image normalisation applied to the classical pipeline fixed brightness sensitivity and reversed its failure direction under blur:

FN FP Cost
Classical, raw features, blur k=5 2 35 £3,955
Classical, normalised, blur k=5 40 3 £22,125

Accuracy moved less than one point. Cost rose 5.6×. Failure direction is a property of the whole pipeline, not of the architecture, and a preprocessing change can invert it.

6.3 Requirement

Failure direction shall be specified and tested, not discovered in production.

Under every perturbation in the robustness suite, the system shall degrade toward false positives (over-rejection) rather than false negatives (escapes). Where this cannot be achieved, the escape rate under each perturbation shall be stated, and an upstream monitor shall detect the condition and halt automated disposition.

Part 7 — Architecture: two independent channels

No single model won across the perturbation suite, and the reason appears structural.

The features that confer brightness invariance are local, relative and small-scale. Those are precisely the features that noise and blur destroy. Absolute global statistics are brightness-fragile and noise-robust; local residual statistics are brightness-robust and noise-fragile. One feature set cannot be both.

Approach Best at Worst at
Classical, absolute features noise, rotation, translation, JPEG brightness, contrast
Classical, normalised nominal, brightness, contrast noise, translation, blur
CNN, fine-tuned brightness, contrast, blur noise, nominal

7.1 Measured benefit

Configuration Mean cost across suite
Best single model £6,813
Two channels (classical normalised + fine-tuned CNN) £5,231
Five-model oracle £4,618

23% better than the best single model, with two channels capturing most of the oracle's benefit.

7.2 Implementation

Routing is feasible because the conditions are measurable from the image itself — noise level, mean intensity and contrast are computable per frame.

Two options, and the second is simpler and arguably better:

Conditional routing. Monitor per-frame statistics; route to the channel validated for those conditions.

Disagreement escalation. Run both channels. Where they agree, accept. Where they disagree, escalate to human review. The channels rarely fail together — at σ=25 one was 17 points better; at brightness ×1.3 the other was 55 points better — so disagreement is a strong signal that conditions have left the validated envelope. That is more valuable than either prediction.

Requirement: a two-channel architecture with independent failure modes, and disagreement treated as an escalation condition rather than resolved by voting.


Part 8 — Monitoring and revalidation

Monitor Threshold Action
Per-frame noise estimate σ > 5 alert; halt automated disposition above σ > 10
Mean frame intensity ±2% CV from nominal alert; investigate illumination
Clipping fraction >0.1% at either bound alert; exposure drifted
Focus proxy (high-frequency energy) −20% from nominal alert; clean or refocus
Channel disagreement rate >2× baseline escalate; conditions outside envelope
Alarm rate beyond cost-optimal ±50% review; defect rate or model has shifted

Monitor the inputs, not only the outputs. A learned model's principal failure mode is distribution shift, which is invisible in its predictions — it returns confident answers on data it was never trained for.

Revalidation triggers: lamp replacement, camera or lens change, fixture modification, material or supplier change, surface-finish process change, and a scheduled interval regardless.


Part 9 — Procurement questions

Nine questions. Each is answerable in a sentence, and each is difficult to answer evasively.

  1. What is your trivial-feature baseline, and what does the model add over it?
  2. What is the measured label error rate of your test set, from a random audit?
  3. What is the deduplicated test accuracy?
  4. What defect rate do your precision figures assume, and what do they become at ours?
  5. Show me the accuracy-under-perturbation table, including Gaussian noise at σ=10 and σ=25.
  6. Under each perturbation, does the system fail toward escapes or toward over-rejection?
  7. What decision threshold is used, and what cost matrix was it derived from?
  8. What is the operating envelope — illumination range, noise ceiling, focus tolerance, placement tolerance — over which the quoted performance holds?
  9. What monitors the inputs, and what happens when conditions leave the envelope?

A vendor who can answer all nine has done the work. A vendor who answers only with accuracy figures has not.


Key lessons

1. Look at the images before modelling, and measure your own accuracy on them. A human scoring 20/20 cold means the task is easy and the business case must rest on throughput, consistency or coverage — not on accuracy.

2. Establish the trivial baseline. Four global statistics reached 85.6% against a majority class of 63.4%, capturing 63% of the total available improvement.

3. Diagnose class differences in global statistics before training. The two classes differed by 1.9σ in mean brightness. Whether that is a defect signal or a capture confound is distinguishable: if the illuminated surface differs as much as the dark regions, the effect is global rather than defect-localised.

4. Test the shortcut hypothesis directly. Train with and without per-image standardisation. Here the gap was 0.14 points — one image — so the model was reading local structure, not brightness. A negative result worth having before deployment.

5. Calibrate similarity thresholds against comparison-set size. The maximum over N comparisons grows with N. The same threshold removed 14% of a test set against 800 candidates and 67.6% against 6,633.

6. Monitoring training against the test set is leakage. Carve a validation split out of training data.

7. At small n, data quantity dominates every modelling choice. With 80 samples: more data improved validation loss 4.2×, weight decay did nothing, and simplifying the model made it worse.

8. Report percentage-point gain and error-rate reduction. +13.1 points and 11.4× are the same result and support opposite conclusions.

9. Compare models at their operating points, not at a default. The ranking reversed. Threshold selection was worth 2.2× model selection.

10. The default threshold of 0.5 is optimal for nothing — not cost, and on imbalanced data not accuracy either.

11. Precision is a function of the production defect rate. A balanced benchmark understated the false-alarm burden by roughly 90×.

12. Review errors, then audit a random sample. Error-only review finds label errors the model disagreed with and misses those it agreed with — a lower bound, not an estimate.

13. A model scoring above the annotation ceiling is fitting label noise. That warrants scrutiny, not celebration.

14. Sensor noise is the most damaging and least tested perturbation. All models fell to or below the majority baseline at σ=25.

15. Failure direction matters more than failure rate, and it is a property of the whole pipeline. A preprocessing change inverted it.

16. Clipping is unrecoverable. Affine degradations invert exactly under per-image standardisation; a saturated highlight does not. Recovery was capped at 84% where ×1.3 brightening clipped.

17. Verify a transform with an invariant. Skewness is affine-invariant, so seeing it unchanged to three decimals while scale-dependent statistics moved proved the normalisation was implemented correctly.

18. Repeatability and discriminative power are different properties. The metric with the worst repeatability (32.8% CV) was the strongest classifier feature here.

19. Robustness trades against robustness. Brightness-invariant features are noise-fragile by construction. No single feature set is robust to everything — which is the argument for independent channels.

20. Attempt classical methods first where they might work. Seventeen hand-engineered features reached 99.86%, beat every deep model on nominal accuracy, trained in seconds, and are explainable to an auditor.


Glossary

Transfer learning

Transfer learning — using a model trained on one large dataset as the starting point for a different task. Standard practice for industrial vision, where labelled data is scarce.

Pretrained backbone — the convolutional layers of a network trained on a large general dataset such as ImageNet. A learned, general-purpose image description.

Feature extraction (linear probe) — running images through a frozen backbone once, caching the output vectors, and training a small classifier on them. Fastest route on limited hardware: the expensive computation runs once. Makes the concept explicit — a pretrained network is a feature extractor.

Frozen backbone — backbone weights held fixed; only the classifier head is trained. Fast, data-hungry, saturates early.

Fine-tuning — updating backbone weights as well as the head. More compute, more data-efficient, and here it changed the failure direction favourably.

Progressive unfreezing — unfreezing layers in stages from the output backwards. Head only 98.18%, plus last block 98.74%, entire network 99.86%, roughly doubling compute per step.

Weight variant pinning — specifying the exact pretrained weights (resnet18.a1_in1k) rather than a generic name. Library defaults change between versions, silently altering results.

Normalisation

ImageNet normalisation — subtracting fixed per-channel means and dividing by fixed standard deviations. Preserves global brightness as an available signal.

Per-image standardisation — subtracting each image's own mean and dividing by its own standard deviation. Removes global brightness and contrast exactly, provided no clipping occurred. The clean way to test whether a model depends on them.

Flat-field correction — subtracting a heavily blurred copy to remove illumination gradient. Leaves surface relief alone.

Clipping — pixels recorded at 0 or 255 where the true value fell outside range. A censored measurement; no normalisation recovers it.

Evaluation

Trivial-feature baseline — a classifier on a handful of global image statistics. The honest reference point for any deep-learning claim.

Annotation ceiling — the maximum measurable accuracy, set by the label error rate. A model scoring above it is fitting label noise.

Label noise — the proportion of incorrectly labelled examples. The classification equivalent of measurement repeatability, and the ceiling on measurable performance.

Near-duplicate leakage — highly similar images distributed across a train/test split. Inflates accuracy. Detected by similarity search, with the threshold calibrated against comparison-set size and a within-training null.

Deduplicated test accuracy — accuracy on test images with no near-duplicate in training. Should be reported alongside the full figure.

Validation split — data held out of training to monitor progress and select epochs. Must come from training data; using the test set for this is leakage.

Overfitting — fitting training data at the expense of generalisation. Signature: training loss falling while validation loss rises.

Operating point

Decision threshold — the probability above which a part is called defective. This is the inspection policy. The software default of 0.5 is a convention, not a choice.

Cost matrix — monetary cost assigned to each of true/false positive/negative. Converts a statistical model into a business decision.

Zero-escape operating point — the threshold at which no defects are missed. The fair comparison for safety-relevant inspection: how few false positives does each candidate need to catch everything?

Base rate — the true defect frequency in production. Determines precision. A model's rates transfer between datasets; its precision does not.

Usable defect-rate floor — the lowest production defect rate at which a model sustains a given precision. An operating-envelope figure.

Alarm fatigue — deterioration of operator attention under predominantly false alarms. Reduces effective detection toward zero while measured recall is unchanged.

Precision floor — minimum acceptable ratio of true to false alarms. Belongs in the requirement, not the tuning phase.

Robustness

Robustness envelope — the range of imaging conditions over which quoted performance holds. A performance figure without an envelope is not a specification.

Perturbation suite — systematic degradations applied to validation images to measure robustness. Applied to the raw image before pipeline normalisation, matching physical reality.

Failure direction — whether a degrading system errs toward escapes or over-rejection. More consequential than failure rate, and a property of the whole pipeline.

Fail-safe / fail-dangerous — degrading toward false positives versus false negatives. Observed 28× cost difference at comparable accuracy.

Distribution shift — input data moving away from training conditions. The principal failure mode of deployed models, invisible in outputs. Requires input monitoring.

Data efficiency — accuracy achieved per labelled image. The relevant metric where annotation is the dominant cost.

Architecture

Two-channel architecture — two independent inspection systems with complementary failure modes. 23% cheaper than the best single model across the perturbation suite.

Disagreement escalation — routing cases where channels disagree to human review. Disagreement signals that conditions have left the validated envelope, which is more informative than either prediction.

Conditional routing — selecting a channel per frame based on measured image statistics. Feasible because noise, brightness and contrast are computable from the image itself.

Show Comments