CIFAR10 DatasetΒΆ

This example shows how to download/load/import CIFAR10

6:frog, 9:truck, 9:truck, 4:deer, 1:automobile, 1:automobile, 2:bird, 7:horse, 8:sheep, 3:cat

Out:

        ... cifar-10-python.tar.gz already exists

Loading cifar10:   0%|          | 0/5 [00:00<?, ?it/s]
Loading cifar10:  20%|##        | 1/5 [00:02<00:11,  2.98s/it]
Loading cifar10:  40%|####      | 2/5 [00:03<00:07,  2.38s/it]
Loading cifar10:  60%|######    | 3/5 [00:04<00:03,  1.89s/it]
Loading cifar10:  80%|########  | 4/5 [00:04<00:01,  1.40s/it]
Loading cifar10: 100%|##########| 5/5 [00:05<00:00,  1.27s/it]
Loading cifar10: 100%|##########| 5/5 [00:05<00:00,  1.19s/it]
Dataset cifar10 loaded in6.55s.

import symjax
import matplotlib.pyplot as plt

cifar10 = symjax.data.cifar10()

plt.figure(figsize=(10, 4))
for i in range(10):

    plt.subplot(2, 5, 1 + i)

    image = cifar10["train_set/images"][i]
    label = cifar10["train_set/labels"][i]

    plt.imshow(image.transpose((1, 2, 0)) / image.max(), aspect="auto", cmap="Greys")
    plt.xticks([])
    plt.yticks([])
    plt.title("{}:{}".format(label, cifar10["label_to_name"][label]))

plt.tight_layout()

Total running time of the script: ( 0 minutes 6.801 seconds)

Gallery generated by Sphinx-Gallery