Class 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 a Mnist.
      • Nested classes/interfaces inherited from class ai.djl.training.dataset.RandomAccessDataset

        ai.djl.training.dataset.RandomAccessDataset.BaseBuilder<T extends ai.djl.training.dataset.RandomAccessDataset.BaseBuilder<T>>
      • Nested classes/interfaces inherited from interface ai.djl.training.dataset.Dataset

        ai.djl.training.dataset.Dataset.Usage
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int IMAGE_HEIGHT  
      static int IMAGE_WIDTH  
      static int NUM_CLASSES  
      • Fields inherited from class ai.djl.training.dataset.ArrayDataset

        data, labels
      • Fields inherited from class ai.djl.training.dataset.RandomAccessDataset

        dataBatchifier, device, labelBatchifier, limit, pipeline, prefetchNumber, sampler, targetPipeline
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Mnist.Builder builder()
      Creates a builder to build a Mnist.
      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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface ai.djl.training.dataset.Dataset

        matchingTranslatorOptions, prepare
    • Method Detail

      • builder

        public static Mnist.Builder builder()
        Creates a builder to build a Mnist.
        Returns:
        a new builder
      • prepare

        public void prepare​(ai.djl.util.Progress progress)
                     throws java.io.IOException
        Specified by:
        prepare in interface ai.djl.training.dataset.Dataset
        Overrides:
        prepare in class ai.djl.training.dataset.ArrayDataset
        Throws:
        java.io.IOException