Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Image anomaly detection with generative adversarial networks
1. Image Anomaly Detection with
Generative Adversarial Networks
Master-Seminar 1: Data Analytics
Presented by:
Sakshi Singh (305238)
Sakshi Singh (Universität Hildesheim)
Seminar 1: Data Analytics
Image Anomaly Detection with Generative Adversarial Networks
2. OUTLINE
• Abstract
• Introduction
• Related Work
• Motivation & Hypothesis
• Proposed Algorithm
• Experiments & Results
• Conclusions
• References
Seminar 1: Data Analytics
Sakshi Singh (Universität Hildesheim) 2Image Anomaly Detection with Generative Adversarial Networks
3. Paper Introduction
• Title: Image Anomaly Detection with Generative Adversarial
Networks
• Authors: Lucas Deecke, Robert Vandermeulen, Lukas Ruff,
Stephan Mandt, Marius Kloft
• Publication date: 2018/9/10
• Published by: Springer, Cham
Seminar 1: Data Analytics
Sakshi Singh (Universität Hildesheim) 3Image Anomaly Detection with Generative Adversarial Networks
4. ABSTRACT
• Detection of anomalies in high dimensional space is difficult
to achieve.
• The authors proposed a novel approach based on deep
learning: Anomaly Detection using Generative Adversarial
Networks (GAN).
• The method is build on searching a good representation of
that sample in the latent space of generator and if not found,
then the sample is considered anomalous.
• State-of-the-art is achieved on standard benchmark image
datasets.
Seminar 1: Data Analytics
Sakshi Singh (Universität Hildesheim) 4Image Anomaly Detection with Generative Adversarial Networks
5. INTRODUCTION
• Anomaly detection
Identifying unusual instances
Application areas: Astronomy, medicines, fault detection,
intrusion detection
• Traditional Algorithms for Anomaly detection: (drawbacks)
Focus on low dimensional problem
Require manual feature engineering
Sakshi Singh (Universität Hildesheim) 5Image Anomaly Detection with Generative Adversarial Networks
Seminar 1: Data Analytics
6. INTRODUCTION
• Deep Learning
Omits manual feature engineering
Works well with High Dimensional data like images
Application performance areas: Image classification, Natural
language processing, Speech recognition.
• State-of-the-art
Achieved by GAN in high-dimensional generative modelling
GAN has two neural networks- Generator and Discriminator
Generator and Discriminator compete with each other
6
Seminar 1: Data Analytics
Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
7. INTRODUCTION
• Generator
Maps random samples from low-dimensional space to high-
dimensional space.
If generator has learnt a good approximation of training data,
then for a new point there already exists a point in the latent
space which closely resembles this point.
• Discriminator
Learns to separate actual samples from the samples
generated by the Generator.
7
Seminar 1: Data Analytics
Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
8. GENERATOR Vs DISCRIMINATOR
8
Seminar 1: Data Analytics
Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
Reference[2]
9. RELATED WORK
1. Anomaly Detection (Approach 1)
Generative models estimate anomalies through estimation of
the data distribution p.
In given data, estimate p̂≈p and declare those samples which
are unlikely under p̂ to be anomalous.
Methods used:
Kernel density estimation(KDE)
Gaussians for active learning of anomalies
hidden Markov models
dynamic Bayesian networks
Sakshi Singh (Universität Hildesheim) 9Image Anomaly Detection with Generative Adversarial Networks
Seminar 1: Data Analytics
10. RELATED WORK
2. Deep Generative Models (Approach 2)
Variational Autoencoders(VAEs) have been proposed as deep
generative models.
Two approaches followed:
Optimizing over variational lower bound, parameters are tuned such
that samples resembling data is generated from a Gaussian prior.
Train pair of deep convolutional in an autoencoder setup and produce
random samples on compression manifold.
None of the approach estimates p.
The approach in paper uses deep generative models in
anomaly detection.
10Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
Seminar 1: Data Analytics
11. MOTIVATION
• Authors addressed the drawbacks of non-parametric anomaly
detection methods:
Suffer from curse of dimensionality
Inadequate for analysis and interpretation of high dimensional data
• Authors overcome these limitations by using Deep Learning
for anomaly detection which is:
End-to-end deep learning approach
Aims specifically at task of anomaly detection
11
Seminar 1: Data Analytics
Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
12. STATE-OF-THE-ART
• Achieved by GANs
• GAN provides framework to generate samples approximately
distributed to p.
• GAN attempts to learn the parameterization of neural
network
Generator(gθ): maps low-dimensional data from noise prior pz (e.g.
multi-variate Gaussian) to samples in image space (including qθ ≈ p)
Discriminator(dw): learns to classify the data from p and qθ.
• Discriminator becomes better at separating samples from p
and samples from qθ, while the generator fools the
discriminator by adjusting θ.
12
Seminar 1: Data Analytics
Sakshi Singh (Universität Hildesheim)
13. GAN and WGAN
• Objective function of GAN
where z: vectors lying in latent space of dimensionality d’<<d5;
minmax optimization: lower bound of an f-divergence.
• Objective function of WGAN(Wasserstein GAN)
NOTE: WGAN uses 1-Wasserstein distance(amount of work to pull one density
onto other). WGAN training is more stable(as GAN training has vanishing
gradients in high dimensions) and is used in the experiments.
13
Seminar 1: Data Analytics
Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
14. HYPOTHESIS
Given a test sample x, if there exists no z such that gθ(z)≈x, or if
such a z is difficult to find, then it can be inferred that x is not
distributed according to p, i.e. it is anomalous.
where,
gθ: the generator
x : new test sample
z : existing point in latent space
p : data distribution through which generative models
detect anomalies
14
Seminar 1: Data Analytics
Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
15. PROPOSED ALGORITHM: ADGAN
• GAN (Drawback):
Discriminator perfectly separates real from fake data, but can’t deal
with samples that are unlike training data
• ADGAN (Advantage):
The discriminator is never used which is discarded after training, so it
is easy to couple ADGAN with any GAN-based approaches like:
Generator network VAEs
Moment matching networks
15
Seminar 1: Data Analytics
Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
16. PROPOSED ALGORITHM: ADGAN
• ADGAN (Anomaly Detection using GAN) is derived from GAN
algorithm.
• ADGAN comes into play after GAN training has converged.
• Basic workflow of algorithm:
If generator has captured training data distribution with given new
sample x~p, there exists a point z(in latent space) such that: gθ(z)≈p
Points that are away from p have no representation or occupy small
probability mass in latent distribution.
If z does not exist then we say x is not distributed over p and it is
anomalous.
16
Seminar 1: Data Analytics
Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
17. ALGORITHM: PSEUDOCODE
17
Assumption: GAN training has converged
Goal: Given a new test point x, the algorithm searches for a point z in the
latent space, such that gθ(z)≈p
Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
Seminar 1: Data Analytics
18. ALGORITHM: EXPLAINATION
1. Initialization:
z0 ~ pz (pz:noise prior from GAN)
θ reset back to original for each new testing point
search is initialized from nseed individual points
2. For t=1,2,…,k steps:
backpropagate the reconstruction loss l(gθ(zt-1),x)
update parameterization of the generator with a small amount (result:
series of mapping from latent space that closely resembles x)
Adjust θ to give generator the extra capabilities
18Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
Seminar 1: Data Analytics
19. ALGORITHM
• The key idea of ADGAN is that if the generator was trained on the same
distribution x was drawn from, then the average over the final set of
reconstruction losses will assume low values and high values otherwise.
19Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
Seminar 1: Data Analytics
20. EXPERIMENTS
• Datasets
MNIST: contains grayscale scans of handwritten digits
CIFAR-10: contains colored images of real-world objects belonging to
10 classes
LSUN: image datasets showing different scenes(e.g. bedroom, bridges,
conference rooms)
• Default settings
Training and test splits remain as default
All images are rescaled to assume pixel values in [-1,1]
Sakshi Singh (Universität Hildesheim) 20Image Anomaly Detection with Generative Adversarial Networks
Seminar 1: Data Analytics
21. METHODS & HYPERPARAMETERS
• Tested the ADGAN performance against 4 traditional non-
parametric methods of anomaly detection:
1. KDE with a Gaussian kernel
2. One-class support vector machine(OC-SVM) with a Gaussian kernel
3. Isolation Forest(IF)
4. Gaussian mixture model(GMM)
• For all methods above, the authors reduced the feature
dimensionality before performing anomaly detection. Note:
Done via PCA and Alexnet (refer to table 1, slide 26)
• AnoGAN: Similar to ADGAN but they use an additional intermediate
discriminator layer dw’
21
Seminar 1: Data Analytics
Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
22. METHODS & HYPERPARAMETERS
• Report the performance of two end-to-end deep learning
approaches:
1. VAEs: scored by evaluating the evidence lower bound (ELBO)
2. DCAE: scored according to reconstructional losses, interpreting a
high loss if new samples differ from training samples.
• VAE’s performance is better than thresholding directly via
prior likelihood in latent space.
• Both VAE and DCAE have same architecture as DCGAN, so
these two are paired with DCGAN in the experiments.
22
Seminar 1: Data Analytics
Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
23. ASSUMPTIONS & RESULTS
EXPERIMENTAL ASSUMPTIONS
Set dimensionality of latent space d’=256
Noise prior pz is same used in GAN training
nseed=64 (to maintain non-convexity of optimization problem)
Adam optimizer is used for optimizing the latent vectors and
parameters of generator
Squared L2 loss for measuring reconstruction quality
EXPERIMENTAL RESULTS
More iterations helped the performance but this gain saturates quickly
K=5 is a good value(where k: no. of iterations)
23Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
Seminar 1: Data Analytics
24. ONE Vs ALL CLASSIFICATION
Task 1: Quantify performance of competing methods
Follow the original publications on OC-SVMs[6]
Train models on data from single class from MNIST
Evaluate each model’s performance on 5000 items randomly selected from
test set
In each trial, label unseen classes in training data as anomalous
24
Fig. 3. ROC curves for one-
versus-all prediction of
competing methods on
MNIST (left) and CIFAR10
(right), averaged over all
classes. KDE and OC-SVM are
shown in conjunction with
PCA, for detailed
performance statistics see
Table 1.
Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
Seminar 1: Data Analytics
25. Table 1: reports the AUCs
that resulted from leaving
out each individual class
• In these experiments,
1. Average AUC Score according
to GAN discriminator: MNIST
(0.625) and CIFAR-10 (0.513)
2. Average AUC score according
to prior likelihood pz of final
latent vector: MNIST (0.554)
and CIFAR-10 (0.721) {better}
25
Seminar 1: Data Analytics
Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
26. UNSUPERVISED ANOMALY DETECTION
Task 2: showcase the use of ADGAN in unsupervised detection
Build a test set from 300 validation sample images
Train the generator on LSUN scenes (in these experiments: only
bedroom scene)
Record whether ADGAN assigns low or high anomaly score
The images associated with highest and lowest anomaly
scores of three different scene categories: Figure 4,5,6 in next
slides
26Sakshi Singh (Universität Hildesheim)
Seminar 1: Data Analytics
Image Anomaly Detection with Generative Adversarial Networks
27. 27Sakshi Singh (Universität Hildesheim)
Seminar 1: Data Analytics
Image Anomaly Detection with Generative Adversarial Networks
28. CONCLUSION
• ADGAN is able to outperform
traditional methods of detecting
anomalies in high-dimensional
image samples.
• ADGAN has ability to discern
usual from unusual samples:
anomaly detection
• ADGAN is able to incorporate
many properties of an image
(e.g. colors, canonical
geometrics, foreign
objects(caption)).
28
Seminar 1: Data Analytics
Image Anomaly Detection with Generative Adversarial NetworksSakshi Singh (Universität Hildesheim)
29. FUTURE IMPROVEMENTS
• Performance can be boosted by additional tuning of the
underlying neural network
• To achieve strong experimental results jointly optimize the
latent vectors and generator parameterization
• Improve by initializing from an approximate inversion of the
generator[3,4] and substituting the reconstruction loss for a
more elaborate variant[5]
29
Seminar 1: Data Analytics
Sakshi Singh (Universität Hildesheim) Image Anomaly Detection with Generative Adversarial Networks
30. REFERENCES
1. Image Anomaly Detection with Generative Adversarial Networks: by
Lucas Deecke, Robert Vandermeulen, Lukas Ruff, Stephan Mandt, and
Marius Kloft
2. https://developers.google.com/machine-learning/gan/gan_structure,
Overview of GAN Structure, accessed on 2.12.2019
3. Donahue, J., Krähenbühl, P., Darrell, T.: Adversarial feature learning.
In:International Conference on Learning Representations (2017)
4. Dumoulin, V., Belghazi, I., Poole, B., Lamb, A., Arjovsky, M., Mastropietro,
O., Courville, A.: Adversarially learned inference. In: International
Conference on Learning Representations (2017)
5. Ling, H., Okada, K.: Diffusion distance for histogram comparison. In:
Computer, Vision and Pattern Recognition. pp. 246–253. IEEE (2006)
6. Schölkopf, B., Platt, J.C., Shawe-Taylor, J., Smola, A.J., Williamson, R.C.:
Estimating the support of a high-dimensional distribution. Tech. Rep.
MSRTR-99-87, Microsoft Research (1999)
30Image Anomaly Detection with Generative Adversarial NetworksSakshi Singh (Universität Hildesheim)
Seminar 1: Data Analytics