This is the accompanying toolbox for the paper "A Survey on GANs for Anomaly Detection"

Overview

Anomaly Toolbox

Description

Anomaly 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:

We provided the MNIST dataset 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 as MNIST, FashionMNIST, CIFAR-10, and KDD99. 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 Start

  • First thing first, install the toolbox
pip install anomaly-toolbox

Then 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 file hparams.json and the MNIST dataset:
anomaly-box.py --experiment GANomalyExperiment --hps-path path/to/config/hparams.json --dataset 
MNIST 
  • Otherwise, you can run all the experiments using the pre-defined hyperparameters file hparams. json and the MNIST dataset:
anomaly-box.py --run-all --hps-path path/to/config/hparams.json --dataset MNIST 

For any other information, feel free to check the help:

anomaly-box.py --help

Contribution

This work is completely open source, and we would appreciate any contribution to the code. Any merge request to enhance, correct or expand the work is welcome.

Notes

The 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.

Installation

pip install anomaly-toolbox

Usage

Options:
  --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 Datasets

The provided datasets are:

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 the AnomalyDetectionDataset abstract class implementing its own configure method. For a more detailed guide, the user can refer to the README.md file inside the src/anomaly_toolbox/datasets folder. Moreover, in the examples folder, the user can find a dummy.py module with the basic skeleton code to implement a dataset.

References

Comments
  • --run-all in README is misleading

    --run-all in README is misleading

    • Anomaly Toolbox version: 0.1.0
    • Python version: 3.9
    • Operating System: Arch Linux

    Description

    In the main README section, the examples are misleading. A correction is needed in the --run-all part of the command.

    opened by iLeW 1
  • Copyright shadows the python shebang line

    Copyright shadows the python shebang line

    • Anomaly Toolbox version: 0.1.0
    • Python version: 3.9
    • Operating System: Arch Linux

    Description

    Bug on the core anomaly-toolbox app. The app does not start because of the copyright description that shadows the #!/usr/bin/env python3 shebang line header.

    What I Did

    anomaly-box.py --run-all --hps-path path/to/config/hparams.json --dataset MNIST
    
    opened by iLeW 1
  • CVE-2007-4559 Patch

    CVE-2007-4559 Patch

    Patching CVE-2007-4559

    Hi, we are security researchers from the Advanced Research Center at Trellix. We have began a campaign to patch a widespread bug named CVE-2007-4559. CVE-2007-4559 is a 15 year old bug in the Python tarfile package. By using extract() or extractall() on a tarfile object without sanitizing input, a maliciously crafted .tar file could perform a directory path traversal attack. We found at least one unsantized extractall() in your codebase and are providing a patch for you via pull request. The patch essentially checks to see if all tarfile members will be extracted safely and throws an exception otherwise. We encourage you to use this patch or your own solution to secure against CVE-2007-4559. Further technical information about the vulnerability can be found in this blog.

    If you have further questions you may contact us through this projects lead researcher Kasimir Schulz.

    opened by TrellixVulnTeam 0
  • how to run>

    how to run>

    is it possible to describe the implementation of the code?

    i run this pip install anomaly-toolbox

    in colab it show this error

    ERROR: Could not find a version that satisfies the requirement anomaly-toolbox (from versions: none) ERROR: No matching distribution found for anomaly-toolbox

    opened by elinaroz 2
  • GANomaly implementation error

    GANomaly implementation error

    I found this repository from your study "A Survey on GANs for Anomaly Detection". Wanting to reimplement the GANomaly model, I've been looking at your implementation. Upon comparison to the original study and code, it seems that the implementation of GANomaly is incorrect.

    It seems that you have only one instance of the encoder, whereas the original study has two instances. Moreover, they say the following in the original GANomaly paper:

    The second sub-network is the encoder network E that compresses the image ˆx that is reconstructed by the network G. With different parametrization, it has the same architectural details as G_E.

    This seems like an issue that could compromise the study results.

    opened by paulvinell 1
Owner
Zuru Tech
Open source @ ZURU Tech
Zuru Tech
Codes accompanying the paper "Learning Nearly Decomposable Value Functions with Communication Minimization" (ICLR 2020)

NDQ: Learning Nearly Decomposable Value Functions with Communication Minimization Note This codebase accompanies paper Learning Nearly Decomposable Va

Tonghan Wang 69 Nov 26, 2022
Code accompanying our paper Feature Learning in Infinite-Width Neural Networks

Empirical Experiments in "Feature Learning in Infinite-width Neural Networks" This repo contains code to replicate our experiments (Word2Vec, MAML) in

Edward Hu 37 Dec 14, 2022
Official repository with code and data accompanying the NAACL 2021 paper "Hurdles to Progress in Long-form Question Answering" (https://arxiv.org/abs/2103.06332).

Hurdles to Progress in Long-form Question Answering This repository contains the official scripts and datasets accompanying our NAACL 2021 paper, "Hur

Kalpesh Krishna 41 Nov 8, 2022
Code accompanying the paper "Wasserstein GAN"

Wasserstein GAN Code accompanying the paper "Wasserstein GAN" A few notes The first time running on the LSUN dataset it can take a long time (up to an

null 3.1k Jan 1, 2023
PyTorch code accompanying our paper on Maximum Entropy Generators for Energy-Based Models

Maximum Entropy Generators for Energy-Based Models All experiments have tensorboard visualizations for samples / density / train curves etc. To run th

Rithesh Kumar 135 Oct 27, 2022
Datasets accompanying the paper ConditionalQA: A Complex Reading Comprehension Dataset with Conditional Answers.

ConditionalQA Datasets accompanying the paper ConditionalQA: A Complex Reading Comprehension Dataset with Conditional Answers. Disclaimer This dataset

null 2 Oct 14, 2021
Code accompanying the paper "How Tight Can PAC-Bayes be in the Small Data Regime?"

How Tight Can PAC-Bayes be in the Small Data Regime? This is the code to reproduce all experiments for the following paper: @inproceedings{Foong:2021:

null 5 Dec 21, 2021
Code repository accompanying the paper "On Adversarial Robustness: A Neural Architecture Search perspective"

On Adversarial Robustness: A Neural Architecture Search perspective Preparation: Clone the repository: https://github.com/tdchaitanya/nas-robustness.g

Chaitanya Devaguptapu 4 Nov 10, 2022
Code accompanying "Dynamic Neural Relational Inference" from CVPR 2020

Code accompanying "Dynamic Neural Relational Inference" This codebase accompanies the paper "Dynamic Neural Relational Inference" from CVPR 2020. This

Colin Graber 48 Dec 23, 2022
Code accompanying "Learning What To Do by Simulating the Past", ICLR 2021.

Learning What To Do by Simulating the Past This repository contains code that implements the Deep Reward Learning by Simulating the Past (Deep RSLP) a

Center for Human-Compatible AI 24 Aug 7, 2021
This repository contains the accompanying code for Deep Virtual Markers for Articulated 3D Shapes, ICCV'21

Deep Virtual Markers This repository contains the accompanying code for Deep Virtual Markers for Articulated 3D Shapes, ICCV'21 Getting Started Get sa

KimHyomin 45 Oct 7, 2022
Collection of NLP model explanations and accompanying analysis tools

Thermostat is a large collection of NLP model explanations and accompanying analysis tools. Combines explainability methods from the captum library wi

null 126 Nov 22, 2022
(JMLR'19) A Python Toolbox for Scalable Outlier Detection (Anomaly Detection)

Python Outlier Detection (PyOD) Deployment & Documentation & Stats Build Status & Coverage & Maintainability & License PyOD is a comprehensive and sca

Yue Zhao 6.6k Jan 3, 2023
A Topic Modeling toolbox

Topik A Topic Modeling toolbox. Introduction The aim of topik is to provide a full suite and high-level interface for anyone interested in applying to

Anaconda, Inc. (formerly Continuum Analytics, Inc.) 93 Dec 1, 2022
Bolt Online Learning Toolbox

Bolt Online Learning Toolbox Bolt features discriminative learning of linear predictors (e.g. SVM or Logistic Regression) using fast online learning a

Peter Prettenhofer 87 Dec 12, 2022
Machine Learning toolbox for Humans

Reproducible Experiment Platform (REP) REP is ipython-based environment for conducting data-driven research in a consistent and reproducible way. Main

Yandex 662 Nov 20, 2022
Toolbox of models, callbacks, and datasets for AI/ML researchers.

Pretrained SOTA Deep Learning models, callbacks and more for research and production with PyTorch Lightning and PyTorch Website • Installation • Main

Pytorch Lightning 1.4k Dec 30, 2022
EasyMocap is an open-source toolbox for markerless human motion capture from RGB videos.

EasyMocap is an open-source toolbox for markerless human motion capture from RGB videos. In this project, we provide the basic code for fitt

ZJU3DV 2.2k Jan 5, 2023
A PyTorch Toolbox for Face Recognition

FaceX-Zoo FaceX-Zoo is a PyTorch toolbox for face recognition. It provides a training module with various supervisory heads and backbones towards stat

JDAI-CV 1.6k Jan 6, 2023