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:
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)
Wrapper class for the MNIST database of handwritten digits (http://yann.lecun.com/exdb/mnist/).
Creates the database. The data_dir argument should be the path to the directory
containing the four binary files available from http://yann.lecun.com/exdb/mnist/
-
data(groups=None, labels=None)
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()
Returns the vector of groups
-
labels()
Returns the vector of labels