Making Faces: Conditional generation of faces using GANs via - - PowerPoint PPT Presentation

β–Ά
making faces conditional generation of faces using gans
SMART_READER_LITE
LIVE PREVIEW

Making Faces: Conditional generation of faces using GANs via - - PowerPoint PPT Presentation

Making Faces: Conditional generation of faces using GANs via Keras+Tensorflow SOPHIE SEARCY All materials at soph.info/odsc2019 Who am I? All materials at soph.info/odsc2019 Who am I? u Sophie Searcy u Curriculum development lead and Data


slide-1
SLIDE 1

All materials at soph.info/odsc2019

Making Faces: Conditional generation of faces using GANs via Keras+Tensorflow

SOPHIE SEARCY

slide-2
SLIDE 2

All materials at soph.info/odsc2019

Who am I?

slide-3
SLIDE 3

All materials at soph.info/odsc2019

Who am I?

u Sophie Searcy

u Curriculum development lead and

Data Science Instructor at Metis

u Background: robotics, computational

psychology

u Current focus: Deep Learning and

Data Science Ethics

u Write and lead free workshops with

t4tech

slide-4
SLIDE 4

All materials at soph.info/odsc2019

Who am I?

u Metis thisismetis.com

u Only accredited Data Science Bootcamp

u Students changing careers into Data Science u Cohorts in Seattle, Chicago, San Francisco,

and New York City

u

Corporate Training

u Skill up your current team u Data Literacy, Big Data, Advanced Deep

Learning topics

u In-house Bootcamp-style training.

Mike Galvin Kerstin Frailey

slide-5
SLIDE 5

All materials at soph.info/odsc2019

Signposting

slide-6
SLIDE 6

All materials at soph.info/odsc2019

Who is this for

Someone who

u Understands and can explain the fundamentals of modern Deep Learning

(there will be a review)

u BackProp u Stochastic Gradient Descent u Common loss and activation functions

u Has built models using a recent Deep Learning package (PyTorch, Theano,

Keras, etc.)

slide-7
SLIDE 7

All materials at soph.info/odsc2019

What we’ll cover

Students should be able to:

u Understand and explain the important components of Generative

Adversarial Networks

u Use provided boilerplate code and adapt it for new purposes u State of The Art techniques in GANs:

u Students will be exposed to a few important, recent developments. u Students will have the building blocks needed to independently explore new

techniques.

slide-8
SLIDE 8

All materials at soph.info/odsc2019

(rough) Agenda

u Hour 1: Slides u Hour 2: Neural Net Theory notebook u Hour 3: GAN demo

u Less instructional u Will provide hands-on help and take live-coding requests 😭

u Workshop designed to be run on Google Colab for free.

u All code distributed through GitHub and Colab. u All results acquired from Colab

slide-9
SLIDE 9

All materials at soph.info/odsc2019

Deep Learning Review

slide-10
SLIDE 10

All materials at soph.info/odsc2019 Typical Machine Learning

Transformations Model Data Output Linear model, SVM, RF, etc. Feature engineering, feature extraction Tuned by hand, parameter search Optimized wrt

  • bjective function

What makes deep Learning special?

slide-11
SLIDE 11

All materials at soph.info/odsc2019

What makes deep Learning special?

Deep Learning

Transformations Model Data Output Deep Learning model Optimized wrt

  • bjective function
slide-12
SLIDE 12

All materials at soph.info/odsc2019

Essential parts: Differentiable functions

u β„Ž" = 𝑔 𝑋

" &𝑦 + 𝑐"

u β„Ž* = 𝑔 𝑋

* &β„Ž" + 𝑐*

u … u 𝑧 = 𝑔(𝑋

  • &β„Ž- + 𝑐-)

u DL models use these functions to process data in steps from input β†’ output

u Traditional application:

u Tabular data β†’ Regression/Classification

u New (ish) applications

u Image β†’ Text u Image β†’ Image

slide-13
SLIDE 13

All materials at soph.info/odsc2019

Essential parts: Stochastic Gradient Descent + BackProp

Gradient Descent

u Finds adjustment to function

parameters that minimizes the loss function Back Propagation

u Chain rule of calculus in algorithm

form.

u Applies gradient descent over

many layers of a network.

Chollet 2018

slide-14
SLIDE 14

All materials at soph.info/odsc2019

Deep Learning approach

u Traditional Machine Learning

u A lot of time spent engineering your data/features to find the best ones for a

model to learn.

u Train a shallow model to make predictions based on features.

u Deep Learning

u Time is spent on finding DL architecture that is able to learn the feature

transformations it needs.

u More time can be spent on improving/expanding dataset. u Train a model to find the best parameters for the entire pipeline from data ->

