Fundamentals of Deep Learning: Part 3: Convolutional Neural Networks

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 29

FUNDAMENTALS OF

DEEP LEARNING
Part 3: Convolutional Neural Networks

1
Part 1: An Introduction to Deep Learning

Part 2: How a Neural Network Trains

AGENDA Part 3: Convolutional Neural Networks

Part 4: Data Augmentation and Deployment

Part 5: Pre-trained Models

Part 6: Advanced Architectures


AGENDA – PART 3
• Kernels and Convolution
• Kernels and Neural Networks
• Other Layers in the Model
RECAP OF THE EXERCISE

Trained a dense neural network model

Training accuracy was high

Validation accuracy was low

Evidence of overfitting
KERNELS AND
CONVOLUTION
5
KERNELS AND CONVOLUTION

Blur Sharpen

Original Image

Brighten Darken
KERNELS AND CONVOLUTION
.06 .13 .06 0 -1 0
.13 .25 .13 -1 5 -1
.06 .13 .06 0 -1 0
Blur Sharpen

0 0 0 0 0 0
0 1.5 0 0 0.5 0
Original Image
0 0 0 0 0 0
Brighten Darken
KERNELS AND CONVOLUTION

Blur Kernel Original Image Convolved Image

1 0 1 1 0 1

0 1 0 0 1 0
.06 .13 .06
0 1 1 1 1 0
.13 .25 .13 ∗ 0 1 1 1 1 0
=
.06 .13 .06
1 0 1 1 0 1

1 1 0 0 1 1
KERNELS AND CONVOLUTION

Blur Kernel Original Image Convolved Image

1 0 1 1 0 1

0 1 0 0 1 0
.06 .13 .06
0 1 1 1 1 0
.13 .25 .13 ∗ 0 1 1 1 1 0
=
.06 .13 .06
1 0 1 1 0 1

1 1 0 0 1 1
KERNELS AND CONVOLUTION

Blur Kernel Original Image Convolved Image

1
.06 0 1
.06 1 0 1

0 .25
1 0 0 1 0
.06 .13 .06
0 .13
1 .06
1 1 1 0
.13 .25 .13 ∗ 0 1 1 1 1 0
=
.06 .13 .06
1 0 1 1 0 1

1 1 0 0 1 1
KERNELS AND CONVOLUTION

Blur Kernel Original Image Convolved Image

1
.06 0 1
.06 1 0 1
.56
0 .25
1 0 0 1 0
.06 .13 .06
0 .13
1 .06
1 1 1 0
.13 .25 .13 ∗ 0 1 1 1
Total
1 0
=
.06 .13 .06
1 0 1 1 0 1

1 1 0 0 1 1
KERNELS AND CONVOLUTION

Blur Kernel Original Image Convolved Image

1 00 1
.13 1
.06 0 1
.56 .57
0 .13
1 0 0 1 0
.06 .13 .06
0 .06
1 .13
1 .06
1 1 0
.13 .25 .13 ∗ 0 1 1 1 1 0
=
.06 .13 .06
1 0 1 1 0 1

1 1 0 0 1 1
KERNELS AND CONVOLUTION

Blur Kernel Original Image Convolved Image

1 0 1 1 0 1
.56 .57 .57 .56
0 1 0 0 1 0
.7 .82 .82 .7
.06 .13 .06
0 1 1 1 1 0
.13 .25 .13 ∗ 0 1 1 1 1 0
= .69 .95 .95 .69
.06 .13 .06 .64 .69 .69 .64
1 0 1 1 0 1

1 1 0 0 1 1
STRIDE
1 0 1 1 0 1

Stride 1 0 1 0 0 1 0 .56 .57 .57 .56

0 1 1 1 1 0

1 0 1 1 0 1

Stride 2 0 1 0 0 1 0 .56 .57

0 1 1 1 1 0

1 0 1 1 0 1

Stride 3 0 1 0 0 1 0 .56 .56

0 1 1 1 1 0
PADDING
Original Image Zero Padding

0 0 0 0 0 0 0 0

1 0 1 1 0 1 0 1 0 1 1 0 1 0

0 1 0 0 1 0 0 0 1 0 0 1 0 0

0 1 1 1 1 0 0 0 1 1 1 1 0 0

0 1 1 1 1 0 0 0 1 1 1 1 0 0

1 0 1 1 0 1 0 1 0 1 1 0 1 0

1 1 0 0 1 1 0 1 1 0 0 1 1 0

0 0 0 0 0 0 0 0
PADDING
Original Image Same Padding

1 1 0 1 1 0 1 1

1 0 1 1 0 1 1 1 0 1 1 0 1 1

0 1 0 0 1 0 0 0 1 0 0 1 0 0

0 1 1 1 1 0 0 0 1 1 1 1 0 0

0 1 1 1 1 0 0 0 1 1 1 1 0 0

1 0 1 1 0 1 1 1 0 1 1 0 1 1

1 1 0 0 1 1 1 1 1 0 0 1 1 1

1 1 1 0 0 1 1 1
KERNELS AND NEURAL
NETWORKS
17
KERNELS AND NEURAL NETWORKS

Kernel

w1 w2 w3
w4 w5 w6
w7 w8 w9
KERNELS AND NEURAL NETWORKS

Kernel Neuron

x 1 w w x2
w1 w2 w3 w1
2 3
w4
w4 w5 w6
w5 w6
w7 w8 w9
𝑦ො
KERNELS AND NEURAL NETWORKS



(28, 28, 2) (28, 28, 2)
Stacked Images Stacked Images

(3, 3, 1, 2) (3, 3, 2, 2) (512) (512)


Kernels Kernels Dense Dense
(28, 28,1) (1568)
Image Input Flattened Image (10)
Vector Output Prediction
FINDING EDGES
Vertical Edges Original Image Horizontal Edges

1 0 -1 0 0 0 1 2 1
2 0 -2 0 1 0 0 0 0
1 0 -1 0 0 0 -1 -2 -1
Input

Convolution

Edges
Textures Convolution

Convolution

Convolution
Objects

Dense

Dense
NEURAL NETWORK PERCEPTION

Output
NEURAL NETWORK PERCEPTION
OTHER LAYERS IN THE
MODEL
24
MAX POOLING

110 256 153 67

12 89 88 43 256 153

10 15 50 55 23 55

23 9 49 23

25
DROPOUT

rate = 0 rate = .2 rate = .4


Input

Convolution

Max Pooling

Convolution

Dropout

Max Pooling

Convolution

Max Pooling
WHOLE ARCHITECTURE

Dense

Dense

Output
LET’S GO!
28
29

You might also like