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 createDataset
s forApplication.CV.IMAGE_CLASSIFICATION
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ai.djl.basicdataset.cv.ImageDataset
ImageDataset.BaseBuilder<T extends ImageDataset.BaseBuilder<T>>
-
-
Field Summary
-
Fields inherited from class ai.djl.basicdataset.cv.ImageDataset
flag
-
-
Constructor Summary
Constructors Constructor Description ImageClassificationDataset(ImageDataset.BaseBuilder<?> builder)
Creates a new instance ofRandomAccessDataset
with the given necessary configurations.
-
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.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
-
-
-
-
Constructor Detail
-
ImageClassificationDataset
public ImageClassificationDataset(ImageDataset.BaseBuilder<?> builder)
Creates a new instance ofRandomAccessDataset
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 classai.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
-
-