20.03.2021 Views

Deep-Learning-with-PyTorch

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

A dataset of tiny images

165

We will approach a simple image recognition problem step by step, building from

a simple neural network like the one we defined in the last chapter. This time, instead

of a tiny dataset of numbers, we’ll use a more extensive dataset of tiny images. Let’s

download the dataset first and get to work preparing it for use.

7.1 A dataset of tiny images

There is nothing like an intuitive understanding of a subject, and there is nothing to

achieve that like working on simple data. One of the most basic datasets for image

recognition is the handwritten digit-recognition dataset known as MNIST. Here

we will use another dataset that is similarly simple and a bit more fun. It’s called

CIFAR-10, and, like its sibling CIFAR-100, it has been a computer vision classic for

a decade.

CIFAR-10 consists of 60,000 tiny 32 × 32 color (RGB) images, labeled with an integer

corresponding to 1 of 10 classes: airplane (0), automobile (1), bird (2), cat (3),

deer (4), dog (5), frog (6), horse (7), ship (8), and truck (9). 1 Nowadays, CIFAR-10 is

considered too simple for developing or validating new research, but it serves our

learning purposes just fine. We will use the torchvision module to automatically

download the dataset and load it as a collection of PyTorch tensors. Figure 7.1 gives us

a taste of CIFAR-10.

AIRPLANE AUTOMOBILE BIRD CAT DEeR

DOG FROG HORSE SHIP TRUCK

Figure 7.1

Image samples from all CIFAR-10 classes

1

The images were collected and labeled by Krizhevsky, Nair, and Hinton of the Canadian Institute For

Advanced Research (CIFAR) and were drawn from a larger collection of unlabeled 32 × 32 color images: the

“80 million tiny images dataset” from the Computer Science and Artificial Intelligence Laboratory (CSAIL)

at the Massachusetts Institute of Technology.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!