Python API

The MNIST Database is a database of handwritten digits, which 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. You can download the MNIST database from: https://web-beta.archive.org/web/20161231041016/http://yann.lecun.com/exdb/mnist/

bob.db.mnist.get_config()[source]

Returns a string containing the configuration information.

class bob.db.mnist.Database(data_dir=None)[source]

Wrapper class for the MNIST database of handwritten digits (https://web-beta.archive.org/web/20161231041016/http://yann.lecun.com/exdb/mnist/).

data(groups=None, labels=None)[source]

Loads the MNIST samples and labels and returns them in NumPy arrays

Keyword Parameters:

groups
One of the groups ‘train’ or ‘test’ or a list with both of them (which is the default).
labels
A subset of the labels (digits 0 to 9) (everything is the default).
Returns: A tuple composed of images and labels as 2D numpy arrays considering
all the filtering criteria and organized as follows:
images
A 2D numpy.ndarray with as many rows as examples in the dataset, as many columns as pixels (actually, there are 28x28 = 784 rows). The pixels of each image are unrolled in C-scan order (i.e., first row 0, then row 1, etc.).
labels
A 1D numpy.ndarray with as many elements as examples in the dataset.
groups()[source]

Returns the vector of groups

labels()[source]

Returns the vector of labels