MNIST Data File

Understand the data files of MNIST handwritten digits database.

Sample of MNIST test data

Let’s take a peek at these files. The following image shows a section of the MNIST test set loaded into a text editor.

Press + to interact
MNIST test set in text editor
MNIST test set in text editor

Format of data file

The text editor is showing long lines of text, consisting of comma-separated numbers. The lines are quite long, so they wrap around a few times. This text editor helpfully shows the real line numbers in the margin, so we can see four whole lines of data and part of the fifth one.

The content of these records or lines of text are easy to understand:

  • The first value is the label, that is, the actual digit that the handwriting is supposed to represent, such as a 77 or a 99 ...