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
48 stars 6 forks source link

Guidelines for choosing the hyper parameters #1

Closed eliahuhorwitz closed 2 years ago

eliahuhorwitz commented 2 years ago

Hey, Thank you for the code, the paper is very interesting and your results are impressive! Could you please give some guidelines as to how should I choose the hyper parameters of the augmentations? The README has an example with Shift-Intensity-923874273, is that the setting that gets the best results?

Given a new dataset, how should I choose the following parameters and how accurate do they have to be? WIDTH_BOUNDS_PCT MIN_OVERLAP_PCT MIN_OBJECT_PCT NUM_PATCHES INTENSITY_LOGISTIC_PARAMS BACKGROUND

Thanks, Eliahu

hmsch commented 2 years ago

Hi Eliahu,

There are some notes in appendix A of the arXiv preprint about how the hyperparameters were chosen. These parameters were not chosen in a data-driven way (e.g. using a validation set) to be optimal values, so I wouldn't be surprised if you can get similar results with slightly different parameters. Many of these parameters specify constraints to make the synthetic anomalies more relevant (e.g. by preventing anomalies from being generated entirely in the background).

To pick the parameters you listed for a different dataset, I'd recommend generating some examples and plotting the generated images, labels, background and object masks, etc.

Shift-Intensity-<random seed> (using cv2.NORMAL_CLONE which we used for objects) and Shift-Intensity-M-<random seed> (using cv2.MIXED_CLONE which we used for textures) correspond to the settings for NSA (logistic) in the preprint which was our top-performing variant.