In this section, we will go over the steps for making our image data ready for developing an image classification model. These steps will involve resizing images to obtain the same size for all images, followed by reshaping, data partitioning, and the one-hot encoding of the response variables.
Data preparation
Resizing and reshaping
To prepare the data for developing a classification model, we start by resizing the dimensions of all 18 images to the same size using the following code:
# Resizing
for (i in 1:length(temp)) {mypic[[i]] <- resize(mypic[[i]], 28, 28)}
As can be seen from the preceding code, all images are now resized to 28 x 28 x 3. Let's plot all the images again to see the impact of resizing using the...