Chasston commited on
Commit
a7dead4
·
verified ·
1 Parent(s): 77dff4e

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +46 -0
README.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - anomaly-detection
4
+ - computer-vision
5
+ - patchcore
6
+ - defect-detection
7
+ - industrial
8
+ datasets:
9
+ - mvtec-ad
10
+ ---
11
+
12
+ # DefectVision — PatchCore Anomaly Detection (bottle)
13
+
14
+ PatchCore implemented from scratch with PyTorch on MVTec AD.
15
+
16
+ ## Why PatchCore over YOLOv8?
17
+ | Model | Approach | Key Metric |
18
+ |-------|----------|------------|
19
+ | YOLOv8n | Supervised | mAP50 = 0.09 |
20
+ | PatchCore | Unsupervised | AUROC = 0.9976 |
21
+
22
+ YOLOv8 struggles with MVTec AD because defect images are scarce.
23
+ PatchCore trains on normal images only and generalizes to unseen defects.
24
+
25
+ ## Architecture
26
+ - **Backbone**: WideResNet50 (ImageNet pretrained)
27
+ - **Layers**: layer2 + layer3 → 1536-dim patch features
28
+ - **Memory Bank**: coreset 10% of train patches
29
+ - **Scoring**: max nearest-neighbor distance (k=9)
30
+
31
+ ## Metrics — bottle
32
+ - **AUROC** : 0.9976
33
+ - **Best F1**: 0.9920
34
+
35
+ ## Usage
36
+ ```python
37
+ import torch
38
+ from huggingface_hub import hf_hub_download
39
+
40
+ path = hf_hub_download(repo_id='Chasston/defect-vision-patchcore-bottle', filename='memory_bank.pt')
41
+ data = torch.load(path)
42
+ memory_bank = data['memory_bank']
43
+ ```
44
+
45
+ ## Author
46
+ [Chasston](https://huggingface.co/Chasston)