Machine vision for defect detection works when a defect produces contrast that a camera records reliably under the lighting, part variation and hardware the line will actually run with. Whether it will work on your parts can be tested before anyone trains a model. Run a small controlled trial that sweeps illumination geometry, wavelength and exposure over a labelled sample of real defects. Measure how cleanly defective and good parts separate, and judge the result against a go/no-go criterion written down before the trial starts. Then show that the separation survives normal variation, with a repeatability study in the spirit of a gauge R&R. A bench demo proves neither of these things.
How machine vision for defect detection works on a production line
A typical automated optical inspection (AOI) system has three parts: image acquisition, image processing and an output device. A dedicated illumination source lights the part, a camera collects the reflected light, software analyses the image, and the system outputs defect locations and types for sorting. Vision measurements rest on pixels, and what a pixel means depends on sensor resolution, field of view, presentation angle, lighting and optical quality.
Three things decide whether it will work on your parts. First, the defect has to create contrast against its background under some achievable lighting setup. Second, that contrast has to hold up as parts, fixtures and ambient light vary. Third, the detector has to give the same verdict from shift to shift and from day to day. A practical lighting guide from Advanced Illumination describes the first two as acceptance criteria: maximise contrast on the features of interest relative to their background, and keep that contrast robust to variation. A learned model does not escape this. A trained model memorises a specific set of pixel correlations, such as lighting, camera angle, background and sensor, and its performance degrades when any of those changes.
Our work on AI engineering for manufacturing and automotive covers how these inspection systems fit into wider plant and vehicle programmes.
Is the defect optically visible at all? Test separability before building a model
Check whether a defect is optically visible by imaging a small labelled set of known defective and known good parts under a deliberately varied set of lighting and optics configurations. Then compute a separability score for each configuration and compare the best score with a threshold you fixed in advance. If no configuration clears the threshold, more model work will not fix the problem. The physics has to change first.
TechnoLynx runs this trial as the opening stage of a Computer Vision R&D engagement. The work is a feasibility-first defect taxonomy study on a small labelled pilot dataset of your parts. That study comes before you commit to a full vision pilot. If your defect classes are not yet written down, see the work on turning inspectors’ knowledge into a feasible, labelled defect dataset.
A useful sanity check comes before any statistics. Cognex’s deep learning documentation advises that defects must be human-distinguishable in the image and that every controllable variable should be held fixed, including lighting, working distance and trigger timing. Advanced Illumination adds a sharper point: judge the image the camera actually captures, not what your eye sees on the part, because human vision differs greatly from a sensor in spectral sensitivity and dynamic range.
Which illumination geometry separates our defect classes?
No geometry wins in general. The one that separates your defects depends on surface reflectivity and topography, so the trial has to test several. Advanced Illumination groups the levers into four contrast concepts: geometry (the spatial relationship among part, light and camera), structure or pattern of the projected light, wavelength, and filters. On specular surfaces geometry and structure matter more. Wavelength and filtering matter more for colour and transparency problems.
Here is what each family of geometries does, in practice:
- Bright-field and coaxial lighting centres the light on the camera’s optical axis. Diffuse full bright-field setups tend to need fixed alignment between light and camera, which limits how far you can move components around during the trial.
- Dark-field and low-angle raking light relies on the fact that a specular surface reflects light at the angle of incidence, a property dark-field lighting puts to use.
- Structured light projects fringe patterns. Experiments on scratches in a glass plate found that the detected signal depends on how the defect is oriented relative to the fringes, and that merging two perpendicular fringe directions recovered defects that either direction alone missed.
- Polarisation treats glare from your own light source, alongside geometry changes.
- Narrow-band wavelength plus a matched filter can block ambient light. For example, a 660 nm band-pass filter paired with a 660 nm red LED blocks overhead fluorescent or mercury lighting. Near-infrared at 850 nm reduces colour-driven contrast, which helps when colour variation is the nuisance rather than the defect.
Advanced Illumination’s own worked example makes the case for testing broadly. The author expected a diffuse dome to win, and it did not. Benchmarks now include these setups too: the MVTec AD 2 dataset contains dark-field and back-light inspection scenarios alongside transparent objects and very small defects.
Is our current shop lighting good enough to run the trial?
That depends on how much ambient light reaches the part. Ambient light from overhead fixtures, sunlight, stray task lights or a neighbouring cell’s vision lighting can change inspection quality a great deal, especially with white light. Advanced Illumination lists three practical counter-measures: high-power short strobes, physical enclosures and pass filters. Sunlight is strong and broadband enough to cast doubt on any inspection result, which is why the same guide recommends an opaque housing.
Run the trial with controlled lighting, then add ambient light back in as a deliberate test condition. That second step overlaps with the physical site survey. The guide to lighting, fixturing and conveyor conditions for a CV inspection site survey covers what to record on the floor itself.
Designing the trial: angles, filters, exposure and enough labelled samples
The trial has to vary conditions in a structured way. If it does not, a negative result tells you nothing. Use the steps below as a minimum procedure and widen the sweep wherever the part’s surface suggests it.
- Write the go/no-go criteria first. Pilot-study methodology from the Queen Mary University of London (QMUL) pilot and feasibility resource treats progression criteria as pre-specified rules for deciding whether to proceed. It describes a traffic-light scheme: green means proceed, amber means amend, red means stop.
- Size the sample to the question. The same QMUL guidance says sample size should follow from the primary objective and give enough precision around the estimate you need. In biospectroscopy, Beleites et al. (2013) found that 75 to 100 test samples are usually needed to validate a good but imperfect classifier with reasonable precision. With 5 to 25 independent samples per class, random testing uncertainty can mask the learning curve completely. Count independent defective parts, not images of the same part.
- Sweep geometry, wavelength, filters and exposure. Include several geometries where the part allows it, and an exposure short enough to freeze the line’s motion.
- Score separability without a trained model. The distance-based separability index (DSI) measures how mixed two classes are as a property of the data itself, independent of any classifier. Its authors report that a small random subset can cut computation time without significantly changing the result.
- Report uncertainty with every estimate. The QMUL resource gives a worked example: 30 out of 30 correct has a Wilson 95% confidence interval of 88.65% to 100%. A perfect small-sample score is therefore a lower bound well short of perfection.
A go/no-go gate you can hold the trial to
| Outcome | Condition (fixed before the trial) | Next step |
|---|---|---|
| Green | Best configuration clears the separability threshold, and the confidence interval on detection stays above the agreed floor | Fund the pilot on that optics configuration |
| Amber | Separation is clear for some defect classes but not others, or is marginal at the lower confidence bound | Change optics or the defect taxonomy and rerun the weak classes only |
| Red | No configuration in a reasonably broad sweep separates the classes | Stop, or change sensing modality before spending more |
The traffic-light structure comes from pilot-trial practice. The thresholds are yours to set, from the business cost of a missed defect against a false reject.
Three caveats belong in the trial report. A small sample limits precision, so a green result is an imprecise estimate that holds only for the conditions you tested. A controlled bench is not the line: speed and ambient light at full scale may differ. A sweep that is too narrow can miss the configuration that actually separates the classes.
Vary lighting, pose and camera on purpose, and report the drop
Once a configuration passes the gate, the next question is how much performance you lose when conditions move away from the trial setup. The RobustAD benchmark (CVPR workshop, 2025) names the usual culprits as lighting (light type, sunlight, direction, shadows), camera mounting angle and position, and background changes such as a different conveyor belt colour. Its authors focus heavily on lighting. Real changes over a day alter colour temperature and brightness and create shadows, while synthetic lighting perturbations mostly change only brightness and contrast.
RobustAD reports robustness as the Average Relative Drop (ARD): the average loss in performance on shifted target domains relative to the source domain. They advise reading it alongside in-domain performance. In their results every model did well in the source domain and degraded significantly on the target domains. Scale, position and rotation changes caused the worst degradation. Augmentation helped only when it resembled the real variation in nature and extent. MVTec AD 2 likewise ships test scenarios with lighting changes, built specifically to test robustness.
For a feasibility audit, this means each condition you care about becomes a held-out test set. You then report per-condition performance and the relative drop, not one pooled accuracy figure. Variation in the objects counts as well. That means covering each defect type, not one archetype, plus site conditions such as fluorescent flicker, airborne particulates and a camera mount that someone moves slightly.
Can a lightweight model see pallet damage below 50 lux, or does the dock need lighting first?
Nobody can answer that without testing at the dock’s real light and humidity levels. A feasibility result obtained under standard inspection lighting does not carry over to a dark, condensation-prone cold store. Visible-spectrum cameras are vulnerable to extremes of darkness and brightness. Freezing motion on moving loads needs short exposures, which is where strobe overdrive gives a brighter image.
TechnoLynx’s part here is a feasibility-first defect taxonomy study on a small labelled pilot set captured at the site’s actual light and humidity levels.
What minimum lux does the system need?
The answer has to be measured at the dock itself. Run the separability trial at the dock’s ambient level, then add supplemental lighting in steps and watch for the level at which detection clears your threshold. Record light as illuminance or irradiance at the working distance, and compare sources only in the same units at the same distance. Otherwise a lux number on a specification sheet means little. If detection only clears the threshold with added light, install the lighting before deployment rather than hoping the model will cope.
Condensation is a separate problem from light level. Fogged optics need their own fix, whatever the lux. Results from one dock’s light and humidity profile may also not hold at another cold-storage site.
Has anyone validated this under conditions this dark and humid?
RobustAD, an industrial benchmark, covers PCBs, metal parts and piles of packets under six real-world distribution shifts. It is not a cold-store benchmark, so treat a lightweight model at a dark, humid dock as unvalidated until your own trial says otherwise.
Do our fleet logs actually cover fog, flare and occlusion?
Mileage is not coverage. Two million kilometres of logs show coverage only once you have tagged clips by condition and counted the independent labelled events in each bin. A bin with a handful of events has wide confidence bounds, for the same small-sample reasons described above. Quantifying perception scenario coverage against ISO 21448 is a scenario-based robustness audit in its own right, outside this feasibility trial.
Running a gauge R&R style repeatability study on the detector
Repeatability is the second half of feasibility. A detector that separates defects once but gives a different verdict on the same part tomorrow is not usable. Vision Systems Design describes Measurement Systems Analysis (Type I gauge studies and gauge R&R) as the de facto standard in manufacturing quality control, and as especially relevant to machine vision.
The protocol runs in a fixed order:
- Calibrate. Map pixel coordinates to real-world units using artefacts traceable to national standards, and correct optical and perspective distortion before pixel calibration.
- Type I study. One operator performs at least 30 inspections on a single calibration artefact for each attribute, which establishes the system’s bias and capability.
- Gauge R&R. Typically three measurements on at least 10 different parts by three operators. This separates repeatability (one system, same operator, same part) from reproducibility (the variation between operators’ averages).
For a detector that classifies rather than measures, we would map “operators” to the things that actually vary in production: camera units, lighting fixtures, shifts and re-mounts. We would report recall and precision per condition, not just a dimension’s variance. Two standards frame acceptance. IPC-9716 sets AOI requirements that include lighting conditions, calibration, detectability, resolution, threshold limits and measurement system analysis. VDI/VDE/VDMA 2632 Part 3 (2017) proposes procedures for assessing classification performance during acceptance of machine vision systems.
Include the lighting hardware in the study. LED forward voltage varies between LEDs of the same model and lot, which can make some LEDs in an illuminator brighter or dimmer than others. LED output also declines with age: an L70 rating of 50,000 hours means the light is about 70% as bright after that time. A detector that passes on a new fixture can drift as the fixture ages, which is why a later check for quietly degraded lighting and optics is a separate, ongoing task. Comparing vision gauging against manual callipers needs its own study design.
When a defect needs thermal, acoustic or X-ray sensing instead of a better camera
Switch modality when the defect lives below the surface, or when no lighting configuration in the trial separates it. A survey of IC defect detection lists four sensing modalities: optical, radiological, acoustical and infrared thermography. It describes AOI as low-cost and fast but unable to detect inner defects. Scanning acoustic microscopy measures properties such as density, thickness and stiffness. Infrared thermography detects defects that change thermal conductivity and therefore the surface temperature distribution. The same survey suggests combining modalities to make detection more robust.
TechnoLynx can run the same feasibility gate on a thermal or other non-visible sensor as part of Computer Vision R&D. The first step is to test whether your existing camera resolves the signature at all before any modelling.
| Signal you need | Visible or NIR camera | Consider instead |
|---|---|---|
| Surface scratch, stain, misplacement | Suitable for surface defects | Not needed |
| Colour variation masking the defect | NIR at 850 nm can suppress colour contrast | Not needed |
| Subsurface void, delamination, debond | Cannot see inner defects | Thermography or acoustic microscopy |
| Operation in near-darkness | Vulnerable at extremes of dark and bright | Thermal, which senses emitted radiation in about the 8 to 14 µm band |
Is the thermal camera’s resolution and frame rate enough to tell a hotspot from noise?
Check three limits before trusting any model on thermal data: thermal sensitivity, spatial resolution and temporal response. Thermal sensitivity is expressed as noise-equivalent temperature difference (NETD), the smallest temperature difference a detector can distinguish from its own noise. AT Sensors puts it at typically 20 to 60 mK for uncooled microbolometers. NETD is a relative figure, not an absolute accuracy, and is comparable only at the same f-number and scene temperature. If the hotspot’s temperature difference is below the noise floor, feasibility is negative whatever the model.
Spatial resolution has a practical rule. A valid radiometric reading needs the feature to cover roughly 3 × 3 pixels, and a single-pixel feature is visible but not measurable. Time matters too. A microbolometer pixel needs 8 to 12 ms to settle, so a target that crosses a pixel faster than that reads blurred and low regardless of frame rate. AT Sensors’ worked example (1.36 mm IFOV, 10 ms time constant) gives a maximum target speed of about 0.14 m/s. Start the specification from the smallest feature and the smallest temperature difference you must detect. Watch emissivity as well: surface finish can change it by a factor of ten on the same metal. In facial thermal imaging, ambient temperature changes altered the images and degraded tracking. A delamination study kept indoor heating and air temperature controlled precisely to get a stable baseline to compare against outdoor results.
One pipeline across three hardware generations, or one per generation?
Test it rather than assume it. Treat each hardware generation as its own target domain and report the relative drop against the shared-pipeline baseline, the same way RobustAD reports drops. If one generation diverges clearly, split it out. Before blaming the model, check sensor calibration.
How many labelled samples before we can call it feasible?
Enough to put a usable confidence interval on the result. Beleites et al. (2013) give 75 to 100 test samples as the usual requirement for validating a good but not perfect classifier. The defect taxonomy changes the answer. A coarse taxonomy can look feasible where a finer one is not, so fix the classes before counting.
Can our data science team build a production detector without optics expertise?
It can build a model. Whether that model survives the line depends on optics and data work that model skill does not replace. Our position is that the first check in any computer vision engagement is the quality and quantity of the data, access to the processes that generate more of it, and expectations. Near-100% accuracy is almost never plausible, so the workflow needs fault tolerance and room for a human in the loop. Landing AI published an illustration: on steel defect detection, a data-centric approach raised accuracy from a 76.2% baseline to 93.1%, while a model-centric approach left it unchanged.
Cognex’s documentation warns that if lighting or optics change after training, the tool keeps basing its decisions on the original setup and fails in production. ThirdEye Data gives the shop-floor version: replace a bulb or change lubricant brand, and a model trained on one line can lose the ability to find defects. ThirdEye Data recommends shadow mode before go-live, comparing predictions against on-site ground truth, to confront the demo-versus-production accuracy gap. After launch, recalibrating thresholds after a camera or lighting change is its own operational problem.
Who can run a defect feasibility trial before we commit to a vision pilot?
TechnoLynx runs the optics and lighting feasibility trial, the separability gate and the repeatability study described here, so you know whether a defect can be detected on your parts before you fund a pilot. On build versus buy: your data science team can own the model, and we bring the optics, measurement and validation side. When choosing a partner, ask to see the pre-registered gate, per-condition results with confidence intervals, and a repeatability report, not a demo video. TechnoLynx delivers this work within its Computer Vision R&D offer, starting with a scoping session on your defect classes and samples.
This is not the right engagement if you need a certified turnkey AOI machine from a line equipment vendor, or a measurement sign-off that only an accredited metrology body can give. If your defects are already well characterised and plentiful labelled data exists, a capable in-house team with a standard AOI platform may not need a feasibility study at all.
FAQ
Is machine vision a type of AI?
Not necessarily. Machine vision covers rule-based image processing as well as learned models, and many AOI systems still run conventional algorithms. Deep learning is one way of doing the image-processing stage.
What’s the difference between infrared and thermal cameras?
Near-infrared imaging, for example at 850 nm, uses reflected light, and the reflection depends more on composition and texture than on visible colour. Thermal cameras sense radiation emitted in roughly the 8 to 14 µm band and turn it into temperatures.