W-GAN - Discriminator/Critic - Anomaly detection possible?

Hello guys,

I`m quite new to the topic of using GANs, in particular the discriminator of them, to classify images whether they are normal or abnormal regarding a before defined and trained on normal dataset. I started first with a normal Wasserstein-GAN-GP, coded by Aladdin Persson, that is provided on the below linked Git repository:

Machine-Learning-Collection/ML/Pytorch/GANs/4. WGAN-GP at master · aladdinpersson/Machine-Learning-Collection · GitHub

I am able to produce nice looking fake images based on the probability distribution of my custom data set. But I dont know how to understand the underlying loss function of the critic (discriminator) and how I can use this critic after training to classify some never seen before test data whether it is normal or abnormal (meaning if it fits to the trained data distribution). How do I get the critic to provide an Anomaly Score, where a particular threshold defines whether an input image is normal or abnormal.

Is this possible?

Many thanks in advance!