mnist library
Published: 2019-04-28

mnist library is the most commonly used library, but there are several different versions.


1 https://s3.amazonaws.com/img-datasets/mnist.npz

If you use example that comes with keras, you will download it from this address.But for some reason, the download could not come down.

http://blog.csdn.net/jsliuqun/article/details/64444302's blog also recorded that it could not be downloaded, using other methods.


path = get_file(path, origin='https://s3.amazonaws.com/img-datasets/mnist.npz')
f = np.load(path)
x_train, y_train = f['x_train'], f['y_train']
x_test, y_test = f['x_test'], f['y_test']
f.close()
return (x_train, y_train), (x_test, y_test)


2 http://yann.lecun.com/exdb/mnist/

train-images-idx3-ubyte.gz: training set images (9912422 bytes)train-labels-idx1-ubyte.gz: training set labels (28881 bytes)t10k-images-idx3-ubyte.gz:  test set images (1648877 bytes)t10k-labels-idx1-ubyte.gz:  test set labels (4542 bytes)

This is the authentic source, but it seems that everyone does not use this directly, but uses a format of 1 or 3.

http://m.blog.csdn.net/sysushui/article/details/53257185 this article records how to use these libraries.


3 http://www.deeplearning.net/tutorial/gettingstarted.html

( mnist.pkl.gz )

This is read by:

import cPickle, gzip, numpy

# Load the dataset
f = gzip.open('mnist.pkl.gz', 'rb')
train_set, valid_set, test_set = cPickle.load(f)
f.close()
可以看到,读出来的是三个数据集,而不同于上面的读出来是两个数据集

4 mnist.zip

Go online search, and this compressed package.This direct opening is the picture, and the content and label of each picture can be clearly seen.