everyone can be vango

24
Everyone can be van Gogh Introduction to Neural Art 物理三 王昱翔 2016. 11. 08

Upload: yusiang-wang

Post on 23-Jan-2018

91 views

Category:

Engineering


1 download

TRANSCRIPT

Page 1: Everyone can be Vango

Everyone can be van GoghIntroduction to Neural Art

物理三 王昱翔

2016. 11. 08

Page 2: Everyone can be Vango

Reference

• Leon A. Gatys, Alexander S. Ecker, Matthias Bethge, A Neural Algorithm of Artistic Style

• Mark Chang’s slide, http://www.slideshare.net/ckmarkohchang/a-neural-algorithm-of-artistic-style?next_slideshow=1

Page 3: Everyone can be Vango

Outline

• Few examples of Neural Art

• Introduction to CNN

• Implement Neural Art

• Application

• Conclusion

Page 4: Everyone can be Vango

Paintings of van Gogh

Page 5: Everyone can be Vango

Can we paint like van Gogh? (I’m not 9.2%)

Page 6: Everyone can be Vango

Yes! (Use Convolutional Neural Network)

Ref: Mark Chang’s slide

Page 7: Everyone can be Vango

Neural Network

Page 8: Everyone can be Vango

Partial CNN Process

Image(Input)

Convolution Max Pooling

Page 9: Everyone can be Vango

CNN– Convolution

0 0 1 1 0 0

0 1 1 1 1 0

1 1 1 1 1 1

1 1 1 1 1 1

0 0 0.5 0.5 0 0

0 0 0.5 0.5 0 0

0 0 1

0 0 1

0 0 1

Filter_2

Number of filters depends on Users !

0 0 1

0 0.5 0

1 0 0

Filter_1

Find pattern

Input image

Page 10: Everyone can be Vango

Filter -- Element wise matrix multiplication

0 0 1 1 0 0

0 1 1 1 1 0

1 1 1 1 1 1

1 1 1 1 1 1

0 0 0.5 0.5 0 0

0 0 0.5 0.5 0 0

0 0 1

0 0.5 0

1 0 0

0 0 1

0 0 1

0 0 1

2.5

Page 11: Everyone can be Vango

CNN -- convolution 0

1

2

3

4

5

6

w0 = 𝐹11

0 1 2 3 4 56 7 8 9 10 11

0 0 1 1 0 0

0 1 1 1 1 0

Corresponding Index

2.5

w1 = 𝐹12

w2 = 𝐹13

w6 = 𝐹21

Page 12: Everyone can be Vango

0 0 1 1 0 0

0 1 1 1 1 0

1 1 1 1 1 1

1 1 1 1 1 1

0 0 0.5 0.5 0 0

0 0 0.5 0.5 0 0

0 0 1

0 0.5 0

1 0 0

0 0 1

0 0 1

0 0 1

2.5

Page 13: Everyone can be Vango

CNN – Max Pooling

2.5 2.5 1.5 1.5

2.5 2.5 2.5 1.5

1.5 1.5 2 2

1 1.5 1.75 1.5

2.5 2.5

1.5 2

0 0 1 1 0 0

0 1 1 1 1 0

1 1 1 1 1 1

1 1 1 1 1 1

0 0 0.5 0.5 0 0

0 0 0.5 0.5 0 0

0 0 1

0 0.5 0

1 0 0

Max pooling

2.5

Page 14: Everyone can be Vango

Repeat Convolution + Max pooling

Input Image

ConvolutionMax pooling

ConvolutionMax pooling

Page 15: Everyone can be Vango

Whole CNN Process

Image ConvolutionMax

Pooling

N times

FlattenFully

ConnectedNeural

Network

Page 16: Everyone can be Vango

Neural Art

Content

Style

Page 17: Everyone can be Vango

Neural Art- Create Content

0.3 0.7 1 0 0.6

0.2 0.8 0.7 0.4 0.4

0.7 0.1 0.2 0.3 0.5

0.8 0 0.3 0.9 0.1

0.5 0.9 0.6 1 0.8

CNN

CNN

Canvas x

Output X

Output P

𝐿𝑐𝑜𝑛𝑡𝑒𝑛𝑡 =1

2 𝑖,𝑗(𝑋𝑖,𝑗 − 𝑃𝑖,𝑗)

2

Gradient Descent (Back Propagation)

Photo p

Canvas x: Our paintings

CNN: Already trained byother people

Page 18: Everyone can be Vango

CNN

Neural Art – Create Style

0.3 0.7 1 0 0.6

0.2 0.8 0.7 0.4 0.4

0.7 0.1 0.2 0.3 0.5

0.8 0 0.3 0.9 0.1

0.5 0.9 0.6 1 0.8

CNN

Canvas x

Output

Output 𝐿𝑠𝑡𝑦𝑙𝑒 =1

2 𝑖,𝑗(𝑋𝑖,𝑗 − 𝑆𝑖,𝑗)

2

Gradient Descent (Back Propagation)

Style sGram S

Gram X

G

G

∗ 𝐺𝑟𝑎𝑚𝑖,𝑗 = <𝑣𝑖 , 𝑣𝑗>

Gram S_00= <O_s row[0], O_s col[0]>

Page 19: Everyone can be Vango

Update Canvas

• 𝐿𝑡𝑜𝑡𝑎𝑙 = 𝛼𝐿𝑐𝑜𝑛𝑡𝑒𝑛𝑡 + 𝛽𝐿𝑠𝑡𝑦𝑙𝑒 x = x - 𝜂𝜕𝐿𝑡𝑜𝑡𝑎𝑙

𝜕𝑥

Page 20: Everyone can be Vango

Application -- DeepDream

Ref: Deep Dream

Page 21: Everyone can be Vango

Application -- Prisma

Ref: Prisma

Page 22: Everyone can be Vango

Real time Neural Art

Ref: Fast Style transfer in Tensorflow

Page 23: Everyone can be Vango

Conclusion

• Yeah! Computer can paint by themselves!

• Really? They still need a photo for painting.

Page 24: Everyone can be Vango

Thank You For Your Listening !