Most plants that ask us about AI inspection have the same data problem. They have thousands of images of good parts, or can capture them in an afternoon, and a few dozen images of defects at most — often fewer for the defects that matter most. A supervised detector trained on that imbalance learns the common defects and misses the rare ones. This note explains the approach behind our Zero-Defect Anomaly Engine, which starts from the data plants actually have: good parts.
The problem, stated precisely
We want a function that takes an image of a part and returns two things: a single anomaly score that can be thresholded into pass or fail, and a spatial map showing where the image departs from normal. We want to fit it using only images of acceptable parts, typically 50 to 200 of them, captured on the real line under production lighting. And we want inference to run within the latency budget of an edge device on that line.
This is the setting studied in the academic literature as unsupervised or one-class industrial anomaly detection. The public benchmark most often used is MVTec AD, which contains fifteen object and texture categories with good-only training sets and test sets containing both good and defective images with pixel-level ground truth.
Why a memory bank of patch features
Among the families of methods for this problem — reconstruction-based autoencoders, normalising flows, student–teacher networks and feature-embedding methods — we chose to start with a feature-embedding approach in the style of PatchCore (Roth et al., 2022). The idea is simple enough to explain to a quality engineer:
- Extract features. Pass each good image through a convolutional network pretrained on a large generic image dataset. Take activations from intermediate layers, where features describe local texture and structure rather than whole-object categories. Each spatial location becomes a feature vector describing a small patch of the part.
- Aggregate locally. Average each patch feature with its immediate neighbours so that a vector describes a slightly larger receptive field and is less sensitive to a one-pixel shift.
- Build a memory bank. Pool the patch features from all good images. This is the model's definition of “normal”.
- Subsample with a coreset. The full bank is large. Greedy coreset selection keeps a small subset — commonly 1–10% — that still covers the feature space, so nearest-neighbour search stays fast.
- Score. For a new image, extract patch features the same way and find each patch's nearest neighbour in the memory bank. The distance is that patch's anomaly score; upsampled and smoothed, these distances form the heatmap. The maximum patch score, with a small re-weighting step, is the image score.
Why it suits low-data plants
- No defect labels. Training requires good images only. Defect images are used for validation and threshold setting, not for fitting.
- No backbone training. The feature extractor is used as-is, so fitting is a feature-extraction pass plus coreset selection. On a single data-center GPU this is minutes, not hours, which means a new SKU can be added the same day.
- Explainable output. Every reject comes with a heatmap pointing at the patches that were furthest from anything seen in good parts. Operators can check that the model is looking at the part and not at a reflection on the fixture.
- Unknown defects. Because the model scores deviation from normal rather than similarity to known defect classes, it can flag defect types nobody thought to label.
Where it struggles
We would rather state the limits than discover them in a pilot:
- Alignment and pose. Large variation in part position or orientation inflates distances for good parts. We address this with fixturing advice and, where needed, an alignment step before scoring.
- Legitimate variation. If normal parts vary — different colours, suppliers, batch markings — that variation must be in the training set, or it will be scored as anomalous.
- Logical anomalies. A part with every component present but in the wrong arrangement can look locally normal. Global constraints are better handled by the Defect Detection Engine or explicit rules.
- Naming. The engine says “this region is unusual”, not “this is a scratch”. We pair it with supervised detection where the defect class matters.
How we evaluate
We report image-level AUROC (how well the score separates good from defective images), pixel-level AUROC and PRO (how well the heatmap localises defects), and — because plants care about it most — the false reject rate at a threshold that catches a fixed share of defects. Every number we publish is labelled with its source:
| Metric | Value | Label |
|---|---|---|
| Image AUROC, MVTec AD mean across categories | ≥ 0.97 | Target — internal benchmark on public dataset (MVTec AD) |
| Pixel AUROC, MVTec AD mean | ≥ 0.96 | Target — internal benchmark on public dataset (MVTec AD) |
| Inference per image on Jetson Orin, 1 camera | < 50 ms end to end | Target |
For context, the original PatchCore paper reports image-level AUROC of up to 99.6% on MVTec AD. That is a published academic result, not ours. We publish our own internal-benchmark numbers only when they can be reproduced from a tagged model version and evaluation script; until then this table lists targets, and we say so.
We do not report customer results here. Benchmark performance on a curated public dataset is not the same as performance on a real line with changing lighting and part variation, and we will not imply otherwise.