Multiclass classification with the CIFAR-10 dataset
The CIFAR-10 dataset consists of 60,000 32x32 colorful images in 10 classes, with 6,000 images per class. There are 50,000 training images and 10,000 test images.
Getting and previewing the dataset
Similar to the preceding example, we will use the MLDatasets
package to retrieve the CIFAR10
dataset. Let's start by loading the package and having a quick look at the data:
using Images, ImageView, MLDatasets, MXNet train_x, train_y = CIFAR10.traindata() test_x, test_y = CIFAR10.testdata() size(train_x) # Main> (32, 32, 3, 50000) size(train_y) # Main> (50000,) join(unique(train_y), ", ") # Main> "6, 9, 4, 1, 2, 7, 8, 3, 5, 0"
We have used the size
function to show the dimensionality of the data and the unique
function to list the possible classes. Running the size
function on the train_x
dataset tells us that we have a training dataset of 500,000 32x32-pixel, 3-channel RGB images. train_y
also contains 50,000 images and specifies 10...