Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Visual Anomaly Detection

Unsupervised anomaly detection using PatchCore on the MVTec AD dataset. Trained only on normal images — no defect labels needed during training.

Results

Defect Type AUROC
Broken large 95.0%
Broken small 91.0%
Contamination 99.0%
Overall 99.1%

Anomaly Heatmaps

Heatmaps

AUROC Results

AUROC

What this project does

  • Loads 209 normal bottle images from MVTec AD dataset
  • Extracts patch features using pretrained ResNet50 (ImageNet)
  • Builds a memory bank of normal feature vectors
  • At test time, computes nearest-neighbor distance to flag anomalies
  • Generates pixel-level heatmaps showing exactly where defects are
  • Achieves 99.1% AUROC with no anomaly labels during training

Dataset

MVTec Anomaly Detection Dataset Bottle category: 209 normal training images, 83 test images across 3 defect types.

Method

PatchCore — memory bank based anomaly detection using pretrained ResNet50 features. No fine-tuning required. Test images are scored by their distance to the nearest neighbor in the normal feature memory bank.

Tech Stack

  • Python, PyTorch, torchvision
  • ResNet50 (pretrained on ImageNet)
  • scikit-learn (AUROC evaluation)
  • NumPy, Matplotlib, PIL
  • Kaggle (T4 GPU)

How to run

  1. Download MVTec AD bottle category from the official website
  2. Open the notebook in Kaggle
  3. Run all cells top to bottom

About

Unsupervised visual anomaly detection using PatchCore on MVTec AD, achieves 99.1% AUROC on bottle defect detection without any anomaly labels during training

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages