CS 4803 / 7643: Deep Learning Topics: Specifying Layers Forward - - PowerPoint PPT Presentation
CS 4803 / 7643: Deep Learning Topics: Specifying Layers Forward - - PowerPoint PPT Presentation
CS 4803 / 7643: Deep Learning Topics: Specifying Layers Forward & Backward autodifferentiation (Beginning of) Convolutional neural networks Zsolt Kira Georgia Tech Projects We will release a set of project ideas for those
Projects
- We will release a set of project ideas for those that
are having trouble coming up with them
– NEW: Facebook will develop a set of project ideas as well, with some of their researchers involved – Should be released early/mid Feb.
(C) Dhruv Batra & Zsolt Kira 2
(C) Dhruv Batra & Zsolt Kira 3
(C) Dhruv Batra & Zsolt Kira 4
(C) Dhruv Batra & Zsolt Kira 5
Types of Projects
- Application
– Image to cooking recipe – Voice cloning – Etc. – Need to modify/implement something; not enough to just take code and run it
- Rigorous empirical report
– Have a hypothesis or something you’re trying to test – Perform rigorous experiments with many (reasonable) conditions that would support/refute your hypothesis
- Reproduction of a paper
– Not just running online code!
- Theory
- Novel new method
– (not necessary for the project, good if goal is publishing!)
(C) Dhruv Batra & Zsolt Kira 6
Recap from last time
(C) Dhruv Batra & Zsolt Kira 7
8
(x,y,z are scalars) x y z
* Modularized implementation: forward / backward API
Slide Credit: Fei-Fei Li, Justin Johnson, Serena Yeung, CS 231n
(C) Dhruv Batra & Zsolt Kira 9
+ sin( ) x1 x2 *
Example: Forward mode AD
https://www.cc.gatech.edu/classes/AY2020/cs7643_spring/slides/autodiff_forward_reverse.pdf
(C) Dhruv Batra & Zsolt Kira 10
Example: Reverse mode AD
+ sin( ) x1 x2 *
https://www.cc.gatech.edu/classes/AY2020/cs7643_spring/slides/autodiff_forward_reverse.pdf
11
Example: 200x200 image 40K hidden units
- Spatial correlation is local
- Waste of resources + we have not enough
training samples anyway..
Fully Connected Layer
Slide Credit: Marc'Aurelio Ranzato
~2B parameters!!!
12
Example: 200x200 image 40K hidden units “Filter” size: 10x10 4M parameters Note: This parameterization is good when input image is registered (e.g., face recognition).
Locally Connected Layer
Slide Credit: Marc'Aurelio Ranzato
13
STATIONARITY? Statistics similar at all locations
Locally Connected Layer
Slide Credit: Marc'Aurelio Ranzato
14
Share the same parameters across different locations (assuming input is stationary): Convolutions with learned kernels
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
How to implement this (and efficiently)?
Convolutions for mathematicians
- On operation on two functions
and to produce a third function
- E.g. input
and kernel or weighting function
16 (C) Peter Anderson
Convolutions!
- Math vs. CS vs. programming viewpoints
(C) Dhruv Batra & Zsolt Kira 17
Convolutions for mathematicians
- On operation on two functions
and to produce a third function
- E.g. input
and kernel or weighting function
18 (C) Peter Anderson
Convolutions for mathematicians
- One dimension
19
- Two dimensions
1 2 1 2 1 2
(C) Peter Anderson
Convolutions for programmers
- Iterate over the kernel instead of the image
20
y
- Later - implementation as matrix multiplication
- Implement cross-correlation instead of convolution
(C) Peter Anderson
Discrete convolution
- Discrete Convolution!
- Very similar to correlation but associative
2D Convolution 1D Convolution Filter
A note on sizes
Filter m m Input N N Output N-m+1 N-m+1
MATLAB to the rescue!
- conv2(x,w, ‘valid’)
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
(C) Dhruv Batra & Zsolt Kira 23
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
(C) Dhruv Batra & Zsolt Kira 24
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
(C) Dhruv Batra & Zsolt Kira 25
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
(C) Dhruv Batra & Zsolt Kira 26
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
(C) Dhruv Batra & Zsolt Kira 27
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
(C) Dhruv Batra & Zsolt Kira 28
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
(C) Dhruv Batra & Zsolt Kira 29
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
(C) Dhruv Batra & Zsolt Kira 30
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
(C) Dhruv Batra & Zsolt Kira 31
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
(C) Dhruv Batra & Zsolt Kira 32
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
(C) Dhruv Batra & Zsolt Kira 33
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
(C) Dhruv Batra & Zsolt Kira 34
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
(C) Dhruv Batra & Zsolt Kira 35
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
(C) Dhruv Batra & Zsolt Kira 36
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
(C) Dhruv Batra & Zsolt Kira 37
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
(C) Dhruv Batra & Zsolt Kira 38
Convolution Explained
- http://setosa.io/ev/image-kernels/
- https://github.com/bruckner/deepViz
(C) Dhruv Batra & Zsolt Kira 40
Learn multiple filters.
E.g.: 200x200 image 100 Filters Filter size: 10x10 10K parameters
Convolutional Layer
Slide Credit: Marc'Aurelio Ranzato
(C) Dhruv Batra & Zsolt Kira 41
32 32 3
Convolution Layer
32x32x3 image -> preserve spatial structure
width height depth
Slide Credit: Fei-Fei Li, Justin Johnson, Serena Yeung, CS 231n
32 32 3
Convolution Layer
5x5x3 filter 32x32x3 image
Convolve the filter with the image i.e. “slide over the image spatially, computing dot products”
Slide Credit: Fei-Fei Li, Justin Johnson, Serena Yeung, CS 231n
32 32 3
Convolution Layer
5x5x3 filter 32x32x3 image
Convolve the filter with the image i.e. “slide over the image spatially, computing dot products” Filters always extend the full depth of the input volume
Slide Credit: Fei-Fei Li, Justin Johnson, Serena Yeung, CS 231n
32 32 3
32x32x3 image 5x5x3 filter
1 number: the result of taking a dot product between the filter and a small 5x5x3 chunk of the image (i.e. 5*5*3 = 75-dimensional dot product + bias)
Slide Credit: Fei-Fei Li, Justin Johnson, Serena Yeung, CS 231n
Convolution Layer
32 32 3
32x32x3 image 5x5x3 filter
convolve (slide) over all spatial locations activation map 1 28 28
Slide Credit: Fei-Fei Li, Justin Johnson, Serena Yeung, CS 231n
Convolution Layer
32 32 3
32x32x3 image 5x5x3 filter
convolve (slide) over all spatial locations activation maps 1 28 28
consider a second, green filter
Slide Credit: Fei-Fei Li, Justin Johnson, Serena Yeung, CS 231n
Convolution Layer
32 32 3 Convolution Layer activation maps 6 28 28
For example, if we had 6 5x5 filters, we’ll get 6 separate activation maps: We stack these up to get a “new image” of size 28x28x6!
Slide Credit: Fei-Fei Li, Justin Johnson, Serena Yeung, CS 231n
Im2Col
(C) Dhruv Batra & Zsolt Kira 49
Figure Credit: https://petewarden.com/2015/04/20/why-gemm-is-at-the-heart-of-deep-learning/
General Matrix Multiply (GEMM)
(C) Dhruv Batra & Zsolt Kira 50
Figure Credit: https://petewarden.com/2015/04/20/why-gemm-is-at-the-heart-of-deep-learning/
Preview: ConvNet is a sequence of Convolution Layers, interspersed with activation functions 32 32 3 28 28 6 CONV, ReLU e.g. 6 5x5x3 filters
Slide Credit: Fei-Fei Li, Justin Johnson, Serena Yeung, CS 231n