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

CIFAR-10

Though MNIST is one of the easiest datasets to get started, the lack of color images makes it less appealing for tasks that require a colored dataset. A slight more complex dataset is CIFAR-10 by Alex and others[1], which consists of 10 categories of images with 60,000 training images and 10,000 test images, uniformly from each category. The size of each image is 32 x 32 and each has three color channels. This dataset can also be easily loaded in Keras, as follows:

from __future__ import print_function

from keras.datasets import cifar10
import matplotlib.pyplot as plt

# Download and load dataset
(x_train, y_train), (x_test, y_test) = cifar10.load_data()
labels = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck']
# to know the size of data
print("Train data shape:", x_train.shape, "Test data shape:", x_test.shape)

# plot sample image
idx = 1500
print("Label:",labels[y_train[idx][0]])
plt.imshow(x_train[idx])
plt.axis('off')
plt.show()

The labels, in order, are: airplane, automobile, bird, cat, deer, dog, frog, horse, ship, and truck.

主站蜘蛛池模板: 丹阳市| 伊宁市| 荔浦县| 安泽县| 陇西县| 永新县| 肃南| 平阴县| 东乌| 许昌市| 射洪县| 肃宁县| 鱼台县| 昭平县| 金坛市| 神农架林区| 景洪市| 乌拉特后旗| 铅山县| 资源县| 佛冈县| 光山县| 分宜县| 永安市| 武汉市| 雷波县| 恩施市| 武宣县| 登封市| 罗田县| 黎平县| 涟水县| 三河市| 灵武市| 年辖:市辖区| 时尚| 永城市| 尉犁县| 林甸县| 洪洞县| 潞城市|