LightingGuide

Lighting for AI vision training: stop retraining your model

Lighting rules that keep AI vision training images identical to production: geometry, intensity headroom, controller stability and a worked example.

LumaSpec Vision11 min read Share on LinkedIn

On this page 10 sections
  1. 01The decision: lock the lighting before you collect data
  2. 02Why trained AI models break when the lighting moves
  3. 03Choose geometry from the feature, not from the algorithm
  4. 04Set intensity for the line's exposure and keep headroom
  5. 05Worked example: matching training brightness to a 2 ms line exposure
  6. 06Drive stability: constant current, strobe and fixed PWM
  7. 07Acceptance numbers to meet before training
  8. 08When the usual answer is wrong
  9. 09Pre-training checklist
  10. 10Questions

An AI vision model rarely fails on training day. It fails weeks later, when a lamp has aged, sunlight has reached the station, or someone has raised the line light from 70% to 100% to brighten things up. The live images drift away from the training set, the learned features stop matching, and scratched parts start passing.

This guide is for engineers collecting images for edge-learning or deep-learning inspection. It shows how to lock geometry, intensity and drive before data capture, walks through a brightness-matching calculation with the arithmetic shown, and gives the acceptance numbers to meet before you trust a training set.

The decision: lock the lighting before you collect data

Training bakes the lighting into the model. Commercial edge-learning tools train from five to ten images in minutes; deep-learning pipelines use hundreds to thousands. Both counts assume every future image looks like the training set, and lighting is what makes images look alike. When the light moves, the images move, and more data is not the fix.

The decision in one line: choose the geometry from the feature, drive the light from a digital controller, hold the production setting at or below 80% of output, and capture the training set at exactly the exposure and intensity the line will run. Change any of those afterwards and plan on retraining — the mechanics are in when lighting changes force retraining a vision model. If you are still weighing AI against rule-based tools, AI vs rule-based smart camera inspection covers the method choice; this article covers the lighting that keeps whichever model you train valid.

Why trained AI models break when the lighting moves

Training teaches a model patterns from labelled images; inference runs that frozen model on live images, and nothing recomputes at inference time. If brightness, contrast or highlight structure differs from training, the feature statistics differ too, and the decision boundary sits in the wrong place.

The damage is easy to quantify on an 8-bit camera. Take a matte background at gray level 130 with a dark defect 10 levels deeper. A 5% brightness change moves the background by about 6.5 levels (130 × 0.05 = 6.5), which is more contrast than the defect itself. Models with brightness normalization absorb some global shifts, but no gain setting reverses geometry: a changed reflection angle reshuffles highlights and shadows. So the goal is not a model that tolerates lighting drift. It is a light that does not drift.

Choose geometry from the feature, not from the algorithm

Write down what the model must actually see, then pick the light from that, because AI cannot learn a feature the optics never formed. Scratches, smears and print on flat surfaces need wide, even, diffuse light: bar lights in opposed pairs cover fields from a few centimeters to well over a meter. Silhouette and edge gauging take a diffuse backlight; dents and pits take low-angle dark field. The full geometry catalogue with ray diagrams is in machine vision illumination types.

Curved and shiny parts — caps, bottle shoulders, handles — take a dome light. The curved diffuser fills the surface from every direction, so specular highlights average into a smooth, inspectable background instead of hot spots. The LS-DOM-0085 is a Ø166 mm dome with a Ø116 mm emitting area.

How a dome light works LEDs at the rim light the white inner surface of the dome, which lights the part evenly from almost every direction. The camera looks through a hole at the top; on flat mirror-like areas the hole reflects as a dark spot.Cameradiffuse inner surfacelights the part from every sideLED ringcamera holecurved or wrinkled part; dark spot where the hole reflects
How a dome light works. LEDs at the rim light the white inner surface of the dome, which lights the part evenly from almost every direction. The camera looks through a hole at the top; on flat mirror-like areas the hole reflects as a dark spot.

Three workhorses cover most AI training stations, and all three run on 24 V:

Bar lights290 x 30 mm LED bar light (LS-BAR-1047)LS-BAR-1047
Size
200-400 mm
Type
Standard
$449.00View part
Bar lightsBar light, 372 x 28 mm, White (LS-BAR-1276)LS-BAR-1276
Size
200-400 mm
Type
Diffused
$439.00View part
Dome lightsØ166 mm dome light, Ø116 mm emitting area (LS-DOM-0085)LS-DOM-0085
Size
100-200 mm
Voltage
24 V
from $409.00View part

