Cameras & sensorsHow-to

Spectral imaging material classification: plan a validation test

Plan spectral imaging material classification tests with representative samples, controlled lighting, reference correction and a held-out test set.

LumaSpec Vision10 min read Share on LinkedIn

On this page 10 sections
  1. 01Decide whether spectral measurements are warranted
  2. 021. Define the decision and acceptable errors
  3. 032. Build a sample matrix before splitting data
  4. 043. Select camera and illumination together
  5. 054. Set spatial sampling and acquisition limits
  6. 065. Acquire references and normalize carefully
  7. 076. Train without leaking test information
  8. 087. Run the held-out test and challenge conditions
  9. 098. Make the purchasing decision and handover checklist
  10. 10Questions

Materials that look identical to a colour camera may reflect light differently across wavelength. That difference can support classification, but only if it survives changes in batch, finish, position and illumination. A convincing false-colour image is not enough.

This procedure helps you decide whether a spectral system deserves further investment. You will define the decision, assemble representative samples, control acquisition and measure performance on material the model has never seen. Treat the first experiment as a feasibility study, not proof of production accuracy.

Decide whether spectral measurements are warranted

Start with the physical distinction you need to detect. Different materials can have useful spectral differences, but shared colour, different chemistry or a large number of measured bands does not guarantee separation within the camera's wavelength range.

The hyperspectral imaging overview explains the acquisition options. Here, the decision is narrower: does spectral information improve your actual inspection enough to justify calibration, data handling and maintenance?

Observation in representative samples First approach to evaluate Reason
Stable visible colour difference Controlled colour imaging Spectral acquisition may add unnecessary complexity
Separation at a few selected wavelengths Filtered or sequenced illumination A smaller measurement set may retain the useful contrast
Subtle differences spread across wavelength Hyperspectral acquisition Multiple spectral features may be needed together
Separation changes with finish or orientation Improve presentation and test again Geometry may dominate the material signal
No repeatable difference within the measured range Reconsider the sensing method More processing cannot recover an absent signal

For the second case, the multi-wavelength light sequencing guide describes a simpler acquisition strategy. Do not assume that more bands automatically produce a better production system.

1. Define the decision and acceptable errors

  1. Write the required output before collecting images. Specify the material classes, decision unit and response to uncertainty.

A decision unit might be a whole component, a region on a sheet or an individual foreign object. Pixel classification and part classification are different tasks. A correct majority label can still hide a small contaminant.

Define the costly errors separately:

  • False acceptance: an unsuitable material is accepted as the target.
  • False rejection: an acceptable target is rejected.
  • Unknown: the system declines to assign a trusted label.

For example, an application might require false acceptance below 1%, while allowing uncertain parts to receive secondary inspection. This is an application requirement, not a capability implied by any camera specification.

Also record the smallest relevant region, cycle time, permitted part movement and expected material variation. If you need chemical composition rather than a class label, define independent reference measurements. Classification accuracy alone does not establish quantitative composition.

2. Build a sample matrix before splitting data

  1. Collect independent physical samples with trustworthy labels. Include normal variation and difficult negatives, not just clean examples that look different.

Record material identity, source batch, surface treatment, thickness, colour, orientation and acquisition session. Use an independent identification method where necessary. Supplier descriptions or visual guesses may be inadequate ground truth for closely related materials.

A pilot could begin with 30 independent pieces per class across several batches. That is a practical starting allocation, not a statistically sufficient acceptance test. Repeated images improve repeatability estimates but do not create additional independent pieces.

Divide data by physical piece and, where practical, by production batch:

  • Training data fits the classifier and learned preprocessing.
  • Validation data selects features, settings and decision thresholds.
  • A held-out test set measures the frozen system once development is complete.

Never place pixels from the same piece into both training and test sets. Shared texture, background and acquisition conditions can make performance appear much stronger than it is.

Balance nuisance conditions across classes. If every target sample uses one background and every negative uses another, the model can learn the background instead of the material.

3. Select camera and illumination together

  1. Check wavelength coverage, usable signal and output format as a system. Camera coverage is useful only where the illumination, optics and detector provide repeatable measurements.

The LS-HSC-0004 is listed as a 400-1000 nm area scan hyperspectral camera with 1200 bands and USB3.

Hyperspectral cameras400-1000 nm area scan hyperspectral camera, 1200 bands, USB3 (LS-HSC-0004)LS-HSC-0004
Lens mount
C-mount
Interface
USB3
Resolution
5 MP
$15,900.00 · quotedView and quote

