PaDiM-Anomaly-Detection-Localization-master

November 27, 2020 ยท View on GitHub

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

Requirement

  • python == 3.7
  • pytorch == 1.5
  • tqdm
  • sklearn
  • matplotlib

Datasets

MVTec AD datasets : Download from MVTec website

Results

Implementation results on MVTec

  • Image-level anomaly detection accuracy (ROCAUC)
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
  • Pixel-level anomaly detection accuracy (ROCAUC)
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

  • ResNet18

  • Wide_ResNet50_2

Localization examples

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