Size the light to the field, not to the algorithm: the emitting area should span the part with margin on every side, because a repositioned part must always land on the same background.

Set intensity for the line's exposure and keep headroom

The brightness a camera records is proportional to the light intensity at the part times the exposure time. Double one to make up for halving the other — but only within one mode, because a strobed pulse and a continuous field distribute energy differently across highlights. So fix the production exposure time first (motion blur caps it), fix the mode (continuous or strobe), then set intensity.

Keep the exposure long relative to the controller's PWM period — kilohertz PWM has periods of microseconds — so the camera integrates the average rather than part of one pulse. Exposures shorter than a pulse are strobing, which is a different mode with its own rules below.

Hold the production setting at or below 80% of the controller's output. At 80% you can still add 25% brightness (100 ÷ 80 = 1.25) to pay for LED aging, dust on a diffuser or a darker part variant. At 100% there is no reserve, and the first drift pushes every live image away from the training set.

recorded signal ∝ E × t_exp (E = intensity at the part, t_exp = exposure time) E_line = E_bench × (t_bench / t_line)

Worked example: matching training brightness to a 2 ms line exposure

The case: a small-parts conveyor at 150 mm/s feeding a deep-learning scratch classifier. The training set was shot on a stationary bench rig at 8 ms exposure with the light at 25% output. Camera, lens and stand are identical on bench and line; only exposure and light change.

  • Belt speed: 150 mm/s, from the line specification.
  • Blur budget: 0.3 mm, your acceptance rule, so a 0.1 mm crack cannot smear beyond recognition.
  • Bench capture: 8 ms exposure, light at 25% output.
  • Target: production light at or below the 80% ceiling.

Rule: recorded signal is proportional to intensity times exposure, so equal images need equal products of the two.

  1. Exposure cap on the line: t = 0.3 mm ÷ 150 mm/s = 0.002 s = 2 ms.
  2. Brightness ratio: 8 ms ÷ 2 ms = 4, so the line needs 4× the bench intensity.
  3. PWM setting: 25% × 4 = 100%.

Result: the line light must run at full output to reproduce the training images.

Decision: 100% breaks the 80% ceiling, so do not ship this training set. Option A: fit more optical output — a second bar or a strobed pulse — and recapture the training data on the moving line at the final settings. Option B: shoot the bench set dimmer and longer instead. At 25% and 5.6 ms the bench product is 0.25 × 5.6 = 1.4 (%·ms), which the line reproduces at 0.70 × 2 = 1.4, so the line runs at 70% and passes the ceiling. Either way, freeze the setting and collect training images against it. The threshold is simple: a required production intensity above 80% means change the hardware, not the model.

Drive stability: constant current, strobe and fixed PWM

A controller is what makes yesterday's light equal today's. Constant-current drivers hold LED output steady as the junction warms, where a bare constant-voltage supply sags. Digital controllers give a repeatable percentage every session reads back the same. Strobe mode fires a fixed pulse per camera exposure, freezing belt motion and delivering the same pulse energy to every image. Turn the camera's auto exposure and auto gain off — they re-brighten drifting scenes and mask the drift you need to see; the failure is described in camera image brightness drifts over time. If a dedicated controller needs justifying, why use a machine vision lighting controller lists the reasons, and the light controllers category splits by channels, constant voltage and constant current.

For a steady four-light training station, the LS-CTL-0290 is a 60 W, four-channel digital constant-voltage controller.

Light controllersDigital constant-voltage light controller, 60 W, 4 channels (LS-CTL-0290)LS-CTL-0290
Output
Constant voltage 24 V
Channels
4 channels
Control
Digital
$449.00View partBuild a system with it

Sixty watts across four channels is 15 W per light, enough for the small bar lights in a training rig; larger strobed heads go to the constant-current units below.

Strobing and overdrive need current headroom: the LS-CTL-0054 is a two-channel constant-current controller rated at 240 W per channel, 320 W total.

Light controllersHigh power constant current controller, 2 ch, max. output power 240 W per channel, 320 W (LS-CTL-0054)LS-CTL-0054
Output
Constant current
Channels
2 channels
Control
Analog
Feature
Constant current
$549.00View partBuild a system with it

Strobing buys brightness without heat. Pulse the light only during the 2 ms exposure and, at one part every 500 ms, the duty cycle is 0.4% (2 ÷ 500), so average power falls by that factor while peak in-exposure brightness stays at full rated output. Overdrive pushes short pulses past the continuous rating for still more in-exposure light; the margins are in LED overdrive and current control.

