603556-Tonnaer

3.3 Anomaly Detection with Generative Models 31 (GAN) (Goodfellow et al., 2014) to model the normal data. A GAN consists of a generator G that generates images given latent space samples z and a discriminator Dthat is trained to distinguish generated images from real data. BothGandDare neural networks, which are simultaneously optimised through the following two-player minimax game: min G max D Epdata(x)[logD(x)]+Ep(z)[log(1−D(G(z)))], (3.6) for some latent space prior p(z), which we set to be a uniform distribution as in Schlegl et al. (2017). Unlike a VAE, a GAN does not include an encoder that can map a data observationxback into the latent space, thus we cannot get a direct estimate of the model likelihoodpθ. Instead, AnoGAN uses an iterative procedure (Yeh et al., 2016) to find a zγ such that G(z) is as similar as possible to x. This involves starting with a random point z1 in latent space that generates an image G(z1). Based on this generated image, we define a loss function that provides gradients to find more suitable z2, z3, . . . , zγ through stochastic gradient descent (SGD) with momentum. After γ steps, if the query image x belongs to the learned distribution of the model, we would expect that G(zγ) ≈x. The loss function for this iterative procedure consists of a visual and a perceptual component. The visual component is theresidual loss, which measures the dissimilarity between the query image and the generated image at pixel level. The residual loss is defined as LR(z)=X|x−G(zγ)|, (3.7) where xis the query image andG(zγ) is the most similar generated image. If the generator is able to generate a perfect looking image with respect to the query, the residual loss is zero. The perceptual component is the discrimination loss, based on the discriminator D, which is defined as LD(zγ)=X|f(x) −f(G(zγ))|, (3.8) where f is a hidden layer from the discriminator. The features learned from the query image f(x) are compared to the ones of the most similar generated image f(G(zγ)). The overall loss function is a weighted sum of the residual and the discrimination loss, where a parameter λ sets the relative importance of each loss

RkJQdWJsaXNoZXIy MjY0ODMw