February 2020
Intermediate to advanced
328 pages
8h 19m
English
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/255x_test <- mnist$test$x/255x_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.
Read now
Unlock full access