- Anomaly detection learns from good parts only and flags anything that looks different.
- It does not need a defect to be seen in advance, so rare defects can still stand out.
- It tells you that a part looks unusual, not what kind of defect it is.
- Training photos must cover normal variation, or normal variation gets flagged.
- It is not a measuring tool and cannot judge a defect against a spec limit.
The problem with collecting defect photos
The usual way to teach software is to show it labeled examples: these are good, these are bad. That needs many photos of each defect type. In a machine shop, defects are the exception. A shop with a good process may see a defect once in several hundred parts, and each defect looks a little different.
Collecting enough examples can take months. You also face a deeper problem: you can only train on defects you have already seen. A new kind of damage, such as a handling ding from a new fixture, is missing from the training set, so a model trained that way may pass it. Photographing defects deliberately is also awkward. Staging them by hand rarely matches real ones, and sorting through scrap bins costs time. For these reasons, a method that works from good parts alone is attractive to a small shop.
How anomaly detection works
The idea is simple. Show the system many photos of good parts. It breaks each image into small patches and records what normal patches look like, including normal texture, edges and shading. This stored set of normal appearance is often called a memory bank or a reference set. At inspection time, the system looks at the same small patches of the new part and asks, does this patch look like anything seen in a good part? Patches that match are normal. Patches that match nothing in the reference set get a high anomaly score. The part score is driven by its most unusual patch.
The output is usually a score plus a heatmap showing where the odd patches sit. You then set a threshold on the score. A part above it is flagged for a person to look at. The system never needed to know what a scratch is. It only needed to know what a clean surface looks like.
Why rare defects still stand out
A defect is, by nature, something outside normal. A scratch crosses a surface that is otherwise smooth. A dent bends the light in a way no good part does. A nick breaks a clean edge. Because the model has seen a lot of normal and nothing like these, the affected patches have no close match.
That is why a defect never seen before can still be flagged. The model does not match against a catalog of bad. It reacts to a lack of match with good. In theory this catches surprises that a list of known defect types would miss. There is a flip side. Anything unusual stands out, whether or not it matters. A speck of dust, a fingerprint or a legitimate tool mark that was not in the training photos can raise the score. So the quality of the good set decides how many false rejects you get.
What makes a good training set
Use real good parts from your own line, photographed the way they will be inspected. Include the normal spread you expect: slightly different seating, small differences in finish from batch to batch, and parts from different shifts or machines. If it can vary in production, it should vary in the training photos.
Have a person check that every training part really is good. A defective part slipping into the set teaches the model that the defect is normal. Published tests show these methods tolerate a small amount of mislabeled training data, but accuracy still falls as the noise grows, so clean the set.
Keep setup fixed between training and use: same light, same camera position, same exposure. Research on public benchmarks has shown that methods in this family can lose a lot of accuracy when the lighting changes between training and testing. Training photos taken under the real, locked setup avoid that trap.
What it cannot do
Anomaly detection does not name the defect. It says this part looks different, here is where, and how much. A person decides whether it is a scratch you must reject or a mark that is acceptable. It does not know your customer's cosmetic spec unless you set the threshold to reflect it.
It is not a measuring tool. It cannot tell you that a hole is 0.1 mm off or that a dent is deeper than a limit. For dimensions you still need gauges or a CMM. It is also tied to what the camera can see: a defect on a hidden face or inside a bore is invisible to it.
Finally, a new part number, a new finish or a changed process needs fresh good photos and a fresh test. A model trained on one part does not transfer to another. Treat each part number as its own small project, and confirm the result against defects you have on hand.
VZSOR trains on good parts only. A setup wizard takes about 30 minutes and uses roughly 60 photos of good parts from your line, with no defect photos needed. The station is pre-pilot and validated on one part, a 2 inch by 2 inch mill-finish aluminum L-bracket, for dents, scratches and nicks. It flags parts for a person to review and does not measure dimensions.