LilitYolyan / CutPaste

Unofficial implementation of Google "CutPaste: Self-Supervised Learning for Anomaly Detection and Localization" in PyTorch
MIT License
114 stars 25 forks source link

bug in Localization #25

Open yurenzhang opened 2 years ago

yurenzhang commented 2 years ago

hi, great work. There seems to be a bug in image_patches = unfold(image).squeeze(0).reshape(-1, 3, *self.kernel_dim ) it's not unfolding correctly.

This worked for me image_patches = unfold(image).squeeze(0).permute(1,0).reshape(-1, 3, *self.kernel_dim )

btw, KDE is used for anomaly detection in the code, but in my experiments it's not necessary and slow. A simple Gaussian estimation using sklearn's mixture of gaussian estimator is fast and working fine. Just a suggestion.

princeofpython commented 2 years ago

hey, are you able to get localization.py to work? if yes, can you upload the code? Thanks in advance

Chichiviriche commented 2 years ago

I'm not able either to run properly localization.py. It's running, but I get no more than a full blue image as a heat map at the end