metadata
tags:
- anomaly-detection
- computer-vision
- patchcore
- defect-detection
- industrial
datasets:
- mvtec-ad
DefectVision — PatchCore Anomaly Detection (bottle)
PatchCore implemented from scratch with PyTorch on MVTec AD.
Why PatchCore over YOLOv8?
| Model | Approach | Key Metric |
|---|---|---|
| YOLOv8n | Supervised | mAP50 = 0.09 |
| PatchCore | Unsupervised | AUROC = 0.9976 |
YOLOv8 struggles with MVTec AD because defect images are scarce. PatchCore trains on normal images only and generalizes to unseen defects.
Architecture
- Backbone: WideResNet50 (ImageNet pretrained)
- Layers: layer2 + layer3 → 1536-dim patch features
- Memory Bank: coreset 10% of train patches
- Scoring: max nearest-neighbor distance (k=9)
Metrics — bottle
- AUROC : 0.9976
- Best F1: 0.9920
Usage
import torch
from huggingface_hub import hf_hub_download
path = hf_hub_download(repo_id='Chasston/defect-vision-patchcore-bottle', filename='memory_bank.pt')
data = torch.load(path)
memory_bank = data['memory_bank']