Skip to Main Content
Practical Convolutional Neural Networks
book

Practical Convolutional Neural Networks

by Mohit Sewak, Md. Rezaul Karim, Pradeep Pujari
February 2018
Intermediate to advanced content levelIntermediate to advanced
218 pages
5h 31m
English
Packt Publishing
Content preview from Practical Convolutional Neural Networks

Step 2 – Loading the training/test images to generate train/test set

We set the number of color channels as 3 for the images. In the previous section, we have seen that it should be 1 for grayscale images:

num_channels = 3 

For the simplicity, we assume the image dimensions should be squares only. Let's set the size to be 128:

img_size = 128 

Now that we have the image size (that is, 128) and the number of the channel (that is, 3), the size of the image when flattened to a single dimension would be the multiplication of the image dimension and the number of channels, as follows:

img_size_flat = img_size * img_size * num_channels 

Note that, at a later stage, we might need to reshape the image for the max pooling and convolutional layers, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Understanding Convolutional Neural Networks (CNNs)

Understanding Convolutional Neural Networks (CNNs)

Nell Watson
Practical Machine Learning for Computer Vision

Practical Machine Learning for Computer Vision

Valliappa Lakshmanan, Martin Görner, Ryan Gillard

Publisher Resources

ISBN: 9781788392303Supplemental Content