This is the official repository to the WACV 2021 paper "Same Same But DifferNet: Semi-Supervised Defect Detection with Normalizing Flows" by Marco Rudolph, Bastian Wandt and Bodo Rosenhahn.
See here to see how to call the function to get gradient maps. See here to see how to get the test dataloader for that.
Alternatively you could use and modify the code of this file directly. Watch out that gradient maps are only produced if the label is 1 (=anomaly).
I use the evaluate.py script to scores some images. How can I get the gradient map from the scored images?