官术网_书友最值得收藏!

How to do it...

Let's load this dataset using the Keras APIs and print the shape and size:

from keras.datasets import cifar10

(X_train, y_train), (X_test, y_test) = cifar10.load_data()
print("X_train shape: " + str(X_train.shape))
print(y_train.shape)
print(X_test.shape)
print(y_test.shape)

The first time, it will download the file from the preceding site:

Downloading data from https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz
8192/170498071 [..............................] - ETA: 22:43
40960/170498071 [..............................] - ETA: 9:12
106496/170498071 [..............................] - ETA: 5:27
237568/170498071 [..............................] - ETA: 3:11
286720/170498071 [..............................] - ETA: 4:39
...
170418176/170498071 [============================>.] - ETA: 0s
170467328/170498071 [============================>.] - ETA: 0s
170500096/170498071 [==============================] - 308s 2us/step

The following output shows X_train has 50,000 images of size 32 x 32 containing three channels. y_train has 50,000 rows and one column with the image label. X_test and y_test also have a similar shape for 10,000 rows:

X_train shape: (50000, 32, 32, 3)
y_train shape: (50000, 1)
X_test shape: (10000, 32, 32, 3)
y_test shape: (10000, 1)

In the next recipe, we look at how to load the CIFAR-100 dataset.

主站蜘蛛池模板: 成武县| 鄯善县| 西贡区| 武陟县| 离岛区| 平谷区| 合肥市| 南召县| 平度市| 泾源县| 阿拉尔市| 达拉特旗| 旌德县| 胶南市| 扶余县| 依安县| 庆云县| 交城县| 西盟| 富民县| 岳阳市| 呼玛县| 新晃| 吉木萨尔县| 文昌市| 金寨县| 同德县| 丹阳市| 东兴市| 临夏市| 和顺县| 永修县| 当雄县| 云林县| 通辽市| 连江县| 淮滨县| 吴川市| 亳州市| 栖霞市| 青神县|