Live inspection
Pick a part. The nearest neighbour search that scores it runs on your GPU, not on a server.
Operating point
Parts scoring above the threshold get pulled off the line. Everything below it ships.
Drag the line. Click anywhere on the plot to move it.
Expected cost per part against threshold. Marker is the minimum at the costs set on the right.
Only the ratio of the two costs affects where the minimum sits, so the units do not matter. The defect rate is a setting because the test set here is not a production mix.
With only good parts you can calibrate the false-reject rate; the escape rate you only learn once defects appear.
The minimum marked above is computed on labelled test defects, which a line does not have until defects show up. Until then the threshold can only be set by how often you are willing to stop the line. No held-out calibration split has been exported, so this page has no calibrated default threshold to show.
Good parts needed
Image AUROC against the number of good parts in the bank.
Bank size
The memory bank is what the line has to hold in RAM and search once per part. The coreset percentage sets how big it is. This is what shrinking it costs.
Bank megabytes are the float16 bytes on the wire. The neighbour table is a separate file and is not counted here.
A smaller bank is also a faster one, because the kNN compares every patch against every row. The dispatch time in the live panel at the top of this page is measured against the shipped bank on your own GPU.
Where it breaks
Some defects score lower than the worst good part, so no threshold catches them. The tables below count them by type.
Missed under the worst good, by defect type
Worst false negatives
Near the line, at the current threshold
Follows the threshold in the panel above.
Heatmaps, top-scoring test cases
These are the highest scoring cases in the run, so they are the easy ones rather than a typical sample. Rendered offline by the pipeline. The panel at the top of the page runs live instead.
This implementation against the published figures
PatchCore is Roth et al. This page is a reimplementation of it, so the question is whether it reproduces what the paper reported on the same categories.
Both columns of a gap are image AUROC on the MVTec AD test split for that category. The paper reports one figure per category and this repo carries it as data, so the gap is arithmetic on two files rather than a claim.
Runs
Every run behind this page. The backbone and the coreset are on each row because banks from different backbones have the same shape and a mixup would not show up in the file size.
These are the runs exported to this page with per-image scores. The fifteen banks the live panel downloads are a separate export and are listed in the two panels above.
What would change on a real production line
Every number on this page comes from MVTec AD, a public benchmark of screws, leather and other lab-photographed parts. No data from any manufacturer was used anywhere in this project.
Lighting
MVTec images come from a fixed rig, one geometry, even light. A line needs its own rig, and it has to be built and held fixed before any of these numbers transfer.
Part shape
Patch features assume a repeatable field of view. If the part is curved, or its geometry varies, either the pose gets fixtured or the model sees a different distribution per pose.
Cycle time
The budget is the line beat, not a benchmark. The kNN is the cost and it grows with the bank, so the bank gets compressed until it fits the beat.
Good parts to collect
The curve above answers this for MVTec. It has to be measured again on the real surface before it means anything there.
Method: Roth et al., PatchCore. Data: Bergmann et al., MVTec AD.
About
Nazar is a reimplementation of PatchCore that runs its nearest neighbour search in your browser, in hand-written WebGPU, on your own graphics card. It was built to answer the two questions a line actually asks before it buys an inspector: how many good parts must I collect first, and where do I draw the line.
The data
MVTec AD, Bergmann et al., all fifteen categories, 5,354 photographs on one bench under one fixed light. CC BY-NC-SA 4.0. The banks and heatmaps here are derived from those images and inherit that licence. No data from any manufacturer was used anywhere in this project.
The method
PatchCore, Roth et al., CVPR 2022. This page is a reimplementation, measured against the paper's own Table S1 rather than against itself. The released code scores an image with a plain max and never applies eq. 7, so both numbers are reported.
The compute
Feature extraction, the coreset and the offline scoring ran on one NVIDIA RTX 2000 Ada laptop GPU, torch 2.5.1 with CUDA 12.1. The kNN and the eq. 7 reweighting you see run live run on your GPU, in WGSL, with no framework.
The code
MIT, and the whole pipeline is one command per step. Every figure on this page is read out of a file the pipeline wrote, and the page checks its own GPU answer against that file in front of you.