February 2018
Intermediate to advanced
218 pages
5h 31m
English
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, ...