CS7015 (Deep Learning) : Lecture 13 Visualizing Convolutional Neural - - PowerPoint PPT Presentation

cs7015 deep learning lecture 13
SMART_READER_LITE
LIVE PREVIEW

CS7015 (Deep Learning) : Lecture 13 Visualizing Convolutional Neural - - PowerPoint PPT Presentation

CS7015 (Deep Learning) : Lecture 13 Visualizing Convolutional Neural Networks, Guided Backpropagation, Deep Dream, Deep Art, Fooling Convolutional Neural Networks Mitesh M. Khapra Department of Computer Science and Engineering Indian Institute


slide-1
SLIDE 1

1/72

CS7015 (Deep Learning) : Lecture 13

Visualizing Convolutional Neural Networks, Guided Backpropagation, Deep Dream, Deep Art, Fooling Convolutional Neural Networks Mitesh M. Khapra

Department of Computer Science and Engineering Indian Institute of Technology Madras

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-2
SLIDE 2

2/72

Acknowledgements Andrej Karpathy Video Lecture on Visualization and Deep Dream∗

∗Visualization, Deep Dream, Neural Style, Adversarial Examples Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-3
SLIDE 3

3/72

Module 13.1: Visualizing patches which maximally activate a neuron

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-4
SLIDE 4

4/72

Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 5 5 256 23 23 Convolution 3 3 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling dense 4096 dense 4096 dense 1000

Consider some neurons in a given layer of a CNN We can feed in images to this CNN and identify the images which cause these neurons to fire We can then trace back to the patch in the image which causes these neur-

  • ns to fire

Let us look at the result of one of such experiment conducted by Grishick et al., 2014

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-5
SLIDE 5

5/72

They consider 6 neurons in the pool5 layer and find the image patches which cause these neurons to fire One neuron fires for people faces Another neuron fires for dog faces Another neuron fires for flowers Another neuron fires for numbers Another neuron fires for houses Another neuron fires for shiny surfaces

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-6
SLIDE 6

6/72

Module 13.2: Visualizing filters of a CNN

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-7
SLIDE 7

7/72

x h(x) ˆ x

max

x

{wT x} s.t. ||x||2 = xT x = 1 Solution: x = w1

  • wT

1 w1

Recall that we had done something similar while discussing autoencoders We are interested in finding an input which maximally excites a neuron Turns out that the input which will maximally activate a neuron is

W W

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-8
SLIDE 8

8/72

. . .

16

2

* = h11 h12 h14 Now recall that we can think of a CNN also as a feed-forward network with sparse connections and weight sharing Once again, we are interested in knowing what kind of inputs will cause a given neuron to fire The solution would be the same ( W

W) where W is the filter(2 × 2, in

this case) We can thus think of these filters as pattern detectors

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-9
SLIDE 9

9/72

max

x

{wT x} s.t. ||x||2 = xT x = 1 Solution: x = w1

  • wT

1 w1

We can simply plot the K×K weights (filters) as images & visualize them as patterns The filters essentially detect these patterns (by causing the neurons to maximally fire) This is only interpretable for the fil- ters in the first convolution layer (Why?)

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-10
SLIDE 10

10/72

Module 13.3: Occlusion experiments

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-11
SLIDE 11

11/72

Softmax pomeranian wheel hound ...

True Label: Pomeranian (a) Input Image True Label: Pomeranian (a) Input Image (b) Layer 5, strongest feature map True Label: Pomeranian (a) Input Image (b) Layer 5, strongest feature map

Typically we are interested in under- standing which portions of the image are responsible for maximizing the probability of a certain class We could occlude (gray out) differ- ent patches in the image and see the effect on the predicted probability of the correct class For example this heat map shows that

  • ccluding the face of the dog causes

a maximum drop in the prediction probability Similar observations are made for

  • ther images

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-12
SLIDE 12

12/72

Module 13.4: Finding influence of input pixels using backpropagation

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-13
SLIDE 13

13/72

xi hj

flatten

· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·

x0 x1 xmn

We can think of an image as a m × n inputs x0, x1, . . . , xm×n We are interested in finding the influ- ence of each of these inputs(xi) on a given neuron(hj) If a small change in xi causes a large change in hj then we can say that xi has a lot of influence of hj In other words the gradient ∂hj

∂xi could

tell us about the influence

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-14
SLIDE 14

14/72

