Photo Editing With Generative Adversarial Networks (GANs) GTC, May 2017. Greg Heinrich.
PANDARUS: Alas, I think he shall be come approached and the day When little srain would be attain'd into being never fed, And who is but a chain and subjects of his death, I should not sleep. G AN : WHAT IS A GENERATIVE MODEL? In Machine Learning A generative model learns to generate samples that have the same characteristics as the samples in the dataset. Learn from Shakespeare novels: Produce: http://karpathy.github.io/2015/05/21/rnn- PANDARUS: effectiveness/ Alas, I think he shall be come approached and the day When little srain would be attain'd into being never fed, And who is but a chain and subjects of his death, 2 2 I should not sleep.
BASIC REMINDER: BACKPROP ππΉ Calculating π iteratively ππ₯ ππ Chain rule ππΉ Calculation of π : Output of each neuron π of layer π : ππ¨ π π = π π¨ π = π π₯ ππ π β π πβ1 + π π β π π π π π+1 π+1 πβ π ππΉ ππΉ ππ¨ π ππΉ ππ¨ π π = π = π π π π+1 π+1 π π ππ¨ π ππ¨ π ππ¨ π ππ¨ π πβ π ππ¨ π Gradient of E with respect to each weight: = ππΉ π+1 πβ² π¨ π π+1 π₯ ππ π π ππ¨ π ππ¨ π ππΉ ππΉ ππΉ πβ1 π = π = π β π π π ππ₯ ππ ππ¨ π ππ₯ ππ ππ¨ π π ππΉ π+1 = πβ² π¨ π+1 π₯ Calculated π ππ ππ¨ π during π forward prop Multivariate chain rule π ππ¨ π Chain πβ1 π only depends on β π rule 3 3 ππ₯ ππ
G A N : PLAYING THE ADVERSARIAL GAME Learning on a corpus of images Letβs play a game opposing two agents: - The Generator, a little imp in the computer who paints images. - The Discriminator: you are collectively responsible for playing the Discriminator. The game master (me) randomly picks images from either the corpus or the Generator and shows them to the Discriminator. The goal of the Discriminator is to identify the source of the images: real (from the corpus) or fake (painted by the little imp). The goal of the Generator is to fool the Discriminator. 4 4
PLAYING THE ADVERSARIAL GAME Is this a veelhoek* from our corpus? * veelhoek is the articulation Note: you donβt have to know what a veelhoek is, of a ubiquitous item in the you will learn through language of a tiny country in examples! Europe that is well known for the inferior quality of its cheese. Yes, this red square is a veelhoek! 5 5
PLAYING THE ADVERSARIAL GAME Is this a veelhoek from our corpus? No, those squiggly lines arenβt right! 6 6
PLAYING THE ADVERSARIAL GAME Is this a veelhoek from our corpus? Yes, even though itβs blue and tiny! 7 7
PLAYING THE ADVERSARIAL GAME Is this a veelhoek from our corpus? No, those rounded corners are a giveaway! 8 8
PLAYING THE ADVERSARIAL GAME Is this a veelhoek from our corpus? No, but itβs a very good fake! 9 9
PLAYING THE ADVERSARIAL GAME Is this a veelhoek from our corpus? No, itβs the same fake as before! 10 10
PLAYING THE ADVERSARIAL GAME Is this a veelhoek from our corpus? No, but itβs a very creative fake! 11 11
THE LATENT REPRESENTATION From features to images A veelhoek is characterized by three features: - colour, - size, - number of faces This set of features is known as the β LATENT REPRESENTATIONβ . We can generate many real-looking veelhoeks by randomly picking reasonable values of each feature: 12 12
THE LATENT REPRESENTATION Arithmetic in latent space We can perform operations in latent space, have them reflected in feature space: πππ ππ π‘ππππ πππππ£π 1 ππ πππ π§πππππ₯ π ππ + = 2 3 πππππ‘ 5 πππππ‘ 4 πππππ‘ Equivalently: ππ πππ π ππ 1 + π‘ππππ πππ ππ + = 2 5 πππππ‘ 3 πππππ‘ 13 13
THE GAN SET-UP Connecting the Discriminator to the Generator and the Dataset Random Latent vector 14 14
GA N: NETWORK TOPOLOGY Radford (2015). Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks. arXiv:1511.06434 Generator Discriminator 15 15
TRAINING A GAN ON CELEBRITY FACES* Generating new faces by picking random values of the latent vector * CelebFaces dataset 16 16
ANALOGIES man is to woman as king is to queen Reproduction of the famous βking + woman - man = queenβ analogy on faces: Blond Blue Looking Pointy Man Smile Hair Eyes Left Nose - - - + + + Top Right + + + - Bottom Left + Subtract Top + - - - - Left + - - - + + Bottom Right 17 17 NVIDIA CONFIDENTIAL. DO NOT DISTRIBUTE.
MAPPING IMAGES TO LATENT VECTORS Transfer learning : from Discriminator to Encoder 18 18
IMAGE RECONSTRUCTIONS Visualizing π» πΉ πππππ 19 19
ATTRIBUTES Calculating attribute vectors The encoder πΉ may be used to calculate the latent vector for each attribute. For each ππ’π’π in ππ’π’π πππ£π’ππ‘ : + β π½ ππ’π’π = ππ ππ’π’π and π½ ππ’π’π = ππ ππ’π’π are sets of images w/wo the attribute 1 1 π¨ ππ’π’π = πΉ(ππ) β πΉ(ππ) β + ππ β π½ ππ’π’π + ππ β π½ ππ’π’π β π½ ππ’π’π π½ ππ’π’π It is then straightforward to add or remove attributes from an image: F rom left to right: original image (OI); OI + βyoungβ attribute; OI - βblond hairβ + βblack hairβ; OI - βsmileβ; OI + βmaleβ + βbaldβ. 20 20
PLAYING WITH ATTRIBUTES 21 21
EXTRACTING ATTRIBUTES β¦from portraits of illustrious people 22 22
DEGENERATOR Getting the essence of your dataset After convergence, stop updating the discriminator: 23 23
DATASET VISUALIZATION Projecting latent vectors on a sphere 24 24
THANK YOU Questions? 25 25
Recommend
More recommend