Class ImageClassificationDataset

java.lang.Object
ai.djl.training.dataset.RandomAccessDataset
ai.djl.basicdataset.cv.ImageDataset
ai.djl.basicdataset.cv.classification.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.
  • Nested Class Summary

    Nested classes/interfaces inherited from class ai.djl.basicdataset.cv.ImageDataset

    ImageDataset.BaseBuilder<T extends ImageDataset.BaseBuilder<T>>

    Nested classes/interfaces inherited from interface ai.djl.training.dataset.Dataset

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

    Fields inherited from class ai.djl.basicdataset.cv.ImageDataset

    flag

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

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

    Constructors
    Constructor
    Description
    Creates a new instance of RandomAccessDataset with the given necessary configurations.
  • Method Summary

    Modifier and Type
    Method
    Description
    ai.djl.training.dataset.Record
    get(ai.djl.ndarray.NDManager manager, long index)
    abstract List<String>
    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

    Methods inherited from class ai.djl.basicdataset.cv.ImageDataset

    getImage, getImageChannels, getImageHeight, getImageWidth, getRecordImage

    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 Details

    • 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 Details

    • getClassNumber

      protected abstract long getClassNumber(long index) throws 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:
      IOException - if the data could not be loaded
    • get

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

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

      public abstract List<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