xi hj

flatten

· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·

∂hi ∂x0 ∂hi ∂x1 ∂hi ∂xmn

∂hj ∂xi = 0 − → no influence ∂hj ∂xi = large − → high influence ∂hj ∂xi = small − → low influence We could just compute these partial derivatives w.r.t all the inputs And then visualize this gradient mat- rix as an image itself

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-15
SLIDE 15

15/72

xi hj

flatten

· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·

x0 x1 xmn

But how do we compute these gradi- ents? Recall that we can represent CNNs by feedforward neural network Then we already know how to com- pute influences (gradient) using back- propogation For example, we know how to back- prop the gradients till the first hidden layer

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-16
SLIDE 16

16/72

This is what we get if we compute the gradients and plot it as an image The above procedure does not show very sharp influences Springenberg et al. proposed “guided back propagation” which gives a bet- ter idea about the influences

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-17
SLIDE 17

17/72

Module 13.5: Guided Backpropagation

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-18
SLIDE 18

18/72

We feed an input to the CNN and do a forward pass We consider one neuron in some fea- ture map at some layer We are interested in finding the influ- ence of the input on this neuron We retain this neuron and set all

  • ther neurons in the layer to zero

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-19
SLIDE 19

19/72 1 2

  • 1
  • 5

5

  • 7
  • 3

2 4 1 2 5 2 4

Forward pass “ ”

  • 2

6

  • 1
  • 1

3

  • 2

6 3

  • 3
  • 1

1 2

  • 1

3

Backward pass: backpropagation “ ”

6 3

  • 2

6 3

  • 3
  • 1

1 2

  • 1

3

“ ” Backward pass: guided backpropagation

We now backpropogate all the way to the inputs Recall that during forward pass relu activation allows only positive values to pass & clamps −ve values to zero Similarly during backward pass no gradient passes through the dead relu neurons In guided back propagation any - ve gradients flowing from the upper layer are also set to 0

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-20
SLIDE 20

20/72 Backpropagation Guided Backpropagation

Intuition: Neglect all the negative influences (gradients) and focus only

  • n the positive influences (gradients)

This gives a better picture of the true influence of the input

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-21
SLIDE 21

21/72

Module 13.6: Optimization over images

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-22
SLIDE 22

22/72

Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 5 5 256 23 23 Convolution 3 3 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling dense 4096 dense 4096 dense 1000

Dumbell

Suppose we want to create an image which looks like a dumbell (or an os- trich, or a car, or just anything) In other words we want to create an image such that if we pass it through a trained ConvNet it should maximize the probability of the class dumbell We could pose this as an optimization problem w.r.t I (i0, i1, . . . , imn) arg max

I (Sc(I) − λΩ(I))

Sc(I) = Score for class C before softmax Ω(I) = Some regularizer to ensure that I looks like an image

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-23
SLIDE 23

23/72

Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 5 5 256 23 23 Convolution 3 3 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling dense 4096 dense 4096 dense 1000

Dumbell

We can essentially think of the image as a collection of parameters Keep the weights of trained convolu- tional neural network fixed Now adjust these parameters(image pixels) so that the score of a class is maximized Let us see how

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-24
SLIDE 24

24/72

Zero Image

96 55 55 Convolution 3 3 96 27 27 MaxPooling 5 5 256 23 23 Convolution 3 3 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling dense 4096 dense 4096 dense 1000

Classi

1 Start with a zero image 2 Set the score vector to be [0, 0, . . . 1, 0, 0] 3 Compute the gradient ∂Sc(I)

∂ik

4 Now update the pixel ik = ik − η ∂Sc(I)

∂ik

5 Now again do a forward pass through the network 6 Go to step 2 Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-25
SLIDE 25

25/72

96 55 55 Convolution 3 3 96 27 27 MaxPooling 5 5 256 23 23 Convolution 3 3 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling dense 4096 dense 4096 dense 1000

Dumbell Cup Dalmation Bell Pepper Lemon Husky

Lets look at the images obtained for maximizing some class scores

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-26
SLIDE 26

26/72

3 227 227 Input 11 11 96 55 55 Convolution 3 3

S = 2,P = 0 Parameters: 0

96 27 27 MaxPooling 5 5 256 23 23 Convolution 3 3 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling dense 4096 dense 4096 dense 1000

