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

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')
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.

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

( mnist.pkl.gz )

import cPickle, gzip, numpy

f = gzip.open('mnist.pkl.gz', 'rb')
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.