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

  • Keras Deep Learning Cookbook
  • Rajdeep Dua Manpreet Singh Ghotra
  • 158字
  • 2021-06-10 19:38:51

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.

主站蜘蛛池模板: 汶川县| 昆山市| 北宁市| 阿克苏市| 肃南| 图们市| 徐闻县| 红河县| 宜川县| 金沙县| 屯门区| 县级市| 眉山市| 南靖县| 安徽省| 凤城市| 玉溪市| 赤壁市| 东兰县| 呼和浩特市| 五寨县| 静宁县| 略阳县| 开鲁县| 玉溪市| 光泽县| 安化县| 宁蒗| 炎陵县| 达州市| 额敏县| 额尔古纳市| 元朗区| 彩票| 凉山| 历史| 临海市| 东方市| 临夏市| 沧州市| 宣武区|