Acceptance numbers to meet before training

Measure rather than eyeball. Image one golden reference part 50 to 100 times across a shift and read the mean gray level in a fixed region of interest, using the ROI-and-reference method in measure light intensity in machine vision. Then meet three numbers.

  • ROI mean within ±5% between sessions. On the 130-level background above, that is about 6.5 levels — already larger than many defect contrasts.
  • Corner-to-center mean within 10% of center on flat parts, so a repositioned part lands on the same background.
  • No dark bars or brightness beats in any frame; if they appear, exposure and PWM period are fighting, and black bars in camera images walks the diagnosis.

A full sign-off procedure — warm-up, soak and drift logging — is in machine vision lighting stability test before deployment. Log the passing values with the training set: light model, geometry, PWM percentage, strobe width, exposure, gain. That record is what lets you reproduce the images a year later.

When the usual answer is wrong

Controller stability cannot fix light you do not control. Daylight through a roof window swings tens of percent across a day and dwarfs anything PWM does; shade the station or reject ambient optically, as in ambient light variation in pick and place vision and the ambient light rejection specification. And no amount of data rescues the wrong geometry: if scratches reflect past the camera at the chosen angle, the model simply learns to ignore them. Fix lighting, lens and exposure in that order first — stable 2D vision inspection systems explains why that order matters.

Pre-training checklist

Run this list before the first image enters the training folder.

  • Geometry frozen: light model, angle, distance and stand photographed and written down — angles are what no gain setting can restore.
  • Drive frozen: channel, PWM percentage, strobe width and delay read from the controller and logged — the numbers that reproduce brightness.
  • Camera manual: auto exposure and auto gain off, exposure and gain logged — auto modes hide drift until it is large.
  • Line exposure computed: belt speed and blur budget through the 2 ms calculation above — it caps brightness before you shoot.
  • Headroom confirmed: production PWM at or below 80% — the reserve that absorbs aging.
  • Stability passed: 50-100 reference images, ROI mean within ±5% — proof the training images match tomorrow's.
  • Uniformity passed: corner-to-center mean within 10% — so part position does not change the background.
  • Mode matched: training images shot in the production mode, strobe or continuous, at production settings — mixed modes shift highlight structure.
  • Golden set archived: reference images plus the logged values, kept with the model.

Next step: pick the geometry from the feature, then size the light and controller in the lighting finder or configure a lighting system step by step against your camera and field of view. The lighting guides collect the related reading, and contact the applications team with your part and line speed for a concrete recommendation. For the wider rollout — vendor selection, staff training and line integration — this industrial vision system implementation guide covers what happens around the lighting.

Questions

How many images does AI vision training need?

Edge-learning classifiers train from five to ten images in minutes; deep-learning models typically need hundreds to thousands. Those counts hold only when every image is captured under the lighting the line will run. If intensity, angle or spectrum changes between training and production, the model sees unfamiliar images and you keep adding pictures without fixing the cause. Get the light stable first, and the small image counts hold.

Can the camera's auto exposure absorb lighting changes?

No. Auto exposure rescales the whole frame: it brightens the defect along with the background, moves the gray-level relationships the model learned, and hides lamp drift until it exceeds the adjustment range. Run manual exposure and manual gain, hold them fixed for training and production alike, and correct brightness at the light through the controller's PWM setting, where every change is repeatable and identical for all images.

Why not train on brighter images and turn the light down later?

Because the model must see the images the line makes. Turning a light down is repeatable; turning it up past a limit is not. If training happens brighter, every production image is darker than anything the model saw, contrast at defects compresses, and failures look random. Set the final production brightness first — at or below 80% of the controller's output — then collect the training set against it.

Dome light or bar light for a shiny curved part?

A dome light. Its curved diffuser returns light from many directions, so the part's specular highlights average into a smooth background; a flat bar gives one dominant reflection direction and leaves hot spots. Choose an emitting area that spans the part's projected width with margin on every side, keep bar lights for flat fields, and reserve domes for curved or wrinkled specular surfaces such as caps, shoulders and handles.

If I change only the light's intensity, must I retrain?

Unless you can return exactly to the logged training value, yes. Intensity shifts scale gray levels roughly in proportion, so classifiers with brightness normalization absorb small changes, but segmentation thresholds and contrast features do not. A geometry change — angle, distance, spectrum — always forces recollection, because it rebuilds the shadow and highlight pattern instead of scaling it. Re-trimming the light to its logged setting beats retraining every time.