Anyone who has worked in visual inspection knows the situation: two experienced inspectors look at the same part, one passes it and the other rejects it. In manual inspection such differences get lost in day-to-day work. With a vision system they surface immediately, because the model learns exactly what the labelled images show it. If people do not agree where OK ends and NOK begins, the model will not either. So before anyone labels the first image in AIVQC Trainer, it is worth having two things: a defect catalogue and borderline samples.
Why defining the defect is the first step, not a formality
Training teaches the model to tell what was labelled as a defect from what was confirmed as good. If a similar scratch has a box on one image and was confirmed as OK on another, the model gets contradictory examples. The effect only shows in evaluation: the result is unstable, and the decision threshold cannot be set so that it neither lets defects through nor rejects good parts.
In How many images do you need to train AI inspection? we write that borderline cases decide inspection quality and that acceptance criteria have to be set before training. Here we describe how to do that in practice — so that the definition is written down, shown in photos and shared by everyone who will judge and label.
What a defect catalogue contains
A defect catalogue is a document — a spreadsheet or a few pages with a table is enough — in which every defect has its own card. A good card lets a new inspector judge a part the same way an experienced one would, without asking.
- Defect name and class — the same name you will later use as the class in Trainer.
- Description in words — what the defect looks like, where on the product it appears and what it can be confused with, for example a reflection, natural material texture or dust on the optics.
- OK/NOK criterion — as measurable as possible: size, length, position, product zone. "A scratch in the visible zone longer than…" beats "a clear scratch".
- Photos — at least a typical OK, a borderline OK, a borderline NOK and an obvious NOK, taken with the station camera and lighting, not a phone.
- Criticality — whether the defect affects safety, function or only appearance. This later decides which error costs more.
- Reaction — what happens to the part: reject, sorting, a check by a person.
- Visibility — whether the defect can be seen in the camera image at all, and under which conditions.
- Owner and version — who approved the definition and when it last changed.
Photos from the station camera matter more than it seems. An inspector looks at a part from different angles and picks it up, while the model sees one image in one lighting set-up. If the defect is not visible in the station image, no model will find it — then the fix is lighting or the field of view, not the data.
Borderline samples: a boundary you can hold
A description in words always leaves room for interpretation. A borderline sample closes it: a physical part, labelled and stored in an agreed place, that shows exactly where the boundary lies. You need samples from both sides — a part that is still good and a part that is already defective. A "smallest defect" sample alone is not enough, because it does not show what lies just below the boundary.
- Choose parts from the process. Deliberately made defects are acceptable, but they must be marked as artificial, because they usually look different from real ones.
- For each defect, collect several samples from each side of the boundary — from different places on the product and from different batches if the defect varies.
- Mark every sample permanently and describe it: defect, side of the boundary, date, who approved it.
- Photograph the samples at the station, with the target camera and lighting, and attach the photos to the catalogue card.
- Store them so they do not wear — a sample that has new scratches after a year is no longer a reference.
Borderline samples pay off many times: when training new inspectors, when agreeing on judgements, when checking the model at the boundary, and later when you need to make sure the station still judges the way it did at the start.
Inspector agreement before you start labelling
The simplest way to check whether a definition works is to have several people apply it independently. Prepare a set of parts from both sides of the boundary, weighted towards the hard cases, and ask two or three inspectors to judge each part as OK or NOK on their own — without talking and without seeing the others' results.
Then compare the results. Parts on which everyone agreed confirm the definition. Parts on which judgements differ show where the description is unclear. Discuss them together, sharpen the criterion, add a photo to the catalogue and repeat the exercise on new parts. It is also worth having the same person judge the same set again a few days later in a different order — agreement with oneself can be surprisingly low.
In automotive the same idea has a formal shape: attribute agreement analysis as part of measurement system analysis (MSA). Even if your plant does not require it, the simple version above is enough to know before labelling whether the boundary is shared.
From the catalogue to classes in Trainer
Not every defect in the catalogue has to be a separate model class. A class is something the model has to tell apart, so ask two questions: do the defects look clearly different in the image, and do they need a different reaction? Defects that look alike and are handled the same way are often better merged into one class. Defects of different criticality are worth keeping apart — results are calculated separately for each class, so you see straight away whether the model is letting through the most dangerous one.
A pilot covers up to three defect classes. That is a good moment to pick the defects that cost the most and leave the rest in the catalogue for a later stage.
During annotation the catalogue is the instruction: a defect on the NOK side gets a box, and an image of a part on the OK side — borderline ones included — is deliberately confirmed as defect-free. Trainer does not learn from images nobody has looked at, and a frozen dataset version means that a later change to the definition does not silently change results you have already seen.
The boundary on parts and the threshold in the model
The catalogue sets the boundary on parts, and the decision threshold sets it in the model. Trainer calculates a recommended confidence threshold from the evaluation data, together with a range of acceptable values, and the quality engineer makes the final call — depending on whether letting a defect through or rejecting a good part costs more. How to make that call is covered in False accept or false reject?.
Images of borderline parts should go into both training and the independent test set — different parts in each, of course, because Trainer always keeps shots of the same part in one set. The test then shows directly how the model judges parts just either side of the boundary.
The catalogue lives with production
A catalogue is not written once and for all. A new raw-material supplier, a new tool or a defect that never appeared before — then you add a card, pick samples and repeat a short agreement check. A new class means newly labelled images and a new model version, which AIVQC Server publishes as a new recipe version to the selected stations.
If your defect is unusual and you are not sure how to describe or label it, write to us — we will help you prepare the catalogue and samples before you invest time in annotation.