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:
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: