Reading the dataset

  1. Load the CIFAR dataset using the steps explained in Chapter 3, Convolution Neural Network. The data files data_batch_1 and data_batch_2 are used to train. The data_batch_5 and test_batch files are used for validation and testing, respectively. The data can be flattened using the flat_data function:
train_data <- flat_data(x_listdata = images.rgb.train)
test_data <- flat_data(x_listdata = images.rgb.test)
valid_data <- flat_data(x_listdata = images.rgb.valid)
  1. The flat_data function flattens the dataset as NCOL = (Height * Width * number of channels), thus the dimension of the dataset is (# of images X NCOL). The images in CIFAR are 32 x 32 with three RGB channels; thus, we obtain 3,072 columns after data flattening:
> dim(train_data$images)
[1] 40000 3072
..................Content has been hidden....................

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