Introduction
IDX is a simple binary format for vectors and multidimensional arrays of numbers. It is
best known from the MNIST data set of handwritten digits, whose image and label files
use it and are distributed compressed with gzip. Unpacked copies are often named with
the number of dimensions in the extension, such as
train-images.idx3-ubyte for the images and
train-labels.idx1-ubyte for the labels. Some copies join the same ending
to the name with a hyphen instead.
Structure
A file starts with a magic number of four bytes. The first two are zero, the third
gives the type of the values (0x08 unsigned byte, 0x09 signed
byte, 0x0B short, 0x0C integer, 0x0D float,
0x0E double) and the fourth gives the number of dimensions. The size of
each dimension follows as a four-byte big-endian integer, and then the values, with the
last index changing fastest.
Not described
This page is a first outline. The format is not yet described in full here.
Known, not yet covered
- Reference: a worked example of each value type and the layout of the MNIST files.
- Viewer: the site has no viewer for this format.
Links
Developers
- idx-rs – reads IDX files (Rust)
- mnist-idx – reads and writes IDX data (Haskell)
- sunsided/mnist – MNIST files in this format
Reference
- Praat manual: IDX file format – description of the header and data
- Reading the MNIST data – the file names and header explained