lab 14-2 gans · 2020. 12. 10. · • your notebook should be named after “lab14 -2_{student...
TRANSCRIPT
![Page 1: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/1.jpg)
Lab 14-2GANs
Yu-Rong Zhang & DataLab
Department of Computer Science,National Tsing Hua University, Taiwan
![Page 2: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/2.jpg)
Outline
• Reviewing GAN Structure
• Loss Functions
• WGAN
• WGAN-GP (improved WGAN)
![Page 3: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/3.jpg)
Outline
• Reviewing GAN Structure
• Loss Functions
• WGAN
• WGAN-GP (improved WGAN)
![Page 4: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/4.jpg)
Review - GAN
![Page 5: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/5.jpg)
Review - GAN
![Page 6: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/6.jpg)
Review - GAN
![Page 7: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/7.jpg)
Outline
• Reviewing GAN Structure
• Loss Functions
• WGAN
• WGAN-GP (improved WGAN)
![Page 8: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/8.jpg)
Loss Functions
• Minimax Loss:• For D: maximize
• For G: minimize
• Wasserstein Loss:• For D: maximize
• For G: minimize
![Page 9: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/9.jpg)
Loss Functions
• Minimax Loss:• For D: maximize
• For G: minimize
• Wasserstein Loss:• For D: maximize
• For G: minimize
𝑓𝑓𝑤𝑤 ∈ 𝐾𝐾 − 𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿 𝑓𝑓𝑓𝑓𝑓𝑓𝐿𝐿𝐿𝐿𝐿𝐿𝑓𝑓𝑓𝑓𝐿𝐿 for some 𝐾𝐾
![Page 10: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/10.jpg)
Loss Functions
• Lipschitz continuity: a function f : X → Y is called Lipschitz continuousif there exists a real constant K ≧ 0 such that, for all x1 and x2 in X
![Page 11: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/11.jpg)
Loss Functions
• Lipschitz continuity: a function f : X → Y is called Lipschitz continuousif there exists a real constant K ≧ 0 such that, for all x1 and x2 in X
• How to make the discriminator Lipschitz continuous?
![Page 12: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/12.jpg)
Loss Functions
• Lipschitz continuity: a function f : X → Y is called Lipschitz continuousif there exists a real constant K ≧ 0 such that, for all x1 and x2 in X
• How to make the discriminator Lipschitz continuous?
• Weight clipping – clip all weights in 𝑓𝑓𝑤𝑤 into a certain range.
![Page 13: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/13.jpg)
Outline
• Reviewing GAN Structure
• Loss Functions
• WGAN
• WGAN-GP (improved WGAN)
![Page 14: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/14.jpg)
WGAN
Make sure critic is 1-Lipchitz
Discriminator Training
![Page 15: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/15.jpg)
Outline
• Reviewing GAN Structure
• Loss Functions
• WGAN
• WGAN-GP (improved WGAN)
![Page 16: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/16.jpg)
WGAN-GP
• Instead of weight clipping, adding gradient penalty can also achieve Lipchitz continuity.
Gradient Penalty
![Page 17: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/17.jpg)
WGAN-GP
• In comparison with WGAN
![Page 18: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/18.jpg)
WGAN-GP
• In comparison with WGAN
WGAN
WGAN-GP
![Page 19: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/19.jpg)
WGAN-GP
![Page 20: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/20.jpg)
WGAN-GP
• Example
![Page 21: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/21.jpg)
Assignment
• Assignment 1 requirements• Implementation of Improved WGAN (WGAN-GP) and train on CelebA.• Build dataset to read and resize image to 64 × 64 for training• Training loop(s) / routine(s) for GAN. Pre-trained models are not allowed.• Show at least 8 × 8 animated image of training and some best generated
samples.• Draw the curve of discriminator loss and generator loss during training
process in a single image.• Brief report about what you have done.
![Page 22: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/22.jpg)
Assignment
• Assignment 1 submission• Upload notebook and attachments to google drive and submit the link to
iLMS.• Your notebook should be named after “Lab14-2_{student id}.ipynb”.• Deadline : 2020/12/15 23:59
![Page 23: Lab 14-2 GANs · 2020. 12. 10. · • Your notebook should be named after “Lab14 -2_{student id}.ipynb”. • Deadline : 2020/12/15 23:59. Assignment • Assignment 2 • Read](https://reader033.vdocuments.us/reader033/viewer/2022060901/609e2071cd406d489d7518d2/html5/thumbnails/23.jpg)
Assignment
• Assignment 2• Read the Lab notebook of the autoencoder.