Yann LeCun (Courant Institute, NYU) and Corinna Cortes (Google Labs, New York) hold the copyright of MNIST dataset, which is a derivative work from the original NIST datasets.
Yann LeCun(纽约大学 Courant 研究所)和 Corinna Cortes(谷歌实验室,纽约)拥有 MNIST 数据集的版权,该数据集是原始 NIST 数据集的衍生作品。
The MNIST database of handwritten digits has a training set of 60,000 examples, and a test set of 10,000 examples. It is a subset of a larger set available from NIST. The digits have been size-normalized and centered in a fixed-size image.
It is a good database for people who want to try learning techniques and pattern recognition methods on real-world data while spending minimal efforts on preprocessing and formatting.
MNIST 手写数字数据库包含 60,000 个训练样本和 10,000 个测试样本。它是来自 NIST 的一个更大数据集的子集。这些数字已经进行了大小归一化,并在固定大小的图像中居中。对于希望在真实数据上尝试学习技术和模式识别方法的人来说,这是一个很好的数据库,同时在预处理和格式化上花费的精力最小。
Four files are available on this site:
train-images-idx3-ubyte.gz
: training set images (9912422 bytes)
train-images-idx3-ubyte.gz
: 训练集图像 (9912422 字节)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)
The original black and white (bilevel) images from NIST were size normalized to fit in a 20x20 pixel box while preserving their aspect ratio. The resulting images contain grey levels as a result of the anti-aliasing technique used by the normalization algorithm. the images were centered in a 28x28 image by computing the center of mass of the pixels, and translating the image so as to position this point at the center of the 28x28 field.
来自 NIST 的原始黑白(双层)图像经过大小标准化,以适应 20x20 像素的框,同时保持其纵横比。结果图像由于标准化算法使用的抗锯齿技术而包含灰度级。通过计算像素的质心,将图像居中于 28x28 图像,并将图像平移,以使该点位于 28x28 区域的中心。
With some classification methods (particuarly template-based methods, such as SVM and K-nearest neighbors), the error rate improves when the digits are centered by bounding box rather than center of mass. If you do this kind of pre-processing, you should report it in your publications.
对于某些分类方法(特别是基于模板的方法,如支持向量机和 K 近邻),当数字通过边界框而不是质心进行居中时,错误率会有所改善。如果您进行这种预处理,您应该在您的出版物中报告。
The MNIST database was constructed from NIST's Special Database 3 and Special Database 1 which contain binary images of handwritten digits. NIST originally designated SD-3 as their training set and SD-1 as their test set. However, SD-3 is much cleaner and easier to recognize than SD-1. The reason for this can be found on the fact that SD-3 was collected among Census Bureau employees, while SD-1 was collected among high-school students. Drawing sensible conclusions from learning experiments requires that the result be independent of the choice of training set and test among the complete set of samples. Therefore it was necessary to build a new database by mixing NIST's datasets.
MNIST 数据库是由 NIST 的特殊数据库 3 和特殊数据库 1 构建的,这些数据库包含手写数字的二进制图像。NIST 最初将 SD-3 指定为他们的训练集,将 SD-1 指定为他们的测试集。然而,SD-3 比 SD-1 干净得多,且更容易识别。造成这种情况的原因在于,SD-3 是从人口普查局的员工中收集的,而 SD-1 是从高中学生中收集的。从学习实验中得出合理的结论要求结果独立于训练集和测试集的选择,因此有必要通过混合 NIST 的数据集来构建一个新的数据库。
The MNIST training set is composed of 30,000 patterns from SD-3 and 30,000 patterns from SD-1. Our test set was composed of 5,000 patterns from SD-3 and 5,000 patterns from SD-1. The 60,000 pattern training set contained examples from approximately 250 writers. We made sure that the sets of writers of the training set and test set were disjoint.
MNIST 训练集由来自 SD-3 的 30,000 个样本和来自 SD-1 的 30,000 个样本组成。我们的测试集由来自 SD-3 的 5,000 个样本和来自 SD-1 的 5,000 个样本组成。60,000 个样本的训练集包含大约 250 位作者的示例。我们确保训练集和测试集的作者集合是互不重叠的。
SD-1 contains 58,527 digit images written by 500 different writers. In contrast to SD-3, where blocks of data from each writer appeared in sequence, the data in SD-1 is scrambled. Writer identities for SD-1 is available and we used this information to unscramble the writers. We then split SD-1 in two: characters written by the first 250 writers went into our new training set. The remaining 250 writers were placed in our test set. Thus we had two sets with nearly 30,000 examples each. The new training set was completed with enough examples from SD-3, starting at pattern # 0, to make a full set of 60,000 training patterns. Similarly, the new test set was completed with SD-3 examples starting at pattern # 35,000 to make a full set with 60,000 test patterns. Only a subset of 10,000 test images (5,000 from SD-1 and 5,000 from SD-3) is available on this site. The full 60,000 sample training set is available.
SD-1 包含由 500 位不同作者书写的 58,527 个数字图像。与 SD-3 中每位作者的数据块按顺序出现不同,SD-1 中的数据是混合的。SD-1 的作者身份信息是可用的,我们利用这些信息对作者进行了还原。然后我们将 SD-1 分为两部分:前 250 位作者书写的字符进入我们的新训练集。剩下的 250 位作者被放入我们的测试集。因此,我们有两个集合,每个集合几乎有 30,000 个样本。新的训练集通过从 SD-3 中补充足够的样本(从模式#0 开始)来完成,以形成一个完整的 60,000 个训练模式的集合。同样,新的测试集通过从 SD-3 中补充样本(从模式#35,000 开始)来完成,以形成一个完整的 60,000 个测试模式的集合。该网站仅提供 10,000 个测试图像的子集(5,000 个来自 SD-1,5,000 个来自 SD-3)。完整的 60,000 个样本训练集是可用的。
The data is stored in a very simple file format designed for storing vectors and multidimensional matrices. General info on this format is given at the end of this page, but you don't need to read that to use the data files.
All the integers in the files are stored in the MSB first (high endian) format used by most non-Intel processors. Users of Intel processors and other low-endian machines must flip the bytes of the header.
数据以一种非常简单的文件格式存储,该格式旨在存储向量和多维矩阵。关于此格式的一般信息在本页末尾给出,但您不需要阅读这些信息即可使用数据文件。文件中的所有整数均以大端(MSB 优先)格式存储,这是大多数非 Intel 处理器使用的格式。使用 Intel 处理器和其他小端机器的用户必须翻转头部的字节。
There are 4 files:
有 4 个文件:
train-images-idx3-ubyte
: training set images
train-images-idx3-ubyte
: 训练集图像train-labels-idx1-ubyte
: training set labels
train-labels-idx1-ubyte
: 训练集标签t10k-images-idx3-ubyte
: test set images
t10k-images-idx3-ubyte
: 测试集图像t10k-labels-idx1-ubyte
: test set labels
t10k-labels-idx1-ubyte
: 测试集标签
The training set contains 60000 examples, and the test set 10000 examples.
训练集包含 60000 个样本,测试集包含 10000 个样本。
The first 5000 examples of the test set are taken from the original NIST training set. The last 5000 are taken from the original NIST test set. The first 5000 are cleaner and easier than the last 5000.
测试集的前 5000 个示例来自原始的 NIST 训练集。最后 5000 个来自原始的 NIST 测试集。前 5000 个比最后 5000 个更干净、更容易。
[offset] [type] [value] [description]
0000 32 bit integer 0x00000801(2049) magic number (MSB first)
0004 32 bit integer 60000 number of items
0008 unsigned byte ?? label
0009 unsigned byte ?? label
........
xxxx unsigned byte ?? label
The labels values are 0 to 9.
[offset] [type] [value] [description]
0000 32 bit integer 0x00000803(2051) magic number
0004 32 bit integer 60000 number of images
0008 32 bit integer 28 number of rows
0012 32 bit integer 28 number of columns
0016 unsigned byte ?? pixel
0017 unsigned byte ?? pixel
........
xxxx unsigned byte ?? pixel
Pixels are organized row-wise. Pixel values are 0 to 255. 0 means background (white), 255 means foreground (black).
[offset] [type] [value] [description]
0000 32 bit integer 0x00000801(2049) magic number (MSB first)
0004 32 bit integer 10000 number of items
0008 unsigned byte ?? label
0009 unsigned byte ?? label
........
xxxx unsigned byte ?? label
The labels values are 0 to 9.
[offset] [type] [value] [description]
0000 32 bit integer 0x00000803(2051) magic number
0004 32 bit integer 10000 number of images
0008 32 bit integer 28 number of rows
0012 32 bit integer 28 number of columns
0016 unsigned byte ?? pixel
0017 unsigned byte ?? pixel
........
xxxx unsigned byte ?? pixel
Pixels are organized row-wise. Pixel values are 0 to 255. 0 means background (white), 255 means foreground (black).
the IDX file format is a simple format for vectors and multidimensional matrices of various numerical types.
The basic format is
IDX 文件格式是一种用于各种数值类型的向量和多维矩阵的简单格式。基本格式是
magic number
size in dimension 0
size in dimension 1
size in dimension 2
.....
size in dimension N
data
The magic number is an integer (MSB first). The first 2 bytes are always 0.
魔数是一个整数(高位在前)。前两个字节始终为 0。
The third byte codes the type of the data:
0x08
: unsigned byte
0x09
: signed byte
0x0B
: short (2 bytes)
0x0C
: int (4 bytes)
0x0D
: float (4 bytes)
0x0E
: double (8 bytes)
第三个字节编码数据类型: 0x08
: 无符号字节 0x09
: 有符号字节 0x0B
: 短整型(2 字节) 0x0C
: 整型(4 字节) 0x0D
: 浮点型(4 字节) 0x0E
: 双精度浮点型(8 字节)
The 4-th byte codes the number of dimensions of the vector/matrix: 1 for vectors, 2 for matrices....
第 4 个字节编码了向量/矩阵的维数:向量为 1,矩阵为 2……
The sizes in each dimension are 4-byte integers (MSB first, high endian, like in most non-Intel processors).
每个维度的大小是 4 字节整数(MSB 优先,高字节在前,类似于大多数非英特尔处理器)。
The data is stored like in a C array, i.e. the index in the last dimension changes the fastest.
数据的存储方式类似于 C 数组,即最后一个维度的索引变化最快。