Reconstruction-by-inpainting-for-visual-anomaly-detection
Reconstruction-by-inpainting-for-visual-anomaly-detection copied to clipboard
This is an unofficial implementation of Reconstruction by inpainting for visual anomaly detection (RIAD).
Reconstruction by Inpainting for visual Anomaly Detection (RIAD) in PyTorch
This is an unofficial implementation of Reconstruction by inpainting for visual anomaly detection (RIAD).
PipeLine
Prerequisites
- PyTorch 1.5
- sklearn, matplotlib
- kornia ( incompatible with PyTorch>=1.6.0 so far )
The kornia package is used for its medianfilter function. You may find a substitution if you want to get rid of this dependency.
Visualization demo of randomly generated mosaic masks
Please check this mosaic.ipynb file
Usage
To train RIAD on MVTec AD
dataset:
python train.py --obj zipper --data_path [your-mvtec_ad-data-path]
Then to test:
python test.py --obj zipper --data_path [your-mvtec_ad-data-path] --checkpoint_dir [your-saved-weights-path]
Finally, you will get results like img_ROCAUC (anomaly detection) around 0.97 and pixel_ROCAUC (anomaly segmetation) around 0.98
Localization results
References
Vitjan Zavrtanik, Matej Kristan, Danijel Skčaj,
Reconstruction by inpainting for visual anomaly detection,
Pattern Recognition,
2020,
107706,
ISSN 0031-3203
Acknowledgement
Thanks for the paper authors.
A big thanks to xiahaifeng1995 for contributing most of the codes.