How to do it...

The Fashion-MNIST dataset contains images of 10 different types of items of clothing and accessories. It consists of 60,000 examples in the training set and 10,000 examples in the testing dataset. Each example is a 28 × 28 grayscale image, associated with a label from the 10 classes. 

  1. We import the Fashion-MNIST dataset in our environment:
fashion <- dataset_fashion_mnist()x_train <- fashion$train$xy_train <- fashion$train$yx_test <- fashion$test$xy_test <- fashion$test$y

We can check the dimensions of the train and test datasets using the commands:

dim(x_train)dim(x_test)

Now let's take a look at the data for a sample image:

 x_test[1,,]

In the following screenshot, we can see that the sample image data is in the form of ...

Get Deep Learning with R Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.