The model finds the scratch on day shift and misses it after dark
In short
Detection accuracy that changes between shifts is a lighting fault, not a model fault, and one test proves it in an hour: re-score archived images from the good shift on the machine that is failing now. A model is deterministic, so if the old images still score correctly while live captures of the same part do not, nothing about the model changed and everything about the light did.
Key takeaways
- Re-score archived images before retraining. An unchanged score on old images clears the model completely.
- Ambient light does not brighten a defect, it raises the floor underneath it and destroys the contrast.
- A scratch is visible because light grazes it. Fill light from a skylight is the exact opposite of that.
- Log the mean grey level of a fixed background patch on every image. The plot names the fault by its shape.
- Time-of-day variation is optics; frame-to-frame variation is exposure or strobe. Different pages, different fixes.
A detection rate that follows the clock is telling you the input changed, not the judgement. The model is a fixed function: feed it the same pixels and it returns the same number, today, tonight and next March. So before anyone opens the training set, take a few hundred archived images from the shift where the system works, push them through the machine that is currently failing, and compare the scores against what was recorded at the time. If they match, the model is exonerated and the investigation moves to the thing between the part and the sensor.
That leaves one question: what is different about the light after dark, or at eleven in the morning, or on the days the dock door is open. Almost always it is one of five things, and each leaves a different signature in the image statistics you are probably already storing and not plotting.
The test that separates optics from the model in one production day
- Pick one part number that runs on both shifts in reasonable volume. Mixing part numbers ruins the comparison before it starts.
- Pull 100 images of it from the good shift and 100 from the bad one, with their recorded scores and dispositions.
- For every image, compute the mean and standard deviation of grey level in a fixed region of background — a patch of the fixture or the belt that contains no part. This is your illumination proxy and it costs a few lines of code.
- Plot those two statistics against capture time across 48 hours. A daylight fault shows a smooth hump; a task lamp shows a square wave; lamp ageing shows nothing at this timescale at all.
- Re-score the good-shift images now, on the live machine. Unchanged scores mean the model is fixed and the input is not.
- If the image statistics are indistinguishable between shifts and the scores still differ, stop reading this page — you have a model or threshold problem, and the anomaly score and the threshold on a running line is the right place to go.
Why a scratch needs grazing light, and why fill light erases it
A fine surface defect is not darker or brighter than the material around it in any absolute sense. It becomes visible because it scatters light differently from the surface it sits in, and a station designed to find one puts a lamp at a low angle so that most light skims past the sensor and only the scattered light from the flaw reaches it. The defect appears as a bright line on a dark field. It is a contrast trick, and it is fragile in one specific direction.
This is why the instinct to add more light makes the station worse, and why a night shift with the overhead bays switched on can be harder than a night shift in the dark. It also explains a pattern people find baffling: the system starts passing subtle defects while still catching gross ones. A 3-millimetre dent survives the contrast loss; a 40-micrometre scratch does not. Measure the two conditions with a lux meter held at the part position and the ratio is often 5 to 1 or worse between a shrouded station and the same station with a roof light overhead at noon.
Five faults with a time-of-day signature
| Fault | Signature in the background statistic | Check | Fix |
|---|---|---|---|
| Daylight through a roof light or open dock door | Smooth hump peaking at the same clock time, weaker on overcast days | Log a lux reading at the part position hourly for 48 hours; open and close the door deliberately | Shroud the station; the enclosure is the fix, not a model change |
| Lamp output decaying with hours | Slow decline over months, with a step up when a lamp is replaced | Read the lamp hour count; plot the background mean over the last quarter | Scheduled replacement on hours, plus a background-level alarm |
| Shroud or curtain removed, damaged or left open | Step change at a datable moment, then stable at the new level | Compare a photograph of the station against the commissioning photograph | Refit; add an interlock or a visible mark so an open panel is obvious |
| An operator's task light near the station | Square wave that appears and disappears with one person's shift | Look for a second specular highlight in the image; walk the station on that shift | Give the operator the light they actually need, outside the enclosure |
| A new tote, tray or belt colour reflecting into the field | Step change traced to a packaging or housekeeping change, often colour-selective | Diff the background patch before and after; put the old tote back for 20 parts | Return to the old material, or matt-black the reflecting surface |
One signature does not belong on this table. If the variation is frame to frame rather than hour to hour — one image bright, the next dim, on the same parts inside a minute — you are looking at exposure timing against a light source that ripples with the mains supply, or at a strobe firing out of step with the trigger. A 200-microsecond exposure under lighting fed from a 50 Hz supply samples a different point of a 100 Hz brightness ripple on every frame, which reads as random noise and is not. That is acquisition, and it is covered in trigger and encoder faults that look like model faults.
The model did not get worse after dark. It received a different picture of the same part and answered the question it was actually asked, which is the one thing a model can be relied upon to do.
The decision tree, ending in steel or in a retrain
- Do archived images re-score as they did before? No — the model or its runtime changed, and this page does not apply. Yes — continue.
- Does the background statistic differ between the good and bad periods? No — the problem is in the part or the fixture, not the light; check presentation and handling. Yes — continue.
- Is the difference a smooth daily curve? Shroud the station and re-test over 48 hours before anything else is considered.
- Is it a step change? Find the date, then find what was done that day. Maintenance logs, packaging changes and housekeeping are all more likely than a software release.
- Is it a slow drift over months? Lamp ageing. Replace on hours, and set an alarm on the background statistic so the next decay is caught at 10 percent rather than at the point of failure.
- Fixed the light and still missing defects? Now retrain — but retrain on images captured under the corrected lighting, and treat the old set as a different domain rather than more data.
That last step is the one worth arguing about. Retraining on images from a broken lighting condition teaches the model to tolerate the fault, which sounds robust and is not: it widens the definition of normal until genuine defects fit inside it. The result is fewer false rejects and more escapes, and escapes are found by the customer rather than by you — the investigation described in tracing an escape backwards.
Instrument the station so this is never an argument again
- Store the background statistic with every image. Two numbers per part, indexed and plottable, turn a three-week argument into a chart.
- Alarm on illumination, not just on rejects. A background mean outside a stated band should stop the line or flag the batch before the reject rate tells you.
- Keep a commissioning photograph of the station from four angles, dated. It is the cheapest configuration management you will ever do, and it settles the 'nothing has changed' conversation.
- Count lamp hours and replace on a schedule, the way you would a filter. Waiting for visible dimming means waiting until output has fallen far enough for a human to notice, which is far past the point the camera noticed.
- Run acceptance across every shift and every weather condition you can get, not across one good week — the argument for a genuinely long parallel run made in a four-week parallel run modelled end to end.
- Watch the false reject rate on both shifts separately. A single fleet-wide figure averages the good shift and the bad one into a number that describes neither, as the false reject rate the line actually feels sets out.
One rival explanation is worth ruling out before you commit to optics: if the change coincides with a coil, resin or component changeover rather than with the clock, the variable is the material and not the light, and the checks are different — rejects doubling the morning a new lot goes on covers that path. It is also worth confirming the station is not simply out of time budget after a speed change, since shortening exposure to control blur is a common and invisible way to lose light, which sits in it keeps up on the bench and falls behind at line speed.
Getting the enclosure, the logging and the alarms right is unglamorous and it is most of the difference between an inspection cell that survives a year and one that gets switched off in month three. It is also the sort of scope we would rather size honestly up front than discover later, which is how we approach product builds of this shape. The neighbouring decisions — thresholds, defect classes, acceptance — sit together in visual inspection and defect detection, part of our manufacturing and industrial vision work.
Frequently asked questions
Short answers to the follow-ups this page tends to raise.
Why does a vision inspection system work in the morning and fail at night?
Because the light reaching the part changed and the model did not. Daylight from a roof light or an open door adds an even wash across the frame, which raises the background level under a defect and cuts the contrast the station was designed around. Prove it by re-scoring archived morning images on the failing machine: identical scores mean the model is unchanged and the optics are the variable.
Will adding more light to the inspection station help?
Usually the opposite. Defect visibility comes from the difference between the flaw and its surroundings, not from absolute brightness, and general fill light raises both equally. The lighting that finds a scratch is directional and low-angle, and the way to protect it is to exclude stray light with an enclosure rather than to overwhelm it with more.
Should we retrain the model on images from both shifts?
Not until the lighting is fixed. Training on images from a faulty condition teaches the model that the faulty condition is normal, which widens the accept band and converts false rejects into escapes. Correct the light first, then retrain on images captured under the corrected condition and treat the old images as a separate domain rather than extra data.
How do we tell a lighting problem from a material problem?
By what the change tracks. A lighting fault correlates with the clock, the weather or a maintenance date; a material fault correlates with a goods-receipt event and appears the moment a new coil, resin or component batch goes on. Overlay reject rate against both timelines — time of day and lot changeover — and only one of them will line up.
- machine vision
- lighting
- inspection
- troubleshooting
The work behind this page
Builds from our portfolio that this page draws on.
Open Vision PPE Monitoring
Boundary surveillance, PPE compliance monitoring, and intrusion detection via real-time video analytics. Runs fully on-premise — no cloud required.
Safety & ComplianceFactory OS
Production planning and task management for a tier-1 apparel manufacturer — replacing Excel with automated milestone planning, SOP gate enforcement, and real-time visibility.
ManufacturingRead next
- The camera passed it and the customer found it: tracing an escape backwardsMost escape investigations start by retraining a model that never saw the surface in question. Working backwards through the retrieval chain — part to image to score to disposition — settles which of five very different faults you actually have.diagnostic
- Rejects double the morning a new coil or resin lot goes onA reject spike that starts at a lot changeover is a revalidation problem, not a retraining problem. The overlay takes an hour, and the 30-part retest tells you whether the material got worse or merely got different.diagnostic
- Half a part in frame: trigger and encoder faults that look like the modelStreaked surfaces, clipped parts and duplicated frames are acquisition faults with physical causes and arithmetic answers. Counting triggers against parts for 100 pieces tells you which one you have.diagnostic
- The anomaly score is a ranking; the threshold is a business decisionThe score orders parts by how far they sit from normal. It carries no units, no probability and no severity — which is why the threshold belongs to quality, not to engineering.definition
- False reject rate: what the line feels, not the accuracy on the slideA 1% false reject rate sounds like rounding. At 1,200 parts an hour it is 96 good parts a shift and over an hour of somebody re-checking them.definition
- It keeps up on the bench and falls behind at line speedA cell that is fast on the bench and late on the line has either a latency problem or a throughput problem, and they need opposite fixes. Queue depth over ten minutes tells you which, and a per-part budget tells you where the time went.diagnostic
Working on something in this space?
Tell us where you are in a sentence or two. We'll tell you honestly whether we're the right team, and what a sensible first slice of the work looks like.
Start the conversation