You are on page 1of 24

AI for Robotics

Robotics and Mechatronics

CNN with Python

Lecture 8

By
Prof. Buddhika Jayasekara
buddhikaj@uom.lk
AI
technique
Natural
Intelligence
Intelligent Solution

Physical
presence
(Hardware/
Software)

11/5/2021 7:07 AM 2
Starting with Supervised Learning
❑ Load in data ( X and t)
❑ Instantiate model
❑ train (fit) model
❑ Evaluate model
Backpropagation of Error
Input space

Target space
X

t
10

8
Tartget values

0
0 1 2 3 4 5 6 7 8 9 10
X values

Feed forward neural network


3
ANN and Deep Leaning

❑ Deep - ANN
Wide

Deep

4
Convolutional Neural Network (CNN)

❑ Convolutional neural network – Neural network with


convolution
❑ What is convolution operation
▪ Modify shape of a function by other function
▪ Example- image modifications, blurr, edge detector

5
Convolutional Neural Network (CNN)

6
Convolutional Neural Network (CNN)

7
Stride
❑ Stride refers to the number of pixels the kernel filter will skip

8
Pooling

❑ Pooling provides translational invariance by subsampling


❑ reduces the size of the feature maps

9
Convolutional Neural Network (CNN)

❑ E.g. datasets
▪ MNIST – 28x28=784 input vector
▪ CIFAR-10 – 32x32x3 =3072 input vector
▪ With modern CNN, 224x224x3 -150000+ features
▪ HD image of 1280*720*3 -2.8 million

❑ Difficult to handle by dense layer

❑ Use of convolution layers

10
CNN Architecture

❑ Stage 1: series of convolution and pooling layers


▪ Feature transformer/ detector
❑ Stage 2: series of dense layers
▪ Feature classifier

11
CNN Architecture

❑ Convolution followed by pooling

12
CNN Architecture

❑ Convolution followed by pooling


▪ Input image shrinks
▪ Filter is the same and learn relatively larger patterns relative to image
▪ Learns hierarchical features

13
CNN Architecture

14
CNN -Example

15
Fashion mnist - Dataset

16
Keras: Sequential vs. Functional API

https://www.tensorflow.org/api_docs/python/tf/keras/Sequential

Self study

https://www.tensorflow.org/guide/keras/functional 17
18
19
20
21
22
23
Assignment

❑ Will be available in Moddle

24

You might also like