hcw-00 / PatchCore_anomaly_detection

Unofficial implementation of PatchCore anomaly detection
Apache License 2.0
317 stars 95 forks source link

low quality anomaly_map for type "good" #14

Open coordxyz opened 2 years ago

coordxyz commented 2 years ago

Hi, I'm confusing about the low quality anomaly_map for type "good" and high AUROC scores for both image and pixel level. How to calculate the AUROC scores from the anomaly_map? Thanks~ Such as examples of "bottle" shown below. good_014 good_014_amap good_014_amap_on_img

hcw-00 commented 2 years ago

Hi. It is normal. Anomaly map you see is minmax normalized one.

coordxyz commented 2 years ago

Thank you for reply. BTW, the following line causes error of "ValueError: invalid literal for int() with base 10: '0.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.00".

selected_idx = selector.select_batch(model=self.randomprojector, already_selected=[], N=int((total_embeddings.shape[0]*args.coreset_sampling_ratio)))

I fix it by doing this but I don't know why.

selected_idx = selector.select_batch(model=self.randomprojector, already_selected=[], N=int((total_embeddings.shape[0]*0.001)))

dhkdnduq commented 2 years ago

NG image Good image

You have to use min,max of all the data.

ghost commented 2 years ago

Thank you for reply. BTW, the following line causes error of "ValueError: invalid literal for int() with base 10: '0.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.00".

selected_idx = selector.select_batch(model=self.randomprojector, already_selected=[], N=int((total_embeddings.shape[0]*args.coreset_sampling_ratio)))

I fix it by doing this but I don't know why.

selected_idx = selector.select_batch(model=self.randomprojector, already_selected=[], N=int((total_embeddings.shape[0]*0.001)))

image

If the argument value is simply used, it is input in the form of a string. so, data type of the argument values must be specified. like the picture above