hmsch / natural-synthetic-anomalies

Code for ECCV 2022 paper "Natural Synthetic Anomalies for Self-Supervised Anomaly Detection and Localization".
https://arxiv.org/abs/2109.15222
MIT License
50 stars 6 forks source link

The results of using the provided code are very different from the results of the article #4

Closed zhangzilongc closed 2 years ago

zhangzilongc commented 2 years ago

I use the official code to run the carpet class in the MVTec (only change the -o: python3 train_mvtec.py -s Shift-Intensity-923874273 -d '/path/to/mvtec_ad/images/' -o "./output" -n "carpet"), the result is AUROC 0.58, sample AP: 0.74, pixel AP: 0.1, this is very different from the original result. Please let the authors provide the correct setups for different objects in the MVTec dataset.

hmsch commented 2 years ago

Quoting from the supplement of the paper:

For NSA, we use mixed gradients for all rCXR data and for MVTec AD texture classes. For MVTec AD object classes, we find that OpenCV’s [3] seamless cloning method causes artifacts when there are sharp contrast changes (e.g., at the boundary from the object to the background) near the edges of the patch boundary more frequently when using mixed gradients than source gradients. Thus, we only use source gradients for these classes for NSA.

Carpet is a texture class, so a setting matching the paper would be Shift-Intensity-M-923874273. I'll add an example to the README to include a texture example command in addition to the current object example.