Class Mnist
- java.lang.Object
-
- ai.djl.training.dataset.RandomAccessDataset
-
- ai.djl.training.dataset.ArrayDataset
-
- ai.djl.basicdataset.cv.classification.Mnist
-
- All Implemented Interfaces:
ai.djl.training.dataset.Dataset
public final class Mnist extends ai.djl.training.dataset.ArrayDataset
MNIST handwritten digits dataset from http://yann.lecun.com/exdb/mnist.Each sample is a grayscale image (in 3-D NDArray) with shape (28, 28, 1).
It is a common starting dataset because it is small and can train within minutes. However, it is an overly easy task that even poor models can still perform very well on. Instead, consider
FashionMnist
which offers a comparable speed but a more reasonable difficulty task.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Mnist.Builder
A builder for aMnist
.
-
Field Summary
Fields Modifier and Type Field Description static int
IMAGE_HEIGHT
static int
IMAGE_WIDTH
static int
NUM_CLASSES
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Mnist.Builder
builder()
Creates a builder to build aMnist
.void
prepare(ai.djl.util.Progress progress)
-
Methods inherited from class ai.djl.training.dataset.ArrayDataset
availableSize, get, getByIndices, getByRange, getData, newSubDataset, newSubDataset
-
Methods inherited from class ai.djl.training.dataset.RandomAccessDataset
getData, getData, getData, randomSplit, size, subDataset, subDataset, subDataset, subDataset, toArray
-
-
-
-
Field Detail
-
IMAGE_WIDTH
public static final int IMAGE_WIDTH
- See Also:
- Constant Field Values
-
IMAGE_HEIGHT
public static final int IMAGE_HEIGHT
- See Also:
- Constant Field Values
-
NUM_CLASSES
public static final int NUM_CLASSES
- See Also:
- Constant Field Values
-
-
Method Detail
-
builder
public static Mnist.Builder builder()
Creates a builder to build aMnist
.- Returns:
- a new builder
-
prepare
public void prepare(ai.djl.util.Progress progress) throws java.io.IOException
- Specified by:
prepare
in interfaceai.djl.training.dataset.Dataset
- Overrides:
prepare
in classai.djl.training.dataset.ArrayDataset
- Throws:
java.io.IOException
-
-