All Projects → LeeDoYup → Anogan Tf

LeeDoYup / Anogan Tf

Licence: mit
Unofficial Tensorflow Implementation of AnoGAN (Anomaly GAN)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Anogan Tf

Igan
Interactive Image Generation via Generative Adversarial Networks
Stars: ✭ 3,845 (+1663.76%)
Mutual labels:  gan, generative-adversarial-network, dcgan
Gans In Action
Companion repository to GANs in Action: Deep learning with Generative Adversarial Networks
Stars: ✭ 748 (+243.12%)
Mutual labels:  gan, generative-adversarial-network, dcgan
Awesome Gans
Awesome Generative Adversarial Networks with tensorflow
Stars: ✭ 585 (+168.35%)
Mutual labels:  gan, generative-adversarial-network, dcgan
Tensorflow Mnist Gan Dcgan
Tensorflow implementation of Generative Adversarial Networks (GAN) and Deep Convolutional Generative Adversarial Netwokrs for MNIST dataset.
Stars: ✭ 163 (-25.23%)
Mutual labels:  gan, generative-adversarial-network, dcgan
Deep Learning With Python
Example projects I completed to understand Deep Learning techniques with Tensorflow. Please note that I do no longer maintain this repository.
Stars: ✭ 134 (-38.53%)
Mutual labels:  gan, generative-adversarial-network, dcgan
Pytorch Mnist Celeba Gan Dcgan
Pytorch implementation of Generative Adversarial Networks (GAN) and Deep Convolutional Generative Adversarial Networks (DCGAN) for MNIST and CelebA datasets
Stars: ✭ 363 (+66.51%)
Mutual labels:  gan, generative-adversarial-network, dcgan
Context Encoder
[CVPR 2016] Unsupervised Feature Learning by Image Inpainting using GANs
Stars: ✭ 731 (+235.32%)
Mutual labels:  gan, generative-adversarial-network, dcgan
GAN-Project-2018
GAN in Tensorflow to be run via Linux command line
Stars: ✭ 21 (-90.37%)
Mutual labels:  generative-adversarial-network, gan, dcgan
Gpnd
Generative Probabilistic Novelty Detection with Adversarial Autoencoders
Stars: ✭ 112 (-48.62%)
Mutual labels:  gan, generative-adversarial-network, anomaly-detection
Dcgan Tensorflow
A Tensorflow implementation of Deep Convolutional Generative Adversarial Networks trained on Fashion-MNIST, CIFAR-10, etc.
Stars: ✭ 70 (-67.89%)
Mutual labels:  gan, generative-adversarial-network, dcgan
Dcgan
The Simplest DCGAN Implementation
Stars: ✭ 286 (+31.19%)
Mutual labels:  gan, generative-adversarial-network, dcgan
Semantic image inpainting
Semantic Image Inpainting
Stars: ✭ 140 (-35.78%)
Mutual labels:  gan, generative-adversarial-network, dcgan
DLSS
Deep Learning Super Sampling with Deep Convolutional Generative Adversarial Networks.
Stars: ✭ 88 (-59.63%)
Mutual labels:  generative-adversarial-network, gan, dcgan
Image generator
DCGAN image generator 🖼️.
Stars: ✭ 173 (-20.64%)
Mutual labels:  gan, generative-adversarial-network, dcgan
Unsupervised-Anomaly-Detection-with-Generative-Adversarial-Networks
Unsupervised Anomaly Detection with Generative Adversarial Networks on MIAS dataset
Stars: ✭ 95 (-56.42%)
Mutual labels:  gan, dcgan, anomaly-detection
Ad examples
A collection of anomaly detection methods (iid/point-based, graph and time series) including active learning for anomaly detection/discovery, bayesian rule-mining, description for diversity/explanation/interpretability. Analysis of incorporating label feedback with ensemble and tree-based detectors. Includes adversarial attacks with Graph Convolutional Network.
Stars: ✭ 641 (+194.04%)
Mutual labels:  gan, generative-adversarial-network, anomaly-detection
catgan pytorch
Unsupervised and Semi-supervised Learning with Categorical Generative Adversarial Networks
Stars: ✭ 50 (-77.06%)
Mutual labels:  generative-adversarial-network, gan, dcgan
Pix2pix
Image-to-image translation with conditional adversarial nets
Stars: ✭ 8,765 (+3920.64%)
Mutual labels:  gan, generative-adversarial-network, dcgan
Generative adversarial networks 101
Keras implementations of Generative Adversarial Networks. GANs, DCGAN, CGAN, CCGAN, WGAN and LSGAN models with MNIST and CIFAR-10 datasets.
Stars: ✭ 138 (-36.7%)
Mutual labels:  gan, generative-adversarial-network, dcgan
Anogan Keras
Unsupervised anomaly detection with generative model, keras implementation
Stars: ✭ 157 (-27.98%)
Mutual labels:  gan, generative-adversarial-network, anomaly-detection

AnoGAN in tensorflow

Tensorflow implementation of Anomaly GAN (AnoGAN).

This model detect anomaly part in images, after training DCGAN with normal dataset.

(In Korean, H. Kim's detail explanation is here)

Basic model is DCGAN (Deep Convolutional Generative Adversarial Networks).

  • (Anomaly Detection of MNIST is not yet available)

Model Description

After learn DCGAN model with normal dataset (not contains anomalies),

  • Anomaly Detector calculates anomaly score of unseen images.

Model Structure

When unseen data comes, the model tries to find latent variable z that generates input image using backpropagation. (similar with style transfer)

Anomaly Score is based on residual and discrimination losses.

  • Residual loss: L1 distance between generated image by z and unseen test image.
  • Discrimination loss: L1 distacne between hidden representations of generated and test image, extracted by discriminators.

Res_Loss

Discrimination Loss

Total Loss for finding latent variable z is weighted sum of the two. (defualt lambda = 0.1)

Total Loss

File Descriptions

  • main.py : Main function of implementations, contained argument parsers, model construction, and test.
  • model.py : DCGAN class (containing anomaly detection function. Imple core)
  • download.py : Files for downloading celebA, LSUN, and MNIST.
  • ops.py : Some operation functions with tensorflow.
  • utils.py : Some functions dealing with image preprocessing.

Prerequisites (my environments)

Usage

First, you "must" have trained DCGAN model with normal dataset.

If you have checkpoint file, the model tries to use it.

Model Preparation

(If you want to download and train the model) First, download dataset with:

$ python download.py mnist celebA

To train a model with downloaded dataset:

$ python main.py --dataset mnist --input_height=28 --output_height=28 --train
$ python main.py --dataset celebA --input_height=108 --train --crop

Or, you can use your own dataset (without central crop) by:

$ mkdir data/DATASET_NAME
... add images to data/DATASET_NAME ...
$ python main.py --dataset DATASET_NAME --train
$ python main.py --dataset DATASET_NAME
$ # example
$ python main.py --dataset=eyes --input_fname_pattern="*_cropped.png" --train

Anomaly Detection

After having trained DCGAN model, you have to prepare test images for anomaly detection.

$ mkdir ./test_data
... add test images to ./test_data ...

$ python main.py --dataset DATASET_NAME --input_height=108 --crop --anomaly_test

Results

To valid the model implementation, simple test was proceeded.

Initial generated image by DCGAN in training is conisdered as anomaly.

After learns DCGAN model, compared final and initial images on certain latent varaible z.

Then, anomaly score of initial images was calculated.

Eyes, mouth, and distorted parts in image were detected.

result

Related works

To Do

You can always request pull requests with feeling free.

  • [ ] Threshold Setting Function (Manual/Automatic)
  • [ ] Add performance measures of anomaly detection with labels (ROC AUC)
  • [ ] Visaulization of anomaly detection results (t-SNE)

Acknowledgement

  • Thanks for @carpedm20 's implementation of DCGAN. I implemented AnoGAN based on his implementation.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].