prediction.

slide-15
SLIDE 15

All materials at soph.info/odsc2019

GAN Overview

slide-16
SLIDE 16

All materials at soph.info/odsc2019

Convolutional Classifiers

u Convolutions learn feature maps u Use sampling/pooling to summarize over height and width of image u Output is some classification vector, e.g. probabilities

source

slide-17
SLIDE 17

All materials at soph.info/odsc2019

u Convolutional filiters u Pixels β†’ subparts β†’ parts β†’ whole

Chollet 2018

slide-18
SLIDE 18

All materials at soph.info/odsc2019

u Convolutional filters u Pixels β†’ subparts β†’ parts β†’ whole u We can visualize this progression by finding input

that maximizes activity at layer

Olah 2017

slide-19
SLIDE 19

All materials at soph.info/odsc2019

Convolutional Generation

u Convolutions learn feature maps u Upsampling/DeConvolution progressively grow image

Radford et al 2015

slide-20
SLIDE 20

All materials at soph.info/odsc2019

GAN Architecture

D(x) - Discriminator

u

Given image

u

Attempts to classify as fake or real

slide-21
SLIDE 21

All materials at soph.info/odsc2019

GAN Architecture

G(z) - Generator

u

Given random vector z

u

Attempts to generate an image that fools D(Β·)

slide-22
SLIDE 22

All materials at soph.info/odsc2019

GAN Architecture

D(x) - Discriminator

u

Given image

u

Attempts to classify as fake or real G(z) - Generator

u

Given random vector z

u

Attempts to generate an image that fools D(Β·)

slide-23
SLIDE 23

All materials at soph.info/odsc2019

GAN Architecture

Goodfellow 2016

slide-24
SLIDE 24

All materials at soph.info/odsc2019

G(z) - Generator

u

Given random vector z

u

Attempts to generate an image that fools D(Β·) Imagine you are the generator

u

CIFAR image data (32x32)

u

Generate a frog that will fool the discriminator

Generator task

slide-25
SLIDE 25

All materials at soph.info/odsc2019

Generator task

You are the generator

u

Imagine you can see the training data.

u

You can learn as much as you want from the training data.

u

You have to devise a strategy to trick the Discriminator.

u

What is your strategy for fooling the discriminator?

u i.e. what if you had to say/write

pseudocode for the best strategy in a minute or so?

slide-26
SLIDE 26

All materials at soph.info/odsc2019

Generator task

What is your strategy?

u Memorize training images?

u You have ~ 1 million parameters

but the training data has ~ 100 million pixels

slide-27
SLIDE 27

All materials at soph.info/odsc2019

Generator task

What is your strategy?

u Memorize training images?

u You have ~ 1 million

parameters but the training data has ~ 100 million pixels

u Instead the generator learns

the distribution of the training data.

u Attempts to generate an

example from that distribution

slide-28
SLIDE 28

All materials at soph.info/odsc2019

Distribution Learning

Generator learns distribution

  • f training data

u Meaningful

understanding of that training data

Radford et al 2015

slide-29
SLIDE 29

All materials at soph.info/odsc2019

Advanced GAN Topics

slide-30
SLIDE 30

All materials at soph.info/odsc2019

Lipschitz Continuity

u Problem: in many cases, the discriminator can be

essentially impossible for the generator to beat.

u Impossible to win β†’ zero gradient β†’ no learning

Lipschitz constant: Maximum rate of change of a function Spectral Normalization (Miyato et al 2018) constrains the Lipshitz constant of the discriminator, ensuring stable training of generator.

source

slide-31
SLIDE 31

All materials at soph.info/odsc2019

Multilabel Conditional GAN

slide-32
SLIDE 32

All materials at soph.info/odsc2019

Classifier + GAN

u Classes provide additional signal

u both generator and discriminator learn data distribution more

quickly

u Significantly quicker learning (wall clock)

u Allows direct manipulation of class feature in

generator

slide-33
SLIDE 33

All materials at soph.info/odsc2019

VAC GAN

Bazrafkan 2018

slide-34
SLIDE 34

All materials at soph.info/odsc2019

u VAC GAN

u Good: Versatile classification with GAN u Bad: Requires a 3rd model

u Today’s demo: VAC-GAN variant that combines Discriminator and

Classifier

Bazrafkan 2018

VAC GAN

slide-35
SLIDE 35

All materials at soph.info/odsc2019

Results

slide-36
SLIDE 36

All materials at soph.info/odsc2019

Results

slide-37
SLIDE 37

All materials at soph.info/odsc2019

Results

slide-38
SLIDE 38

All materials at soph.info/odsc2019

Results

slide-39
SLIDE 39

All materials at soph.info/odsc2019

Results