
上QQ阅读APP看书,第一时间看更新
MNIST
MNIST is a dataset for handwritten digits with the numbers 0-9 with 60,000 images of size 28 x 28 as the training set and 10,000 images of size 28 x 28 as the test set. This has become the go to dataset for starting machine learning or deep learning. It is provided in most of the frameworks and there is no need to download it separately. In Keras, this can be used as follows:
from __future__ import print_function
from keras.datasets import mnist
import matplotlib.pyplot as plt
# Download and load dataset
(x_train, y_train), (x_test, y_test) = mnist.load_data()
# to know the size of data
print("Train data shape:", x_train.shape, "Test data shape:", x_test.shape)
# plot sample image
idx = 0
print("Label:",y_train[idx])
plt.imshow(x_train[idx], cmap='gray')
plt.axis('off')
plt.show()
Some of the sample images from this dataset are as shown in the following figure:
