ORippler / gaussian-ad-mvtec

Code underlying our publication "Modeling the Distribution of Normal Data in Pre-Trained Deep Features for Anomaly Detection" at ICPR2020
GNU Affero General Public License v3.0
99 stars 18 forks source link

Applying custom dataset without ground truth masks #2

Closed andreluizbvs closed 3 years ago

andreluizbvs commented 3 years ago

Is it possible to test on my own dataset considering there are no ground truth masks? I created my own my_ad_dataset.py, but without success.

In other words, I would like to apply this method only in image-level anomaly detection. Is it possible to do it without major code changes?

ORippler commented 3 years ago

Hi,

I would assume that the code itself runs fine if you provide dummy values for the min_anomaly_size of your dataset as well as generate random masks by sampling from np.random.randint(0,1, size=(image.shape[0], image.shape[1])). This would of course give you nonsensical values for everything the gt-masks are used for (it's not used for image-level AD calculation of the Gaussian AD method). Sampling from np.random.randint is necessary so ROC-computation does not error out when only identical values are present in the gt.

Refer here on where zero-value masks are generated for good images, which also do not have ground-truth segmentation masks available.

Best,

bartproo commented 3 years ago

Hi, if masks are not required in the gaussian model, why do we need it in the test_step?