/f-AnoGAN-1

Implementation of f-AnoGAN with PyTorch

Primary LanguageJupyter NotebookMIT LicenseMIT

f-AnoGAN

f-AnoGAN is a GAN for anomaly detection. One of the features of this GAN is that two adversarial networks (Generator and Discriminator) and Encoder are trained separately. In addition, an anomaly score is computed by both a discriminator feature residual error and an image reconstruction error.

References

Papar

Github

fanogan/model.py, fanogan/train_wgangp.py and fanogan/train_encoder_izif.py are modified eriklindernoren's wgan_gp.py for f-AnoGAN.

Requirements

Python 3.6 or later
PyTorch 1.x

Matplotlib
Numpy
pandas
scikit-learn

Usage

Please run below in order.

Step: 0

python setup.py install
cd mnist

Step: 1

python train_wgangp.py --training_label 1

Step: 2

python train_encoder_izif.py --training_label 1

Step: 3

python test_anomaly_detection.py --training_label 1

After Step: 3, score.csv will be generated in the directory results.

See visualization.ipynb about data visualization for score.csv.

Colaboratory

f-AnoGAN.ipynb