Class ImageClassificationDataset

  • All Implemented Interfaces:
    ai.djl.training.dataset.Dataset
    Direct Known Subclasses:
    AbstractImageFolder

    public abstract class ImageClassificationDataset
    extends ImageDataset
    A helper to create Datasets for Application.CV.IMAGE_CLASSIFICATION.
    • Field Summary

      • Fields inherited from class ai.djl.training.dataset.RandomAccessDataset

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

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      ai.djl.training.dataset.Record get​(ai.djl.ndarray.NDManager manager, long index)
      abstract java.util.List<java.lang.String> getClasses()
      Returns the classes that the images in the dataset are classified into.
      protected abstract long getClassNumber​(long index)
      Returns the class of the data item at the given index.
      ai.djl.translate.TranslatorOptions matchingTranslatorOptions()
      • Methods inherited from class ai.djl.training.dataset.RandomAccessDataset

        availableSize, getData, getData, getData, getData, newSubDataset, newSubDataset, 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

        prepare, prepare
    • Constructor Detail

      • ImageClassificationDataset

        public ImageClassificationDataset​(ImageDataset.BaseBuilder<?> builder)
        Creates a new instance of RandomAccessDataset with the given necessary configurations.
        Parameters:
        builder - a builder with the necessary configurations
    • Method Detail

      • getClassNumber

        protected abstract long getClassNumber​(long index)
                                        throws java.io.IOException
        Returns the class of the data item at the given index.
        Parameters:
        index - the index (if the dataset is a list of data items)
        Returns:
        the class number or the index into the list of classes of the desired class name
        Throws:
        java.io.IOException - if the data could not be loaded
      • get

        public ai.djl.training.dataset.Record get​(ai.djl.ndarray.NDManager manager,
                                                  long index)
                                           throws java.io.IOException
        Specified by:
        get in class ai.djl.training.dataset.RandomAccessDataset
        Throws:
        java.io.IOException
      • matchingTranslatorOptions

        public ai.djl.translate.TranslatorOptions matchingTranslatorOptions()
      • getClasses

        public abstract java.util.List<java.lang.String> getClasses()
        Returns the classes that the images in the dataset are classified into.
        Returns:
        the classes that the images in the dataset are classified into