photo editing with generative
play

Photo Editing With Generative Adversarial Networks (GANs) GTC, May - PowerPoint PPT Presentation

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


  1. Photo Editing With Generative Adversarial Networks (GANs) GTC, May 2017. Greg Heinrich.

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

  3. 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 πœ–π‘₯ π‘—π‘˜

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

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

  6. PLAYING THE ADVERSARIAL GAME Is this a veelhoek from our corpus? No, those squiggly lines aren’t right! 6 6

  7. PLAYING THE ADVERSARIAL GAME Is this a veelhoek from our corpus? Yes, even though it’s blue and tiny! 7 7

  8. PLAYING THE ADVERSARIAL GAME Is this a veelhoek from our corpus? No, those rounded corners are a giveaway! 8 8

  9. PLAYING THE ADVERSARIAL GAME Is this a veelhoek from our corpus? No, but it’s a very good fake! 9 9

  10. PLAYING THE ADVERSARIAL GAME Is this a veelhoek from our corpus? No, it’s the same fake as before! 10 10

  11. PLAYING THE ADVERSARIAL GAME Is this a veelhoek from our corpus? No, but it’s a very creative fake! 11 11

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

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

  14. THE GAN SET-UP Connecting the Discriminator to the Generator and the Dataset Random Latent vector 14 14

  15. GA N: NETWORK TOPOLOGY Radford (2015). Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks. arXiv:1511.06434 Generator Discriminator 15 15

  16. TRAINING A GAN ON CELEBRITY FACES* Generating new faces by picking random values of the latent vector * CelebFaces dataset 16 16

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

  18. MAPPING IMAGES TO LATENT VECTORS Transfer learning : from Discriminator to Encoder 18 18

  19. IMAGE RECONSTRUCTIONS Visualizing 𝐻 𝐹 𝑗𝑛𝑏𝑕𝑓 19 19

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

  21. PLAYING WITH ATTRIBUTES 21 21

  22. EXTRACTING ATTRIBUTES …from portraits of illustrious people 22 22

  23. DEGENERATOR Getting the essence of your dataset After convergence, stop updating the discriminator: 23 23

  24. DATASET VISUALIZATION Projecting latent vectors on a sphere 24 24

  25. THANK YOU Questions? 25 25

Recommend


More recommend