chainer.datasets.get_mnist¶
-
chainer.datasets.
get_mnist
(withlabel=True, ndim=1, scale=1.0, dtype=<type 'numpy.float32'>, label_dtype=<type 'numpy.int32'>)[source]¶ Gets the MNIST dataset.
MNIST is a set of hand-written digits represented by grey-scale 28x28 images. In the original images, each pixel is represented by one-byte unsigned integer. This function scales the pixels to floating point values in the interval
[0, scale]
.This function returns the training set and the test set of the official MNIST dataset. If
withlabel
isTrue
, each dataset consists of tuples of images and labels, otherwise it only consists of images.Parameters: - withlabel (bool) – If
True
, it returns datasets with labels. In this case, each example is a tuple of an image and a label. Otherwise, the datasets only contain images. - ndim (int) –
Number of dimensions of each image. The shape of each image is determined depending on
ndim
as follows:ndim == 1
: the shape is(784,)
ndim == 2
: the shape is(28, 28)
ndim == 3
: the shape is(1, 28, 28)
- scale (float) – Pixel value scale. If it is 1 (default), pixels are
scaled to the interval
[0, 1]
. - dtype – Data type of resulting image arrays.
- label_dtype – Data type of the labels.
Returns: A tuple of two datasets. If
withlabel
isTrue
, both datasets areTupleDataset
instances. Otherwise, both datasets are arrays of images.- withlabel (bool) – If