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.

class bob.db.mnist.Database

Bases: object

Wrapper class for the MNIST database of handwritten digits.

The original database files are distributed over: http://yann.lecun.com/exdb/mnist/.

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

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

Parameters
  • groups (str or list) – One of the groups train or test, or a list with both of them (which is the default)

  • labels (int or list) – A subset of the labels (digits 0 to 9) (everything is the default)

Returns

A 2D array representing the digit images, 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.)

numpy.ndarray: A 1D array with as many elements as examples in the dataset, containing the labels for each image returned above.

Return type

numpy.ndarray

groups()[source]

Returns the vector of groups

labels()[source]

Returns the vector of labels

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

Returns a string containing the configuration information.