You are on page 1of 32

Convolutional Neural

Network (CNN)

Day 3
Working with Real World
CNN Architectures
Image dataset
?
MNIST = Mixed National Institute of Standards and Technology - Download the dataset at http://yann.lecun.com/exdb/mnist/
Working
with real
world
data
How to
organize image
data?
Visualize
image data

How to
organize image
data?
Visualize
image data

How to
organize image
data?

Loading Images
for training
Working with Visualize
different image data
image Sizes

How to
organize image
data?

Loading Images
for training
Working with Visualize
different image data
image Sizes

How to
organize image
data?

How to get more


Loading Images data for training?
for training
How to
organize
Image Data
Image files

Class # 1 folder

Class # 2 folder

Class # 3 folder
Training_data folder

Class # 4 folder

Class # 5 folder

main_folder
Class # 1 folder

Class # 2 folder
...
Test_data folder Class # 3 folder
...
Class # 4 folder
...
Class # 5 folder
...
Image files

Class # 1 folder

Class # 2 folder

Class # 3 folder
image_data folder

Class # 4 folder

Class # 5 folder

Another approach
Another approach
Store info about folder/images in csv file
Visualizing image
Using Keras image class
Feeding
images for
training
Daisy

Dandelion
Convert image
Read image Resize image,
data to Numpy Neural Network Rose
from disk if needed
array
Sunflower

Tulip
Daisy

Dandelion
Convert image
Read image Resize image,
data to Numpy Neural Network Rose
from disk if needed
array
Sunflower

Tulip

This can be done by Keras Image


module
Loading all images at once can result in…

Memory Error!!!
1,000s of Images available on Disk
1,000s of Images available on Disk

Number of Images to be loaded in


memory at once
= batch size
1,000s of Images available on Disk

Using Python Generator - read fixed number of images at one time

Number of Images loaded in memory


at once
= batch size
Building an image classifier using

Batch Generator
How do we
get more
data?
Image Augmentation
Creating more images from existing Image
Original image New image

Horizontal flip
Original image New image

Shifting image randomly


Original image New image

Rotating image randomly


Original image New image

Shearing image
Original image New image

Zoomed image
Original image New image

Multiple transformations at once


Image Augmentation using

ImageDataGenerator
Building an image classifier using

Image Augmentation

You might also like