MNIST Database of Handwritten Digits for MATLAB
This repository provides a simple conversion function of the original MNIST dataset into MATLAB .mat
format for easy usage. Be sure to also pull the submodules containing the original MNIST dataset.
In order to convert the data, execute
convertMNIST
once in this directory, which will create mnist.mat
. After that, you can use
load('mnist.mat')
which will load two variables into your workspace:
training
, which contains the training set andtest
, which contains the test set.Both variables are represented as structures of the following fields:
count
: The number N
of imageswidth
: The width W
of each imageheight
: The height H
of each imageimages
: A H
by W
by N
array of all imageslabels
: An array of N
values describing the image labelThe images
are encoded as doubles with a range of 0
..1
, where 0
is background and 1
is foreground. The original MNIST dataset interprets these as 0
for white and 1
for black.
The labels
field is encoded as categorical double values in the range of 0
through 9
inclusive.