CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project...

60
Synthesizing images with generative adversarial networks (GANs) CS5670: Computer Vision Guest Lecture - Jin Sun Slides from Philipp Isola Which face is real ?

Transcript of CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project...

Page 1: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Synthesizing images with generative adversarial networks (GANs)

CS5670: Computer VisionGuest Lecture - Jin Sun

Slides from Philipp IsolaWhich face is real?

Page 2: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Announcements

• Project 5 due Friday, 5/10 at 11:59pm

• Course evals (you will receive a few bonus points!)

– https://apps.engineering.cornell.edu/CourseEval

• Final exam in class next Monday, 5/6

– Please arrange yourselves with at least one space between you and the closest person in the same row when you arrive

Page 3: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Motivation: Synthesizing images

Page 4: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Motivation: Synthesizing images

Page 5: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Demo

https://affinelayer.com/pixsrv/

Page 6: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Why Synthesizing Images

“What I cannot create, I do not understand.”

—Richard Feynman

Computer vision is all about understanding the world from images

a busy downtown area with a lot of traffic and buildings.this is a picture of a busy downtown cross walk with several cars in the flow of traffic.cars passing on a street in the city....

Understand

Synthesize

Page 7: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

“Fish”

label Y

Learner

image X

Image classification

Page 8: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Learner

image X

“Fish”

label Y

Image classification

Page 9: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Learner

image X

“Fish”

label Y

Image classification

Page 10: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Learner

image X

“Fish”

label Y

Image classification

Page 11: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Image prediction (“structured prediction”)

Object labeling

[Long et al. 2015, …]

Edge Detection

[Xie et al. 2015, …]

Style transfer

[Gatys et al. 2016, …][Reed et al. 2014, …]

Text-to-photo

“this small bird has a pink

breast and crown…”

Page 12: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Challenges

1. Output is high-dimensional and structured

2. Uncertainty in mapping; many plausible outputs

3. Lack of supervised training data

“this small bird has a pink

breast and crown…”

Page 13: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

A standard CNN for classification

Need new network modules to generate same-sized output!

Page 14: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Deconvolution

Compare to convolution with different params

Page 15: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Deconvolution

Also known as: transpose conv, upconv, ...

Page 16: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

UnetA popular network structure to generate same-sized output

Page 17: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Image Colorization

Page 18: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

“What should I do” “How should I do it?”

Page 19: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Color information: ab channelsGrayscale image: L channel

Objective function

(loss)

Neural Network

Training data

Page 20: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

“yellow”

Page 21: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

“black”

Page 22: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Page 23: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night
Page 24: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Input Output Ground truth

Designing loss functions

Page 25: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night
Page 26: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Color distribution cross-entropy loss with colorfulness enhancing term.

Zhang et al. 2016

[Zhang, Isola, Efros, ECCV 2016]

Designing loss functions

Input Ground truth

Page 27: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night
Page 28: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Image colorization

Designing loss functions

L2 regression

Super-resolution

[Johnson, Alahi, Li, ECCV 2016]

L2 regression

[Zhang, Isola, Efros, ECCV 2016]

Page 29: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Image colorization

Designing loss functions

Cross entropy objective,

with colorfulness term

Deep feature covariance

matching objective

[Johnson, Alahi, Li, ECCV 2016]

Super-resolution

[Zhang, Isola, Efros, ECCV 2016]

Page 30: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Universal loss?

… …

Page 31: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Generated

vs Real(classifier)

[Goodfellow, Pouget-Abadie, Mirza, Xu, Warde-

Farley, Ozair, Courville, Bengio 2014]

“Generative Adversarial Network”

(GANs)

Real photos

Generated images

Page 32: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Conditional GANs

[Goodfellow et al., 2014]

[Isola et al., 2017]

Page 33: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Generator

[Goodfellow et al., 2014]

Page 34: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

G tries to synthesize fake images that fool D

D tries to identify the fakes

Generator Discriminator

real or fake?

[Goodfellow et al., 2014]

Page 35: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

fake (0.9)

real (0.1)

[Goodfellow et al., 2014]

Page 36: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

G tries to synthesize fake images that fool D:

real or fake?

[Goodfellow et al., 2014]

Page 37: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

G tries to synthesize fake images that fool the best D:

real or fake?

[Goodfellow et al., 2014]

Page 38: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Loss Function

G’s perspective: D is a loss function.

Rather than being hand-designed, it is learned.

[Isola et al., 2017]

[Goodfellow et al., 2014]

Page 39: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

real or fake?

[Goodfellow et al., 2014]

Page 40: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

real!(“Aquarius”)

[Goodfellow et al., 2014]

Page 41: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

real or fake pair ?

[Goodfellow et al., 2014]

[Isola et al., 2017]

Page 42: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

real or fake pair ?

[Goodfellow et al., 2014]

[Isola et al., 2017]

Page 43: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

fake pair

[Goodfellow et al., 2014]

[Isola et al., 2017]

Page 44: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

real pair

[Goodfellow et al., 2014]

[Isola et al., 2017]

Page 45: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

real or fake pair ?

[Goodfellow et al., 2014]

[Isola et al., 2017]

Page 46: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

BW → Color

Input Output Input Output Input Output

Data from [Russakovsky et al. 2015]

Page 47: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Input Output Groundtruth

Data from

[maps.google.com]

Page 48: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Labels → Street Views

Data from [Wang et al, 2018]

Page 49: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Day → Night

Input Output Input Output Input Output

Data from [Laffont et al., 2014]

Page 50: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Edges → Images

Input Output Input Output Input Output

Edges from [Xie & Tu, 2015]

Page 51: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Ivy Tasi @ivymyt

Vitaly Vidmirov @vvid

Page 52: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Image Inpainting

Data from [Pathak et al., 2016]

Page 53: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Pose-guided Generation

Data from [Ma et al., 2018]

Page 54: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Challenges —> Solutions

1. Output is high-dimensional, structured object

2. Uncertainty in mapping; many plausible outputs

3. Lack of supervised training data

“this small bird has a pink

breast and crown…”

—> Use a deep net, D, to analyze output!

—> D only cares about “plausibility”, doesn’t hedge

Page 55: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Challenges —> Solutions

1. Output is high-dimensional, structured object

2. Uncertainty in mapping; many plausible outputs

3. Lack of supervised training data

“this small bird has a pink

breast and crown…”

—> Use a deep net, D, to analyze output!

—> D only cares about “plausibility”, doesn’t hedge

Page 56: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

https://junyanz.github.io/CycleGAN/

Page 57: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

https://hardikbansal.github.io/CycleGANBlog/

Page 58: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night
Page 59: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

StyleGAN

https://github.com/NVlabs/stylegan

Page 60: CS5670: Computer Vision - Cornell University · Slides fromPhilipp Isola. Announcements •Project 5 due Friday, 5/10 at 11:59pm ... Real photos Generated images ... Day →Night

Questions?