AI & LLM · inspect.visionCI passing
Visual Anomaly Detection
Finding surface defects it was never shown, on a CPU, from good parts only.
View the code Evaluation report Demo tour Run it ›_ last push 5 days ago
0.974mean image AUROC (per-pixel statistics: 0.847; PCA reconstruction: 0.764)
77%of defects caught while flagging about 4% of good parts
43 msper image on one CPU core, with no GPU and no pretrained network
demo Demo tour
Screenshots from the running application, with its synthetic demo data. Select one to enlarge.
01 The problem
Defects are rare and varied, so there is no labelled set of every way a part can fail. Classic methods compare each pixel with the same pixel on good parts, which breaks as soon as the texture shifts from one part to the next.
02 How it works
- Good parts only
- Filter-bank patch descriptors
- Greedy coreset memory bank
- Nearest good patch per test patch
- Anomaly map and part score
- Threshold from good parts
03 What I built
- Procedural surfaces (weave, tiles, wood) that vary from part to part, and five small, subtle defects with pixel-exact masks.
- A patch-memory detector in the spirit of PatchCore: filter-bank descriptors for every neighbourhood, a greedy-coreset memory bank of good patches, and nearest-neighbour distance as an anomaly map.
- Image and pixel AUROC per surface and defect, an ablation of the coreset, and an operating threshold set on separate good parts.
04 What I learned
Choosing the memory bank by coverage rather than at random lifted AUROC from 0.931 to 0.974: rare normal patterns otherwise look like defects.
Faint stains larger than the descriptors' neighbourhood remain the weak spot (0.883), which the report states plainly.
05 Known limitations
Every repository documents what it doesn't do yet. The main ones:
- Procedural images; real lines bring glare, dust and blur.
- Hand-built features; a pretrained backbone would handle objects as well as textures.
06 Stack
PythonNumPySciPyscikit-learnComputer vision
The repository has the design document, operations runbook, full evaluation report and known limitations. All data is synthetic, generated by code in the repository.
run Run it yourself
Every project runs on a laptop: no cloud account and no paid API needed.
git clone https://github.com/codeROCK-IZZY/visual-anomaly-detection.git
cd visual-anomaly-detection
pip install -e ".[dev]" && pytest
vad evaluate --gate # writes eval/reports/report.html

