0% found this document useful (0 votes)
26 views29 pages

Lecture 2

This document provides an introduction to convolutional neural networks (CNNs) concepts. It discusses image processing techniques like sharpening filters, and CNN concepts like stride, padding, filters, and convolutional layers. Padding is used to prevent the image from shrinking after multiple convolutions. Stride controls the amount of shifting when applying filters. Filters in CNNs represent neurons and are learned through training. Convolutional layers act as hidden layers, with deeper layers learning more complex features like shapes from simpler features like edges.

Uploaded by

aly869556
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views29 pages

Lecture 2

This document provides an introduction to convolutional neural networks (CNNs) concepts. It discusses image processing techniques like sharpening filters, and CNN concepts like stride, padding, filters, and convolutional layers. Padding is used to prevent the image from shrinking after multiple convolutions. Stride controls the amount of shifting when applying filters. Filters in CNNs represent neurons and are learned through training. Convolutional layers act as hidden layers, with deeper layers learning more complex features like shapes from simpler features like edges.

Uploaded by

aly869556
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Lecture 2: Introduction to

CNN Concepts
By: Dr. Eman Ahmed
Contents
• Intro to image processing.
• Sharpening (Edge Detection) Filters
• What is Stride?
• What is Padding? Why?
• Intro to CNN
What is image?

Image

Gray Scale Colored


Example of Grayscale Image
Colored Image Representation

(Number of rows x Number of Columns x3)x1


What is the problem of using the pixels as
feature vector?
What is the problem of using classical Neural
Networks?
• Doesn’t take correlation between pixels into consideration
• Translation
• Rotation
Filters in Image
•Blurred Image •Unblurred Image – No Noise
What is Filter?
• A filter is a matrix that can be applied to an image to make certain
function.
• A filter can remove noise to enhance the image.
• A filter can detect certain regions in the image such as edges.
Vertical Edge Detection

10 110 1010 0 0 0 1 0 -1 0 30 30 0
0 0 30 30 0
1 0 -1
10 110 1100 0 0 0
0 1 0 -1
110 110 1010 0 0 0
0 0
110 110 1010 0 0 0
0 0
110 110 1010 0 0 0
0 0
110 101 1010 0 0 0
0 0
Horizontal Edge Detection

10 10 10 10 10 10
1 1 1 0 0 0 0
10 10 10 10 10 10 0 0 0 30 30 30 30
30 30 30 30
10 10 10 10 10 10 -1 -1 -1
0 0 0 0
0 0 0 0 0 0

0 0 0 0 0 0

0 0 0 0 0 0
Output Image Dimension
• n: original image dimension
• f: filter original dimension
• Output image dimension = (n-f+1)x(n-f+1)
Vertical Edge Detection
1 0 -1

1 0 -1

1 0 -1

2 1 0 8 9 4

4 0 5 5 2 6
W1 W2 W3
4 4 6 7 1 8

6 5 8 3 0 4 * W4 W5 W6
=
5 8 5 0 0 0
W7 W8 W9
4 6 8 0 8 7
What is Padding?
• Extending image size by adding rows and columns of zeros.
• When padding (P=1):
• One row is added up and down
• One column is added left and right.
• So, when P = 1 , number of rows increases by 2 and number of columns
increases by 2.
• When P = 2:
• Number of rows increases by 4 and number of columns increases by 4.
Why Padding?
• Shrinking the size of image after convolution (After few convolution,
the image will vanish).
• Edge pixels are not used much in the calculations.
Output Image Dimension With Padding

Strides
• The amount of shifting the filter.
• By default, stride = 1 meaning shifting one pixel.

Classical Pattern Recognition Flow

Image Preprocessing Feature Extraction Feature Selection Classification


Filters Filters Optional

CNNs Weights of Filters are the features and are Any classifier such
trained by a neural network called as SVM can be
Convolutional Neural Networks (CNNs) used to classify the
image using the
extracted features.
Convolution over volumes
• Colored image has 3 matrices (R,G,B), how can we apply filter to it?
• The filter must have 3 dimensions, one applies to R, one applies to G,
and one applies to B.
• But, the output of the filter must have one dimension, how?
• For each pixel, the 3 values obtained by the filter are added resulting
in one value.
Multiple Filters
Convolutional Layer
• So , each filter can represent a neuron in the classical neural network.
• Number of filters = Number of Neurons in the hidden layer.
• A sequence of convolutional layers act as a sequence of hidden layers.
• Deeper hidden layers learn complex features. For example, the first
filters learn simple edges, the next ones can learn a combination of
these edges forming a shape, the next ones are able to learn more
complex shapes, …. Etc.
Notations

CNN Layers
• Feature Extraction
• Convolution
• Pooling (Feature Selection)
• Classification
• Fully connected
• Softmax (SVM)
Resources
• Andrew Ng: Deep Learning course on Coursera
• Andrew Ng: Convolutional Neural Networks Course on Coursera
• https://medium.com/swlh/convolutional-neural-networks-part-3-con
volutions-over-volume-and-the-convnet-layer-91fb7c08e28b
Thanks

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy