Anomaly detection with GAN

664 Views Asked by At

There's something about GAN's training that i don't understand. I am making a GAN for Anomaly Detection. To start I followed this guide here to create a DCGAN (and understand how it works) and then move into the Anomaly Detection stuff.

I understand how the two training's phases work for GANs and after nearly 2000 epochs the generator generate some good fake images. The problem is that the discriminator is not good to detect anomalies: if i try to give in input a real image, it produce a value between 0.5 and 1, no matter if the image has anomaly or not.

So basically, the discriminator is good to distinguish real images from fake images, but not good to discriminate real images with anomalies.

I tried to train the model some more but the results won't change (instead, it seems worst than before!). The two losses keep varing around 0 and 1, for example now the model has:

gen_loss: 0.97844017, disc_loss: 0.9973822

What should I do to improve my net and make anomaly detection? It needs to be trained even more to make a better discriminator or for make anomaly detection should i add something more?

Thanks in advice, i'm definitely doing something wrong. If needed i can post some code and more information about my net.

P.S. My notebook is very similar to the one i linked before, the only difference is that i tried to feed test images to the discriminator after the training.

1

There are 1 best solutions below

0
On

There is this interesting paper Efficient GAN-based anomaly detection.
To evaluate the anomaly detection, they use the following experimental setting

MNIST: We generated 10 different datasets from MNIST by successively making each digit class an anomaly and treating the remaining 9 digits as normal examples. The training set consists of 80% of the normal data and the test set consists of the remaining 20% of normal data and all of the anomalous data. All models were trained only with normal data and tested with both normal and anomalous data.