Position
Most failed industrial vision projects failed at the lighting rig, not the model.
Capital allocation in a vision pilot should reflect this. Optics, illumination and exposure control deserve a larger share of the budget than the software, and the sequence matters: lighting first, then algorithm, then model. A model cannot recover information the camera never captured.
A second position, which follows from the same evidence: classical computer vision should be attempted before deep learning on any geometrically defined inspection problem. It is auditable, needs no training data, runs in milliseconds on a CPU, and — critically — its failure modes are legible. When it fails, you know why.
1. The decision
| Use classical CV when | Use deep learning when |
|---|---|
| The defect is geometrically defined — hole, crack, edge, dimension, count | Defects are textural, variable, or appearance-based |
| Contrast can be controlled through lighting and optics | Defect types cannot be enumerated in advance |
| Features are countable or measurable | Appearance varies with material lot, finish or colour |
| An auditable, explainable rule is required | Human experts disagree on borderline cases |
| Training images are scarce or defects are rare | Hundreds to thousands of labelled examples exist |
| Latency budget is very tight | A GPU is available, or latency is relaxed |
| The measurement must be traceable to physical units | Classification, not measurement, is the output |
The honest additions
Classical CV requires more domain expertise, not less. Every parameter — blur kernel, threshold offset, neighbourhood size, minimum area — must be justified. Deep learning absorbs these decisions into training, which is convenient and also means nobody can explain them afterwards.
Deep learning does not remove the lighting requirement. It shifts it. A trained model is at least as sensitive to illumination change as a threshold is; it simply fails less visibly. A classical pipeline under bad lighting produces obviously wrong measurements. A network under bad lighting produces confident wrong classifications.
A hybrid is frequently the right answer. Classical methods for the measurable, learned methods for the unenumerable, on the same images.
2. The capital-allocation argument
Measured evidence
For example, assuming that a variance analysis gives:
| Variance source | Contribution to measurement variance |
|---|---|
| Lighting degradation | 94% |
| Imaging chain (camera, sensor, algorithm) | 6% |
| Fixturing | 0% |
Consistent to within 0.3 percentage points across two independent metrics — one parametric and threshold-based, one threshold-free.
Degraded imaging produced four times the measurement variance of controlled imaging, and no combination of blur kernel, threshold offset or minimum area recovered it. Parameter tuning traded one failure mode for another; it did not restore performance.
Implication for a pilot budget
Indicative allocation for an inspection pilot, derived from the above:
| Element | Priority | Rationale |
|---|---|---|
| Lighting — geometry, diffusion, intensity, stability | Highest | 94% of variance |
| Optics — lens, working distance, resolution at the object | Highest | Determines what is detectable at all |
| Exposure control — fixed, no auto-exposure, no HDR | High | Computational photography actively destroys measurement data |
| Enclosure and ambient light exclusion | High | Protects the 94% |
| Camera body and sensor | Medium | Resolution matters; marginal sensor quality rarely does |
| Fixturing and jigs | Lower than assumed | 0% measured contribution for a global metric |
| Algorithm and model development | Lower than assumed | Cannot compensate for the above |
The fixturing result carries an important caveat. It was measured for a global texture metric computed over a region of interest, which is inherently tolerant of small translations and rotations. A metric requiring feature-level correspondence — dimensional measurement, position verification, registration against a reference — would show a substantial fixturing contribution. Metric choice determines fixturing requirement, and the two should be specified together.
3. Screening tests before any software discussion
Resolution test
px_per_mm = pixels_measured / mm_actual
smallest_detectable = 3 / px_per_mm
A feature needs 3–5 pixels across its smallest dimension. If the defect of interest spans fewer than three, no algorithm will find it reliably. The answer is a different lens, a shorter working distance, or a higher-resolution sensor — not a better model.
This calculation costs two minutes and settles feasibility before a vendor conversation begins.
Separation test
Within the region being inspected, compute the gap between feature and surface intensity divided by the local noise:
| Separation / noise | Verdict |
|---|---|
| Above 2 | Comfortable; thresholding will work |
| 1 to 2 | Marginal; adaptive methods may cope, fragile |
| Below 1 | Feature and background overlap. Change the lighting geometry, not the algorithm. |
Plateau test
Sweep the principal parameter and plot the metric. If it does not plateau, the reported value is a property of the parameter rather than of the object. Either define the measurement operationally and publish the procedure, or choose a metric with no free parameter.
Clipping test
Verify 0.00% of pixels at intensity 0 and 255. A clipped pixel is a censored measurement — the true value exceeded what the sensor could record, and no processing recovers it.
4. How each approach fails
Knowing the failure signature matters more than knowing the success rate, because the failure is what you will be managing.
Classical CV fails visibly
Lighting changes, thresholds no longer separate, measurements shift or collapse. The output is obviously wrong, and the cause is traceable to a specific stage. Repair is a lighting fix or a parameter change, and the effect of either can be measured directly.
Deep learning fails invisibly
Lighting changes, the input moves outside the training distribution, and the model returns confident classifications that are wrong. There is no stage to inspect and no parameter to adjust. Detection requires monitoring input distributions rather than outputs.
This asymmetry is the strongest argument for attempting classical methods first on any problem where they might work. A system whose failures announce themselves is cheaper to operate than one whose failures must be hunted.
Both fail at alarm fatigue
A system producing predominantly false alarms is ignored within weeks, whichever technology underlies it. Effective detection rate collapses while the measured rate stays unchanged. Precision floors and alarm-rate caps belong in the specification, not in the tuning phase.
5. Procurement implications
Demand a repeatability figure. An inspection system without a gauge R&R number is a demonstration, not an instrument. Ask for the CV on repeated measurement of an unchanged part, and separately with the part removed and replaced.
Demand the imaging specification, not the algorithm specification. Illumination stability, resolution at the object plane, clipping policy, exposure lock. These determine performance; the algorithm is downstream.
Demand the operating envelope. Under what illumination range, working distance tolerance and ambient conditions does the quoted performance hold? A figure quoted without conditions is not a specification.
Ask what happens when the lamp ages. Lamps lose output progressively. The answer should be a monitoring and recalibration plan, not reassurance.
Ask whether any reported metric is threshold-dependent, and if so, what the plateau test showed. A "porosity" or "defect area" figure from a thresholded image may be an artefact of a parameter choice rather than a measurement of the part.
Ask whether the vendor validated against an independent measurement. Repeatability is necessary and insufficient. A consistently wrong measurement is still consistent.
Key lessons
1. If lighting is 94% of the problem, measured rather than asserted, budget and sequence accordingly: lighting, optics, exposure, then algorithm.
2. Resolution feasibility precedes everything. Three to five pixels across the smallest defect. If that fails, no software decision matters.
3. Attempt classical methods first where they might work. Auditable, no training data, millisecond latency, legible failures.
4. Deep learning shifts the lighting requirement rather than removing it. It fails less visibly, which is worse, not better.
5. Failure visibility is a procurement criterion. A system whose failures announce themselves is cheaper to operate than one whose failures must be detected.
6. Metric choice determines fixturing requirement. Global statistics tolerate repositioning; feature-level correspondence does not. Specify the two together.
7. A system without a repeatability figure is a demonstration. Demand gauge R&R, with and without part replacement.
8. Demand the operating envelope with any performance claim. A number without conditions is not a specification.
9. Validity requires an independent measurement. Repeatability establishes precision only. Cross-check against a physical property measured by other means.
10. Computational photography is hostile to measurement. HDR, auto-exposure, tone mapping and scene optimisation all compress or alter the data. Lock exposure, disable enhancement, use RAW where available.
Glossary
Decision framework
Classical computer vision — inspection by explicit image operations: filtering, thresholding, morphology, geometric measurement. Deterministic, auditable, needs no training data.
Deep learning (for vision) — inspection by a neural network trained on labelled examples. Handles appearance-based and unenumerable defects; requires data and hides its reasoning.
Anomaly detection — identifying deviation from normal without examples of the abnormal. Trained on good parts only, which changes the data prerequisite from months of defect collection to a week of photographing good parts. Covered in Week 12.
Hybrid approach — classical measurement combined with learned classification on the same images. Frequently the correct answer: measure what is measurable, learn what is not.
Imaging specification
Resolution at the object plane (px/mm) — image resolution referred to the part, not the sensor. The figure that determines detectability. A 20 MP sensor at the wrong working distance resolves less than a 5 MP sensor at the right one.
Working distance — camera-to-object separation. Sets magnification and therefore px/mm. Any change invalidates prior calibration.
Illumination geometry — the spatial arrangement of light relative to surface and camera. Matters more than light quantity. Backlight for holes and edges, grazing light for surface texture, dome or diffuse for colour and contrast, dark-field for scratches.
Illumination stability — frame-to-frame consistency of light output, expressed as CV of mean image intensity. A directly measurable specification item. ±1.5% is achievable with fixed lamps.
Exposure lock — disabling automatic exposure adjustment. Mandatory. Auto-exposure re-meters per frame and injects variation into every measurement.
Computational photography — HDR, tone mapping, scene recognition and automatic enhancement in consumer cameras. Optimises for visual appeal by compressing dynamic range. Actively destroys measurement data; must be disabled.
Operating envelope — the range of conditions over which quoted performance holds. A performance figure without an envelope is not a specification.
Measurement quality
Gauge R&R — a study quantifying measurement system variation by repeated measurement of unchanged parts. The minimum evidence that an inspection system is an instrument rather than a demonstration.
Repeatability — variation on repeated measurement under identical conditions. Isolates the measurement chain.
Reproducibility — variation when conditions change: operator, part placement, time, equipment. What production actually experiences.
Coefficient of variation (CV) — standard deviation as a percentage of the mean. Permits comparison across metrics with different units.
Variance decomposition — attributing total variance to independent sources. Converts a repeatability study into a capital-allocation argument.
Precision versus validity — repeatable versus measuring the intended quantity. Independent properties. A consistently wrong measurement is still consistent.
Operational definition — a measurement defined by its procedure rather than an absolute quantity. Legitimate where the procedure is published with the number and results are never compared across procedures.
Deployment
Alarm rate — the proportion of parts flagged. Constrained by available inspection or disposition capacity.
Alarm fatigue — deterioration of operator attention when a system produces predominantly false alarms. Reduces effective detection toward zero while the measured rate is unaffected. A specification concern, not a tuning concern.
Precision floor — a minimum acceptable ratio of true to false alarms, set to avoid alarm fatigue. Belongs in the requirement, not the tuning phase.
Distribution shift — input data moving away from the conditions a model was trained on. The principal failure mode of deployed vision models, and invisible in the outputs. Requires monitoring the inputs.
Latency budget — time available per part for capture, transfer and inference. Derived from line speed. A policy that is optimal on a spreadsheet and too slow for the line is not optimal.
Revalidation — periodic re-measurement against reference standards to detect drift. Lamps age, lenses accumulate contamination, fixtures shift. The plan should exist before deployment.