Industrial defect inspection acceptance must examine both missed defective items and conforming items incorrectly rejected. Overall accuracy depends on the sample composition. A combined figure can hide missed rare defects when conforming samples dominate. Agree on defect definitions, reference labels and the counting unit before procurement or technical review.

Define the positive class and counting unit

Here the positive class is a defective item, and the counting unit is an individual product. Image-level, defect-region-level and product-level metrics need separate definitions.

Reference result Predicted defective Predicted conforming
Defective item Correct detection TP Missed defect FN
Conforming item False alarm FP Correct acceptance TN

Official scikit-learn confusion-matrix documentation organizes counts by actual and predicted classes. This is a statistical definition, not an algorithm benchmark or evidence of equipment performance.

Include the denominator with every rate

Within this binary definition, the missed-defect rate is FN / (TP + FN) and the false-alarm rate on conforming items is FP / (FP + TN). If the denominator is 0, the corresponding defect metric is undefined. The report must list counts, sample composition, defect categories and evaluation scope.

Record blurred images, alignment failures and unconfirmed reference labels as separate cases requiring review. Agree in advance on their treatment in acceptance denominators. Removing difficult cases to improve the reported result is inappropriate.

Tune using validation data, then perform acceptance testing

Keep sample origin, batch, product type, imaging conditions, label version and data purpose. Recheck misses and false alarms after changing thresholds, regions or models. Data used for tuning is not independent acceptance evidence. Repeated images of the same product are not independent product samples.

Acceptance conditions also need defect scope, severity, borderline cases, review procedures and processing cycle time. Thresholds and metrics require testing on target samples. This article explains an evaluation method. Equipment inspection results are outside its scope.

Related services: vision algorithms and model engineering and project enquiries.