09 - Convolutional Neural Networks (CNN)

Class: CSCE-421


Notes:

Fully Connected Layer

Pasted image 20260219105125.png|500

Convolution Layer

Pasted image 20260219100750.png|500

Pasted image 20260219100813.png|500

Notes:

Pasted image 20260219101103.png|500

Notes:

Pasted image 20260219101206.png|500

Notes:

Pasted image 20260219101346.png|500

Notes:

Pasted image 20260219101455.png|500

Pasted image 20260219101509.png|500

f[x,y]g[x,y]=n1=n2=f[n1,n2]g[xn1,yn2]

Notes:

Pasted image 20260219101615.png|500

Notes:

A closer look at spatial dimensions:

Pasted image 20260219102031.png|450
Pasted image 20260219102110.png|450
Pasted image 20260219102154.png|450
Pasted image 20260219102207.png|450
Pasted image 20260219102224.png|450

Notes:

size=input size - filter size2+1

Pasted image 20260219102455.png|450
Pasted image 20260219102509.png|450
Pasted image 20260219102525.png|450
Pasted image 20260219102544.png|475
Pasted image 20260219102612.png|500

 Output size: (NF)/ stride +1 e.g. N=7,F=3: stride 1(73)/1+1=5 stride 2(73)/2+1=3 stride 3(73)/3+1=2.33

Notes:

In practice: Common to zero pad the border

Pasted image 20260219102912.png|500

Notes:

Pasted image 20260219103225.png|500

Notes:

Pasted image 20260219103346.png|500

Convolution: translation-equivariance

Pasted image 20260219103443.png|400

Pasted image 20260219103600.png|500

Convolution = local connection + weight-sharing

Pasted image 20260219103705.png|500

Notes:

Convolution: linear transform

Pasted image 20260219104430.png|500

Notes:

Receptive Field

Pasted image 20260219105052.png|500

Notes:

Examples time:

Input volume: 32×32×3
105×5 filters with stride 1 , pad 2

Pasted image 20260224100140.png|200

Output volume size: ?

Number of parameters in this layer?

1x1 convolution layers make perfect sense

Pasted image 20260224101911.png|425

Notes:

Pooling Layer

Pasted image 20260224102723.png|300

MAX POOLING

Pasted image 20260224102749.png|400

Notes:

Fully Connected Layer

How to perform BP in convolution, pooling layers?

Pasted image 20260224103244.png|500

Notes:

Optional for CSCE-421

Backpropagation in Convolutional Neural Networks

Backpropagating through Convolutions

Backpropagation with an Inverted Filter (Single Channel)

a b c
d e f
g h i
Filter during convolution
i h g
f e d
c b a
Filter durin backpropagation

Notes:

Mini-batch SGD

Loop:

  1. Sample a batch of data
  2. Forward prop it through the graph (network), get loss
  3. Backprop to calculate the gradients
  4. Update the parameters using the gradient

Activation Functions

tanh(x)

ReLU (Rectified Linear Unit)

Notes:

TLDR: in practice: