CIFAR - 10

Decode data

Activate virtual environment


In [1]:
%%bash
source ~/kerai/bin/activate

Imports


In [2]:
%matplotlib inline
from helper import get_class_names, get_train_data, get_test_data, plot_images


Using TensorFlow backend.

Get class names


In [3]:
class_names = get_class_names()
class_names


Decoding file: data/batches.meta
Out[3]:
['airplane',
 'automobile',
 'bird',
 'cat',
 'deer',
 'dog',
 'frog',
 'horse',
 'ship',
 'truck']

Decode and fetch the training data


In [4]:
images_train, labels_train, class_train = get_train_data()


Decoding file: data/data_batch_1
Decoding file: data/data_batch_2
Decoding file: data/data_batch_3
Decoding file: data/data_batch_4
Decoding file: data/data_batch_5

Decode and fetch the testing data


In [5]:
images_test, labels_test, class_test = get_test_data()


Decoding file: data/test_batch

In [6]:
print("Training set size:\t",len(images_train))
print("Testing set size:\t",len(images_test))


Training set size:	 50000
Testing set size:	 10000

Display a few examples from the dataset


In [7]:
# Get the first images from the test-set.
images = images_test[0:9]

# Get the true classes for those images.
labels_true = labels_test[0:9]

# Plot the images and labels using our helper-function above.
plot_images(images=images, labels_true=labels_true, class_names=class_names)