That listing establishes a candidate measurement range, not guaranteed separation between your materials. Band count is also not the same as independent spectral resolution. Request the wavelength calibration, spectral response information and reconstructed data dimensions before designing the experiment.

Compare hyperspectral cameras through the camera finder. Confirm the usable spatial dimensions per spectral image rather than treating the catalog megapixel figure as the dimensions of every reconstructed band.

Illumination must provide adequate signal at the wavelengths you intend to use. A visually bright lamp can still leave weak spectral regions. Ask for spectral output information and test the complete optical path, including the lens and any window.

The LS-SPC-0040 is listed as a customized combined bar light. It is a starting point for discussing illumination geometry, not evidence of broadband spectral suitability.

Special lightsCustomized combined bar light (LS-SPC-0040)LS-SPC-0040
Size
200-400 mm
Voltage
24 V
$709.00View partBuild a system with it

The supplied listing does not establish its spectral output. Review special lights in the lighting finder, then request a documented spectral match before selecting a source.

4. Set spatial sampling and acquisition limits

  1. Calculate the required spatial sampling before evaluating classification. A material feature cannot be classified reliably if its image is mostly mixed with the surrounding material.

As a starting estimate, suppose a relevant object is 1 mm wide and you want 5 spatial samples across it. Across a 100 mm field, the required sampling is:

required spatial samples across field = field width / object width × samples across object = 100 mm / 1 mm × 5 = 500

This is a sampling target, not a detection guarantee. Optical blur, reconstruction, low contrast and mixed boundary pixels may require additional margin.

Camera resolution for the smallest feature
Units
Pixels needed
–
Sensor size
– MP
Smallest sensor that fits
–
Pixel on the part
– mm
Pixels across the feature, that sensor
–

Pixels needed = field / feature × pixels per feature on each axis (field incl. margin). The lens must resolve the pixels too: Nyquist = 1000 / (2 × pixel µm) lp/mm.

Find cameras with enough pixels Open the full calculator

Check this requirement against the reconstructed spectral images, not just the raw sensor dimensions. Use the lens and lighting selection test plan to evaluate focus, contrast and presentation together.

For moving samples, estimate how far the material travels during exposure. At 200 mm/s with a 2 ms exposure:

motion during exposure = speed × exposure time = 200 mm/s × 0.002 s = 0.4 mm

That displacement is significant relative to the example feature size. Confirm how the selected acquisition method handles motion and spectral registration. If its reconstruction requires several captures, evaluate movement across the full acquisition sequence as well.

Start feasibility work with stationary samples when possible. Add production motion only after demonstrating repeatable spectral separation.

5. Acquire references and normalize carefully

  1. Capture dark, reference and sample measurements under controlled conditions. Follow the camera's documented calibration procedure and preserve the original measurements.

Use fixed exposure and gain during a comparable acquisition sequence. Allow the illumination to stabilize, control ambient light and keep the reference geometry consistent with the sample geometry.

For linear measurements acquired at matching settings, a common normalization estimate is:

normalized response(λ) = [sample(λ) - dark(λ)] / [reference(λ) - dark(λ)]

Here, λ denotes wavelength. The reference should have known, suitable behaviour across the measurement range. Without accounting for its spectral reflectance, the ratio is not automatically an absolute reflectance measurement.

For example, suppose a sample measures 520 counts, the reference measures 1020 counts and the dark measurement is 20 counts:

normalized response = (520 - 20) / (1020 - 20) = 500 / 1000 = 0.50

Reject saturated measurements and mask bands where the corrected reference is too small for stable division. Do not hide invalid measurements by forcing them into a plausible numerical range.

Capture a stable check sample at the beginning and end of each session. If its spectrum moves substantially, investigate illumination, temperature, geometry or calibration before interpreting material differences.

Keep dark correction, reference correction and later statistical normalization distinct. Normalizing every spectrum to its own magnitude can remove brightness effects, but it can also remove useful material information.

6. Train without leaking test information

  1. Develop the processing pipeline using training and validation data only. Keep the final test labels and measurements outside development decisions.

Begin with interpretable plots. Compare average spectra and within-class variation, then inspect individual samples and weak bands. A difference between class averages is unhelpful if individual distributions overlap under realistic conditions.

Use a simple baseline classifier before adding complexity. Compare it with a non-spectral baseline under the same sample split. The useful question is whether extra spectral information improves the decision on unseen material.

Fit scaling, feature selection and dimensionality reduction on training data only. Apply the fitted transformations unchanged to validation and test data. Selecting wavelengths using the complete dataset leaks test information even if the classifier itself never sees the test labels.

The spectral fingerprint workflow explains how measured spectra become classification inputs. For validation, freeze the complete chain: band masks, preprocessing, model, region aggregation and unknown threshold.

Choose the decision threshold according to the relative cost of false acceptance, false rejection and secondary inspection. A confidence score is not automatically a calibrated probability.

7. Run the held-out test and challenge conditions

  1. Evaluate the frozen pipeline on independent samples. Report counts by class, batch and relevant condition, not just one overall accuracy percentage.

For a target-versus-other inspection, an illustrative held-out test might produce:

Actual material Accepted as target Rejected as target Unknown Total
Target 92 5 3 100
Other 2 94 4 100

False acceptance is 2 / 100 = 2%. Hard rejection of target material is 5 / 100 = 5%, while another 3 / 100 = 3% of target samples require review. Across both groups, the unknown rate is 7 / 200 = 3.5%.

If the requirement was false acceptance below 1%, this example does not pass. Combining outcomes into an overall accuracy would obscure the failure that matters.

Zero observed errors also needs context. With independent trials and zero observed failures, the approximate one-sided 95% upper bound on the failure rate is:

upper failure-rate bound ≈ 3 / n n = 100: approximately 3% n = 300: approximately 1%

Use the relevant error opportunity as the denominator: unsuitable samples for false acceptance, for example. Correlated pieces from one batch weaken the independence assumption. This estimate is a planning aid, not a substitute for a formal acceptance method.

Challenge the system within the intended operating envelope. Vary orientation, sample position, surface condition and acquisition session. Test unfamiliar materials for unknown handling. If the test set guides another design change, it becomes development data; reserve fresh independent samples for the next final evaluation.

8. Make the purchasing decision and handover checklist

  1. Proceed only when the spectral benefit survives independent testing. Keep the simplest sensing arrangement that meets the requirement with an acceptable maintenance burden.

Before ordering or committing to integration, confirm:

  • Material coverage: relevant batches, finishes and confusing alternatives were represented.
  • Optical coverage: the intended wavelengths have usable signal through the complete optical path.
  • Spatial coverage: reconstructed images resolve the smallest relevant region with margin.
  • Timing: the complete acquisition and decision fit the required cycle.
  • Calibration: reference capture, validity checks and recalibration triggers are documented.
  • Decision quality: false acceptance, false rejection and unknown rates meet their separate limits.
  • Traceability: sample identities, raw data, settings and processing versions are retained.

The usual answer is wrong when separation depends on a presentation condition that production cannot maintain. It is also wrong when a few wavelengths perform equally well, when required features lie outside the measured range, or when the task needs a validated chemical assay rather than an image-based class label.

Use the lighting configurator to outline the optical arrangement. For a feasibility review, contact the applications team with representative samples, required error limits, feature size, field width and cycle time. Ask for documented spectral compatibility and a sample-based validation plan before choosing parts.

Questions

Can spectral imaging always distinguish materials with the same colour?

No. Useful separation depends on the materials, wavelength range, illumination and normal production variation. Some visually similar materials have distinguishable spectra, while others overlap within the available range. Evaluate independent physical samples before assuming that spectral acquisition will provide a reliable class label.

How many samples are needed for a classification test?

There is no universal sample count. Include independent pieces from relevant batches and conditions, then size the final test around the error rate you must demonstrate. Repeated images of one piece measure repeatability but do not provide the same evidence as additional independent material samples.

Why should samples be split by piece instead of by pixel?

Pixel spectra from one piece share material history, surface condition and acquisition conditions. Splitting those pixels between training and testing lets the model encounter closely related information on both sides. Hold out complete pieces and preferably batches to assess performance on genuinely unfamiliar material.

Do successful spectral tests require a hyperspectral camera in production?

Not necessarily. If a small set of wavelengths retains the separation across independent batches, filtered imaging or sequenced illumination may be sufficient. Compare that reduced system against the full spectral pipeline using the same held-out samples, operating conditions and error definitions.

How should the system handle an unfamiliar material?

Define an unknown outcome and a controlled response, such as secondary inspection or rejection according to the application requirements. Measure unknown rates separately from assigned-class errors. A classifier trained only on known materials should not be assumed to identify every unfamiliar material correctly.