Skip to content

junming732/mvtec-anomaly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mvtec-anomaly

Industrial Anomaly Detection: PatchCore vs EfficientAD on MVTec AD

Compares two SOTA unsupervised anomaly detection methods on the MVTec AD benchmark — a memory-based approach (PatchCore) and a knowledge-distillation approach (EfficientAD) — with a Gradio demo for interactive defect visualisation.

Structure

mvtec-anomaly/
├── app.py                    # Gradio demo
├── data/
│   ├── mvtec_dataset.py      # Dataset loader 
│   └── download_mvtec.sh     # Download instructions
├── models/
│   ├── patchcore.py          # PatchCore (CVPR 2022)
│   └── efficientad.py        # EfficientAD (WACV 2024)
├── scripts/
│   ├── train.py              # Train + evaluate, auto-generates plots
│   └── plot_results.py       # Heatmap grids + comparison charts
├── utils/
│   ├── paths.py              # Central path config via .env
│   └── metrics.py            # AUROC, AP, PRO score
└── results/                  # Generated plots (gitignored)

Setup

python -m venv venv && source venv/bin/activate
pip install -r requirements.txt

Download MVTec AD (free, requires registration):

bash data/download_mvtec.sh

Train & Evaluate

# Single category, both models
python scripts/train.py --category bottle

# All 15 categories
python scripts/train.py --category all

# Single model
python scripts/train.py --category bottle --model patchcore

Gradio Demo

python app.py          # local
python app.py --share  # public link

Methods

Model Paper Key Idea Inference Speed
PatchCore CVPR 2022 Memory bank of normal patch features Medium
EfficientAD WACV 2024 Teacher-Student knowledge distillation Fast

Metrics

Metric Description
Image AUROC Discriminates normal vs anomalous images
Pixel AUROC Localises defects at pixel level
PRO Score Per-Region Overlap — primary MVTec metric

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors