Home

Awesome

PaDiM-Anomaly-Detection-Localization-master

This is an implementation of the paper PaDiM: a Patch Distribution Modeling Framework for Anomaly Detection and Localization.

This code is heavily borrowed from both SPADE-pytorch(https://github.com/byungjae89/SPADE-pytorch) and MahalanobisAD-pytorch(https://github.com/byungjae89/MahalanobisAD-pytorch) projects

<p align="center"> <img src="imgs/pic1.png" width="1000"\> </p>

Requirement

Datasets

MVTec AD datasets : Download from MVTec website

Results

Implementation results on MVTec

MvTecR18-Rd100WR50-Rd550
Carpet0.9840.999
Grid0.8980.957
Leather0.9881.0
Tile0.9590.974
Wood0.9900.988
All texture classes0.9640.984
Bottle0.9960.998
Cable0.8550.922
Capsule0.8700.915
Hazelnut0.8410.933
Metal nut0.9740.992
Pill0.8690.944
Screw0.7450.844
Toothbrush0.9470.972
Transistor0.9250.978
Zipper0.7410.909
All object classes0.8760.941
All classes0.9050.955
MvTecR18-Rd100WR50-Rd550
Carpet0.9880.990
Grid0.9360.965
Leather0.9900.989
Tile0.9170.939
Wood0.9400.941
All texture classes0.9530.965
Bottle0.9810.982
Cable0.9490.968
Capsule0.9820.986
Hazelnut0.9790.979
Metal nut0.9670.971
Pill0.9460.961
Screw0.9720.983
Toothbrush0.9860.987
Transistor0.9680.975
Zipper0.9760.984
All object classes0.9710.978
All classes0.9650.973

ROC Curve

<p align="center"> <img src="imgs/roc_curve_r18.png" width="1000"\> </p> <p align="center"> <img src="imgs/roc_curve_wr50.png" width="1000"\> </p>

Localization examples

<p align="center"> <img src="imgs/bottle.png" width="600"\> </p> <p align="center"> <img src="imgs/cable.png" width="600"\> </p> <p align="center"> <img src="imgs/capsule.png" width="600"\> </p> <p align="center"> <img src="imgs/carpet.png" width="600"\> </p> <p align="center"> <img src="imgs/grid.png" width="600"\> </p> <p align="center"> <img src="imgs/hazelnut.png" width="600"\> </p> <p align="center"> <img src="imgs/leather.png" width="600"\> </p> <p align="center"> <img src="imgs/metal_nut.png" width="600"\> </p> <p align="center"> <img src="imgs/pill.png" width="600"\> </p> <p align="center"> <img src="imgs/screw.png" width="600"\> </p> <p align="center"> <img src="imgs/tile.png" width="600"\> </p> <p align="center"> <img src="imgs/toothbrush.png" width="600"\> </p> <p align="center"> <img src="imgs/transistor.png" width="600"\> </p> <p align="center"> <img src="imgs/wood.png" width="600"\> </p> <p align="center"> <img src="imgs/zipper.png" width="600"\> </p>

Reference

[1] Thomas Defard, Aleksandr Setkov, Angelique Loesch, Romaric Audigier. PaDiM: a Patch Distribution Modeling Framework for Anomaly Detection and Localization. https://arxiv.org/pdf/2011.08785

[2] https://github.com/byungjae89/SPADE-pytorch

[3] https://github.com/byungjae89/MahalanobisAD-pytorch