You are on page 1of 25

Trí tuệ nhân tạo trong điều khiển

Convolution Neural Networks


Mạng nơron tích chập
Review
Materials
What is CNNs?
✓Convolution Neural Networks
❖ CNNs
❖ ConvNets
Applications
✓ Computer vision
❖ Face recognition
❖ Scene labeling
❖ Image classification
❖ Action recognition
❖ Human pose estimation
❖ Document analysis
✓ Natural language processing
❖ Speech recognition
❖ Text classification
Demo
✓ Demo:
❖ Image classification: http://cs231n.stanford.edu/
❖ Lane detection
❖ Off-Road Scenes Segmentation and Classification
❖ Self Driving Car
❖ Handwritten digits recognition
❖ Facial expression recognition
CNNs vs. Regular NNs
✓ Regular NNs: don’t scale well to full images
❖ CIFAR-10: image size 32x32x3
A single fully-connected neuron in a first hidden
layer has 32*32*3 = 3072 weights
❖ Image size: 200x200x3
200*200*3 = 120,000 weights
Over fitting
✓ CNNs: Local connectivity
Shared weights
What computers see pictures?
A toy example (forward)
X O

255 0 255 0 255 0

0 255 0 255 0 255

255 0 255 0 255 0


A toy example (forward)
Input I

I11 I12 I13

I21 I22 I23


P(I = X) = ?
I31 I32 I33 P(I = O) = ?

Convolution Layer: 2 kernels (4 weights


each) + 2 biases k111 k112 k211 k212
Fully Connected Layer: 16 weights
(regular NN) + 2 biases k121 k122 k221 k222

28 parameters Kernel 1 Kernel 2


Convolution layer
b1
dot product Activation
dot product b | map 1
1
I11 I12 I13
k111 k112 |
I21 I22 I23
k121 k122 |
I31 I32 I33 Kernel 1 b1
dot product |
dot product Activation
b1 = – 17.2 b1
map 2
b2 = – 25.1 k212
k211
f(x) = 1/(1 + e-x)

k111I11 + k112I12 k221 k222


+ k121I21 + k122I22 Kernel 2
A toy example (forward)
Case 1: X
1 0 w1 b3

0 1
| ? ~1

w8
0 1 w9 b
4

1 0 | ? ~0
w16
Activation map 1 & 2
w1, …, w8= [76.7 -76.2 -91.4 24.8 -92.7 24.3 -14.0 -71.3]
w9, …, w16= [-98.9 69.6 77.5 -96.6 18.9 -53.8 -96.0 99.4]
b3, b4= [-47.9 -60.0]
A toy example (forward)
Case 2: O
0 1 w1 b3

1 0
| ? ~0

w8
1 0 w9 b
4

0 1 | ? ~1
w16
Activation map 1 & 2
w1, …, w8= [76.7 -76.2 -91.4 24.8 -92.7 24.3 -14.0 -71.3]
w8, …, w16= [-98.9 69.6 77.5 -96.6 18.9 -53.8 -96.0 99.4]
b3, …, b4= [-47.9 -60.0]
Questions
Q: Where do all parameters come from?
A: Backpropagation

Q: Why local connectivity?

Q: Why shared weights?


General cases
b

|
4 weights
1 bias 27 weights
1 bias
R, G, B layers

|
General cases
Convolution layer 1 b

|

|
b

K activation maps

K kernels
General cases
Pooling/Subsample layer Max pooling
Average pooling

10x10 matrices 5x5 matrices


General cases
Pooling/Subsample layer
General cases
Convolutional layer 2
b

|
4 weights
1 bias 27 weights
1 bias

| K kernels

36 weights 1 bias
General cases
Fully Connected Layer
Convolution

By Cmglee - Own work, CC BY-SA 3.0,


https://commons.wikimedia.org/w/index.php?curid=20206883
Convolution
Convolution

By Convolution_of_box_signal_with_itself.gif: Brian Ambergderivative work: Tinos (talk) -


Convolution_of_box_signal_with_itself.gif, CC BY-SA 3.0,
https://commons.wikimedia.org/w/index.php?curid=11003835
Convolution

By Convolution_of_spiky_function_with_box.gif: Brian Ambergderivative work: Tinos (talk) -


Convolution_of_spiky_function_with_box.gif, CC BY-SA 3.0,
https://commons.wikimedia.org/w/index.php?curid=11003944
Convolution

You might also like