We can actually do this for any arbit- rary neuron in the convnet Repeat: Feed an image through the network Set activation in layer of interest to all zero, except for a neuron of interest Backprop to image ik = ik − η ∂A(I)

∂ik ,

A(I) is the activation of the ith neuron in some layer

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-27
SLIDE 27

27/72

Layer-8 Layer-7

Let us look at some “updated” images which excite certain neurons in some layer Starting with different initializations instead of using a zero image we can get different insights Each of these 4 images are obtained by focusing on one neuron in layer 8 and starting with different initializa- tions We can do a similar analysis with

  • ther layers

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-28
SLIDE 28

28/72

Module 13.7: Creating images from embeddings

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-29
SLIDE 29

29/72

3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 5 5 256 23 23 Convolution 3 3 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling dense 4096 dense 4096 dense 1000

We could think of the fc7 layer as some kind of an embedding for the image Question: Given this embedding can we reconstruct the image? We can pose this as an optimization problem

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-30
SLIDE 30

30/72

3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 5 5 256 23 23 Convolution 3 3 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling dense 4096 dense 4096 dense 1000

Find an image such that Its embedding is similar to a given embedding It looks natural (some prior regular- ization)

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-31
SLIDE 31

31/72

3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 5 5 256 23 23 Convolution 3 3 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling dense 4096 dense 4096 dense 1000

φ0 :Embedding of an image of interest X :Random image (say zero image) Repeat

Forward pass using X and compute φ(x). Compute L (i) = ||φ(x) − φ0||2 + λ||φ(x)||6

6

ik = ik − η L (i)

∂ik

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-32
SLIDE 32

32/72

Original Image

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-33
SLIDE 33

33/72

Conv-1

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-34
SLIDE 34

34/72

Relu-1

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-35
SLIDE 35

35/72

Mpool-1

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-36
SLIDE 36

36/72

Norm-1

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-37
SLIDE 37

37/72

Conv-2

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-38
SLIDE 38

38/72

Relu-2

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-39
SLIDE 39

39/72

Mpool-2

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-40
SLIDE 40

40/72

Norm-2

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-41
SLIDE 41

41/72

Conv-3

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-42
SLIDE 42

42/72

Relu-3

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-43
SLIDE 43

43/72

Conv-4

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-44
SLIDE 44

44/72

Relu-4

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-45
SLIDE 45

45/72

Conv-5

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-46
SLIDE 46

46/72

Relu-5

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-47
SLIDE 47

47/72

Mpool-5

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-48
SLIDE 48

48/72

FC-6

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-49
SLIDE 49

49/72

Relu-6

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-50
SLIDE 50

50/72

FC-7

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-51
SLIDE 51

51/72

Relu-7

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-52
SLIDE 52

52/72

FC-8

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-53
SLIDE 53

53/72

Module 13.8: Deep Dream

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-54
SLIDE 54

54/72

3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 256 23 23 Convolution 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling

Suppose instead of starting with a blank (zero) image we start with an actual image. We focus on some layer and check the activations of the neurons We want to change the image so that these neurons fire even more

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-55
SLIDE 55

55/72

3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 256 23 23 Convolution 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling

hij How would we achieve this? Suppose we want to boost the activa- tion hij (some neuron in some layer) We can formulate this as the following

  • ptimization problem

max

I

L (I) L (I) = h2

ij

Consider a pixel imn in the image ∂L (I) ∂imn = ∂L (I) ∂hij ∂hij ∂imn

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-56
SLIDE 56

56/72

3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 256 23 23 Convolution 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling

hij Once the image is updated

  • imn =

imn + ∂L (I)

∂imn

  • we feed it back to the

network This time the target neurons should fire even more (because we have pre- cisely modified the image to achieve this) Doing this iteratively would make the image more and more like the pat- terns that cause the neuron to fire Let us run this algorithm

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-57
SLIDE 57

57/72 Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-58
SLIDE 58

58/72 Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-59
SLIDE 59

59/72 Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-60
SLIDE 60

60/72

3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 256 23 23 Convolution 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling

So what exactly is happening here? The network has been trained to detect certain patterns (dogs, cat, birds etc.) which appear frequently in the ImageNet data It starts seeing these patterns even when they hardly exist If a cloud looks a little bit like a bird, the network will make it look more like a bird. This in turn will make the net- work recognize the bird even more strongly

  • n the next pass and so forth, until a

highly detailed bird appears seemingly out

  • f nowhere. - Google∗

∗research.googleblog.com/2015/06/inceptionism-

going-deeper-into-neural.html

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-61
SLIDE 61

61/72

Module 13.9: Deep Art

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-62
SLIDE 62

62/72 Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-63
SLIDE 63

63/72

3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 256 23 23 Convolution 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling 3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 256 23 23 Convolution 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling 3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 256 23 23 Convolution 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling 3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 256 23 23 Convolution 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling

want them to be equal

To design a network which can do this, we first define two quantities Content Targets : The activations

  • f all layers for the given content im-

age Ideally, we would want the new im- age to be such that it’s activations are also close to those of the original con- tent image Let p, x be the activations of the con- tent image and the new image (to be generated) respectively Lcontent( p, x) =

  • ijk

( pijk − xijk)2

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-64
SLIDE 64

64/72

3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 256 23 23 Convolution 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling

Next we would want the style of the generated image to be the same as the style image How do we capture the style of the image? Turns out that if V ∈ R64×(256×256) is the activation at a layer then V T V ∈ R64×64 captures the style of the image The deeper layers capture more of this style information

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-65
SLIDE 65

65/72

Content Image

3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 256 23 23 Convolution 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling

Content Image

3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 256 23 23 Convolution 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling 3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 256 23 23 Convolution 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling 3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 256 23 23 Convolution 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling

V T

1 V1

V T

2 V2

equal

To ensure that the style of the new image captured by layer ℓ matches the style of the style image, we can use the following objective function : Eℓ =

  • ij

(Gℓ

j − Aℓ ij)2

where Gℓ and Aℓ are the style gram matrices computed at layer ℓ for the style image and new image respect- ively. Lstyle( a, ¯ x) =

L

  • ℓ=0

wℓEℓ

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-66
SLIDE 66

66/72

3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 5 5 256 23 23 Convolution 3 3 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling 3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 5 5 256 23 23 Convolution 3 3 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling 3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 5 5 256 23 23 Convolution 3 3 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling 3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 256 23 23 Convolution 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling 3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 256 23 23 Convolution 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling 3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 256 23 23 Convolution 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling

The total loss is given by :- Ltotal( p, a, x) = αLcontent( p, x) + βLstyle( a, x)

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-67
SLIDE 67

67/72

Module 13.10: Fooling Deep Convolution Neural Networks

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-68
SLIDE 68

68/72

Turns out that using this idea of optimizing over the input, we can also “fool” ConvNets Let us see how

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-69
SLIDE 69

69/72

3 227 227 Input 11 11 96 55 55 Convolution 3 3 96 27 27 MaxPooling 5 5 256 23 23 Convolution 3 3 256 11 11 MaxPooling 3 3 384 9 9 Convolution 3 3 384 7 7 Convolution 3 3 256 5 5 Convolution 3 3 256 2 2 MaxPooling
  • strich

. . .

bus

. . . Suppose we feed in an image to a Convnet. Now instead of maximizing the log- likelihood of the correct class (bus) we set the objective to maximize some incorrect class (say, ostrich) Turns out that with minimal changes to the image (using backprop) we can soon convince the Convnet that this is an ostrich. Let us see some examples

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-70
SLIDE 70

70/72 ∗Intriguing properties of neural networks, Szegedy et al., 2013

Notice that the changes are so minimal that the two images are indistin- guishable to humans But the ConvNet thinks that the third image ob- tained by adding the first image to the second im- age is an ostrich

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-71
SLIDE 71

71/72 ∗Neural Networks are Easily Fooled: High Confidence Predictions for Unrecognizable

Images Nguyen, Yosinski, Clune, 2014

We can also do this start- ing with random images and then optimizing them to pre- dict some class. In all these cases the classi- fier is 99.6% confident of the class Let us see an intuitive ex- planation of why this hap- pens

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13

slide-72
SLIDE 72

72/72

Images are extremely high dimen- sional objects (R227×227) There are many many many points in this high dimensional space Of these only a few are images (of which we see some during training) Using these training images we fit some decision boundaries While doing so we also end up taking decisions about the many many un- seen points in this high dimensional space (Notice the large green and red regions which do not contain any training points)

Mitesh M. Khapra CS7015 (Deep Learning) : Lecture 13