February 2020
Intermediate to advanced
328 pages
8h 19m
English
We will be using the MNIST dataset of handwritten digits in this example. It consists of 60,000 training and 10,000 test grayscale images that are 28x28 in size.
Let's start by loading the required libraries:
library(keras)library(grid)library(abind)
Now, let's load the data:
# Input image dimensionsimg_rows <- 28img_cols <- 28# The data, shuffled and split between train and test setsmnist <- dataset_mnist()x_train <- mnist$train$xy_train <- mnist$train$yx_test <- mnist$test$xy_test <- mnist$test$y
Now, we can check the dimensions of the data:
dim(x_train)
In the following screenshot, you can see that there are 60,000 images in the training data, each of which are 28x28 in size:
Now that we've done this, we can redefine ...
Read now
Unlock full access