Getting ready

In this recipe, we are going to use the fashion MNIST dataset. We used this dataset in Chapter 2, Working with Convolutional Neural Networks, where we divided it into training and testing datasets. We will use this dataset and flatten each image that's 28x28 in size into an array of 784 values.

Let's start by importing the required libraries:

library(keras)
library(abind)
library(grid)

Next, we load the dataset and reshape it:

mnist <- dataset_fashion_mnist()
x_train <- mnist$train$x/255
x_test <- mnist$test$x/255
x_train <- array_reshape(x_train, c(nrow(x_train), 784), order = "F")
x_test <- array_reshape(x_test, c(nrow(x_test), 784), order = "F")

Our data is ready. In the next section, we will build a VAE model.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset