Package: anomaly-toolbox
Anomaly ToolboxDescriptionAnomaly Toolbox Powered by GANs.This is the accompanying toolbox for the paper "A
Survey on GANs for Anomaly Detection" (https://arxiv.org/pdf/1906.11632.pdf).The toolbox is meant to be used by the user to explore the performance of different GAN based
architectures (in our work aka "experiments"). It also already provides some datasets to
perform experiments on:MNIST,Corrupted MNIST,Surface Cracks(https://www.kaggle.com/arunrk7/surface-crack-detection),MVTec AD(https://www.mvtec.com/fileadmin/Redaktion/mvtec.
com/company/research/datasets/mvtec_ad.pdf).We provided theMNISTdataset because the original works extensively use it. On the other hand,
we have also added the previously listed datasets both because used by a particular
architecture and because they contribute a good benchmark for the models we have implemented.All the architectures were tested on commonly used datasets such asMNIST,FashionMNIST,CIFAR-10, andKDD99. Some of them were even tested on more specific datasets, such as an
X-Ray dataset that, however, we could not provide because of the impossibility of getting the
data (privacy reasons).The user can create their own dataset and use it to test the models.Quick StartFirst thing first, install the toolboxpipinstallanomaly-toolboxThen you can choose what experiment to run. For example:Run the GANomaly experiment (i.e., the GANomaly architecture) with hyperparameters tuning
enabled, the pre-defined hyperparameters filehparams.jsonand theMNISTdataset:anomaly-box.py--experimentGANomalyExperiment--hps-pathpath/to/config/hparams.json--datasetMNISTOtherwise, you can run all the experiments using the pre-defined hyperparameters filehparams.
jsonand theMNISTdataset:anomaly-box.py--run-all--hps-pathpath/to/config/hparams.json--datasetMNISTFor any other information, feel free to check the help:anomaly-box.py--helpContributionThis work is completely open source, andwe would appreciate any contribution to the code.
Any merge request to enhance, correct or expand the work is welcome.NotesThe structures of the models inside the toolbox come from their respective papers. We have tried to
respect them as much as possible. However, sometimes, due to implementation issues, we had to make
some minor-ish changes. For this reason, you could find out that, in some cases, some features
such as the number of layers, the size of kernels, or other such things may differ from the
originals.However, you don't have to worry. The heart and purpose of the architectures have remained intact.Installationpip install anomaly-toolboxUsageOptions:
  --experiment [AnoGANExperiment|DeScarGANExperiment|EGBADExperiment|GANomalyExperiment]
                                  Experiment to run.
  --hps-path PATH                 When running an experiment, the path of the
                                  JSON file where all the hyperparameters are
                                  located.  [required]
  --tuning BOOLEAN                If you want to use hyperparameters tuning,
                                  use 'True' here. Default is False.
  --dataset TEXT                  The dataset to use. Can be a ready to use
                                  dataset, or a .py file that implements the
                                  AnomalyDetectionDataset interface
                                  [required]
  --run-all BOOLEAN               Run all the available experiments
  --help                          Show this message and exit.Datasets and Custom DatasetsThe provided datasets are:MNISTCorrupted MnistSurface Crack (https://www.kaggle.com/arunrk7/surface-crack-detection)MVTec AD (https://www.mvtec.com/fileadmin/Redaktion/mvtec.com/company/research/datasets/mvtec_ad.pdf)and are automatically downloaded when the user makes a specific choice: ["MNIST",
"CorruptedMNIST", "SurfaceCracks","MVTecAD"].The user can also add its own specific dataset. To do this, the new dataset should inherit from
theAnomalyDetectionDatasetabstract class implementing its ownconfiguremethod. For a more
detailed guide, the user can refer to theREADME.mdfile inside thesrc/anomaly_toolbox/datasetsfolder. Moreover, in theexamplesfolder, the user can find adummy.pymodule with the basic skeleton code to implement a dataset.ReferencesGANomaly:Paper:https://arxiv.org/abs/1805.06725Code:https://github.com/samet-akcay/ganomalyEGBAD (BiGAN):Paper:https://arxiv.org/abs/1802.06222Code:https://github.com/houssamzenati/Efficient-GAN-Anomaly-DetectionAnoGAN:Paper:https://arxiv.org/abs/1703.05921Code (not official):https://github.com/LeeDoYup/AnoGANCode (not official):https://github.com/tkwoo/anogan-kerasDeScarGAN:Paper:https://arxiv.org/abs/2007.14118Code:https://github.com/JuliaWolleb/DeScarGAN