Home

Awesome

Sub-Image Anomaly Detection with Deep Pyramid Correspondences (SPADE) in PyTorch

PyTorch implementation of Sub-Image Anomaly Detection with Deep Pyramid Correspondences (SPADE).

SPADE presents an anomaly segmentation approach which does not require a training stage.
It is fast, robust and achieves SOTA on MVTec AD dataset.

Prerequisites

Install prerequisites with:

pip install -r requirements.txt

If you already download MVTec AD dataset, move a file to data/mvtec_anomaly_detection.tar.xz.
If you don't have a dataset file, it will be automatically downloaded during the code running.

Usage

To test SPADE on MVTec AD dataset:

cd src
python main.py

After running the code above, you can see the ROCAUC results in src/result/roc_curve.png

Results

Below is the implementation result of the test set ROCAUC on the MVTec AD dataset.

1. Image-level anomaly detection accuracy (ROCAUC %)

PaperImplementation
bottle-97.2
cable-84.8
capsule-89.7
carpet-92.8
grid-47.3
hazelnut-88.1
leather-95.4
metal_nut-71.0
pill-80.1
screw-66.7
tile-96.5
toothbrush-88.9
transistor-90.3
wood-95.8
zipper-96.6
Average85.585.4

2. Pixel-level anomaly detection accuracy (ROCAUC %)

PaperImplementation
bottle98.497.0
cable97.292.3
capsule99.098.4
carpet97.598.9
grid93.798.3
hazelnut99.198.5
leather97.699.3
metal_nut98.197.1
pill96.595.0
screw98.999.1
tile87.492.8
toothbrush97.998.8
transistor94.186.6
wood88.595.3
zipper96.598.6
Average96.596.4

ROC Curve

roc

Localization results

bottle
cable
capsule
carpet
grid
hazelnut
leather
metal_nut
pill
screw
tile
toothbrush
transistor
wood
zipper