PART VI · MODEL TRAINING AND RELIABILITY

How Do You Analyze Model Errors? False Positives, False Negatives, and Root Causes

False-positive and false-negative galleries are organised by product, shift and imaging conditions. An aluminium-surface reflection mistaken for a scratch provides a diagnostic case for separating model, optical and label errors. The article follows a root-cause tree through corrective actions to independent measurement of their effects, outlining a usable error-analysis report.

Article sectionsError analysis is more than counting mistakesHow do you build an FP and FN gallery?Slice-based evaluationIs the problem in the model or the image?Recognizing labeling errorsRoot cause treeMeasuring the impact of corrective actionsStructure of an error analysis reportField scenarioA diagnostic experiment for a false alarmFrequently asked questionsReferences

Error analysis is more than counting mistakes

A confusion matrix tells you how many incorrect decisions were made; it does not explain why. Error analysis reveals the conditions under which the system fails and helps us choose the next engineering intervention. For example, if surface scratches are missed only on parts rotated to a particular angle, the issue may have more to do with lighting geometry than with the model architecture.

The first step is to examine error cases together with their production conditions rather than as isolated images. Product type, series, shift, camera, exposure, lighting, software version, and operator notes provide important clues.

From symptom to verified correctionError recordImage and versionHypothesisOptics, data or modelDiagnostic experimentChange one factorRegression testFP/FN on new parts
Figure 1. Design the experiment so it can falsify the hypothesis. Verify the correction on independent parts, not just another display of the diagnostic example.

How do you build an FP and FN gallery?

Nondefective samples on which the model raises false alarms and defective samples it misses should be examined in separate groups. Each sample should include the ground-truth label, model decision, score, defect type, and image acquisition metadata. If the same part appears several times in the same way, these images can be treated as a single event; otherwise, a root cause may appear more significant than it really is.

Looking only at the most striking errors in the gallery introduces selection bias. Randomly selected errors, the highest-scoring incorrect predictions, and critical defects should be assessed together.

Slice-based evaluation

High performance across the entire test set can hide poor performance in certain subgroups. Performance should be measured separately for slices such as product surface, camera angle, defect size, brightness, shift, or production machine. If groups have too few samples, a single event can cause a large percentage change.

Useful analyses include recall by small-defect size, the FP rate across different backgrounds, and precision by production batch. An error dashboard organized by subgroup makes engineering priorities visible.

Is the problem in the model or the image?

If a defect cannot be seen by eye in the original image, increasing the dataset or model size alone may not solve the problem. Focus, exposure, lighting angle, polarization, vibration, and motion blur should be examined. If the same defect becomes clearly visible under different lighting, the first intervention may need to be on the optical side.

If the relevant detail is visible in the image but the prediction still fails, investigate label consistency, preprocessing, the model's dependence on context, and how well the case is represented in training. Distinguishing these two possibilities reduces costly retraining attempts.

Recognizing labeling errors

Incorrect or inconsistent ground truth makes correct model predictions appear wrong. Two experts may disagree, particularly when defect boundaries are ambiguous. In such cases, adjudication, in which experts resolve the label through a joint decision, enables more consistent evaluation. If the defect definition changes, you cannot assume that earlier metrics were calculated using the same rule.

Label corrections should be versioned and the labeling protocol updated. However, changing only labels that disagree with the model's predictions would amount to tailoring the test set to the model; an independent review is required.

Root cause tree

It is useful to organize error causes into four main categories: optical/physical, data/labels, model/preprocessing, and system/integration. For example, if an incorrect detection actually results from trigger timing associated with the wrong product, changing model training will not help. Synchronization between the image and the PLC decision is also part of the inspection.

For each root cause, record the observation, possible explanation, discriminating test, and proposed correction. This turns a discussion based on intuitive blame into a measurable experiment.

Measuring the impact of corrective actions

The intervention chosen after error analysis should be tested again on the same error subgroup and on independent validation data. A lighting change may reduce FPs while obscuring subtle defects. A new model may improve one defect class while regressing on another. Regression tests are therefore necessary.

Engineering actions can be prioritized by impact, cost, implementation time, and new risks. Understanding why the model makes an error and reducing that error safely are separate stages.

Structure of an error analysis report

The report should include the test definition, error counts, confidence in labels, subgroup statistics, examples, suspected root causes, and a validation plan. We do not have to assign a definitive cause to every error; unresolved cases should be clearly marked. What matters is which hypothesis will be tested and how.

This approach creates a shared language among model teams, quality engineers, and production managers. Instead of saying "the model is bad," teams can use actionable statements such as "false rejections are increasing on reflective products on line B."

Practical field scenario: reflection-induced false alarm

Suppose the model flags a bright line that consistently appears in the same position on an aluminum part as a scratch. The error gallery reveals that these samples share a single lighting angle and belong to the same product family. A discriminating test is performed by changing the lighting direction; the failure may originate in image acquisition rather than in the model.

Organizing the error gallery

For a practical gallery, simply dividing samples into FP and FN groups is not enough. Create subcategories: reflective surfaces, dark surfaces, small defects, defects at image edges, overlapping parts, motion blur, samples with disputed labels, and new production batches. State how many products each group contains. Rather than handpicking individual photos, show both random samples and the most critical cases.

If a sample appears to be a false negative, first check whether a person can actually discern the defect in the image. Then examine label correctness, preprocessing, and the model's output. This sequence can prevent the model team from pursuing an unnecessary architecture search.

How do you conduct a discriminating experiment?

Suppose false alarms are increasing on reflective surfaces. Candidate explanations include light reflections, the camera's automatic exposure, a new surface coating, or insufficient training examples. Capture images of the same products again under fixed lighting and fixed exposure; avoid changing other variables where possible. If the error decreases substantially, a physical acquisition issue becomes a strong candidate. This result needs to be reproduced on different products.

Regression testing after a correction

When errors decrease for one defect family, all subgroups should be tested again. Aggressive color normalization may reduce FPs on reflective surfaces while erasing low-contrast scratches. High-resolution inference may improve small-defect performance while increasing processing time. The possible side effects of the correction must be included in the error analysis report.

Field deployment checklist

  • Data source: Clearly specify the product, batch, camera, shift, and sampling method.
  • Decision unit: Do not conflate measurements at the image, defect, product, and production-line levels.
  • Success criteria: Document the metric target together with latency, throughput, cost, and tolerance for critical errors.
  • Alternatives: Assess whether simpler methods and improvements to the physical setup can meet the same need.
  • Validation: Use a test protocol that is independent of the training data and representative of production conditions.
  • Change log: Whenever the model, threshold, optical settings, or label definition changes, archive the rationale for the decision and its consequences.

A diagnostic experiment for a false alarm

Suppose a mark on reflective metal is classified as a scratch. Record the original image, part ID, reference decision, score, recipe and lighting settings. Capture the same part under controlled changes in lighting angle. If the appearance changes with illumination, the reflection hypothesis gains support, but this does not prove the part is sound. Independent reference inspection must establish its physical condition.

Next inspect the data pipeline: send the same stored image through training and serving preprocessing. Compare crop coordinates, channel order, scaling, colour conversion and model versions. Fix discrepancies before collecting more data. For shift-specific errors, separate lighting, recipes and product mix. Report group sample counts so that a random result in a tiny group is not mistaken for a systematic failure.

Do not close the issue after one successful image. Keep diagnostic parts in the development group and build regression tests from different parts under comparable conditions. Compare FN as well as FP before and after the change: a glare-suppression filter may also erase fine scratches. Record the hypothesis, counterevidence, changed component and independent test result so future investigations can build on the evidence.

Frequently asked questions

Does every incorrect prediction originate in the model?

No. Optics, data, labels, synchronization, and operating conditions can also produce errors.

What is the best first step?

Group error cases into subgroups using metadata and formulate a hypothesis that can distinguish between possible causes.

References and further reading

The primary sources below explain the methods and evaluation protocols. Numerical scenarios in this article are educational examples, not measured results from a facility or model.

  1. Google: training-serving discrepancies and error investigation
  2. scikit-learn: error types and evaluation metrics