Start at the product specification

Imagine a baked portion reaching the inspection point. Its edge is darker than its centre, a seed sits near a fold and the overall shape is slightly irregular. None of those observations is automatically a defect. The first task is to translate a commercial quality requirement into something the inspection station can actually observe.

Describe the product family, the relevant surface, the expected orientation and the point in production where the judgement applies. A mark that is acceptable before trimming may be unacceptable in a finished pack. A colour limit agreed for one recipe should not silently become the standard for another. Record the version of the specification alongside the product code.

Make each category operational

Useful defect definitions explain the feature, its location and the rule for deciding whether it matters. Instead of “poor appearance”, specify an incomplete topping area, a broken outline or a region outside an agreed colour range. Include exclusions: shadows, permitted ingredient inclusions and normal edges can all resemble unwanted marks.

When a dimensional criterion matters, define physical units and calibrate the image geometry. Pixel counts alone change with working distance and camera setup. When colour matters, define the measurement conditions and reference method. The International Commission on Illumination (CIE) provides the colourimetry framework behind commonly used colour spaces; a numerical colour difference is still not a universal consumer acceptance limit.

Keep visible foreign-material categories narrowly worded. A station may detect a contrasting fragment on an exposed surface without detecting transparent material, a hidden object or a fragment below its effective resolution. “Foreign-body detection” without those qualifications can create a much broader impression than the evidence supports.

A photograph alone is not a specification.

Build a reference set that includes disagreement

Collect normal production across shifts, ingredient lots, cleaning cycles and expected seasonal changes. Add confirmed examples of each target condition. Include difficult but acceptable products, not only pristine ones. Otherwise the model may learn a narrow idea of normality and reject ordinary production.

Ask qualified reviewers to label the same examples independently before resolving disagreements. Keep the original labels, the reason for the resolution and the governing specification. If two experienced reviewers cannot consistently apply a category, more model training is unlikely to repair the underlying ambiguity. Consider a review category or a measurable secondary criterion.

Do not force every image into acceptable or defective. “Uninspectable” is a useful process state for overlap, blur, missing views or severe glare. “Uncertain” can describe evidence that is usable but close to the decision boundary. Neither state should default to acceptance without an explicitly justified operating rule.

Separate the quality claim from the safety claim

The Codex Alimentarius General Principles of Food Hygiene, CXC 1-1969, describes the food hygiene and HACCP framework. ISO 22000 addresses food safety management systems. Neither makes a surface camera a general-purpose safety assurance device.

European food operators also work within requirements including Regulation (EC) No 178/2002 and Regulation (EC) No 852/2004, available through EUR-Lex. Their relevance does not mean that every appearance checkpoint is a critical control point. That classification depends on the site's hazard analysis, controls and validation, not the presence of an AI model.

Specify the decision and its consequences

For every category, identify who owns the criterion, what the line should do and what evidence should be retained. A cosmetic reject may go to segregated review; repeated missing components may trigger a process investigation. Any rework route needs its own authorised procedure rather than an improvised return to the belt.

Before deployment, review the specification against BRCGS Global Standard Food Safety, IFS Food or other schemes actually applicable to the site. These are management and assurance contexts, not substitutes for a product-specific performance test. Freeze the approved definitions, then use them to design capture conditions and validation challenges.