public abstract class ImageClassificationDataset
extends ai.djl.training.dataset.RandomAccessDataset
Datasets for Application.CV.IMAGE_CLASSIFICATION.| Modifier and Type | Class and Description |
|---|---|
static class |
ImageClassificationDataset.BaseBuilder<T extends ImageClassificationDataset.BaseBuilder<T>>
Used to build an
ImageClassificationDataset. |
| Constructor and Description |
|---|
ImageClassificationDataset(ImageClassificationDataset.BaseBuilder<?> builder)
Creates a new instance of
RandomAccessDataset with the given necessary
configurations. |
| Modifier and Type | Method and 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.
|
protected abstract ai.djl.modality.cv.Image |
getImage(long index)
Returns the image at the given index in the dataset.
|
int |
getImageChannels()
Returns the number of channels in the images in the dataset.
|
abstract java.util.Optional<java.lang.Integer> |
getImageHeight()
Returns the height of the images in the dataset.
|
abstract java.util.Optional<java.lang.Integer> |
getImageWidth()
Returns the width of the images in the dataset.
|
ai.djl.translate.Translator<ai.djl.modality.cv.Image,ai.djl.modality.Classifications> |
makeTranslator()
Returns the
ImageClassificationTranslator matching the format of this dataset. |
availableSize, getData, getData, randomSplit, size, subDataset, toArraypublic ImageClassificationDataset(ImageClassificationDataset.BaseBuilder<?> builder)
RandomAccessDataset with the given necessary
configurations.builder - a builder with the necessary configurationsprotected abstract ai.djl.modality.cv.Image getImage(long index)
throws java.io.IOException
index - the index (if the dataset is a list of data items)java.io.IOException - if the image could not be loadedprotected abstract long getClassNumber(long index)
throws java.io.IOException
index - the index (if the dataset is a list of data items)java.io.IOException - if the data could not be loadedpublic ai.djl.training.dataset.Record get(ai.djl.ndarray.NDManager manager,
long index)
throws java.io.IOException
get in class ai.djl.training.dataset.RandomAccessDatasetjava.io.IOExceptionpublic ai.djl.translate.Translator<ai.djl.modality.cv.Image,ai.djl.modality.Classifications> makeTranslator()
ImageClassificationTranslator matching the format of this dataset.ImageClassificationTranslator matching the format of this datasetpublic int getImageChannels()
For example, RGB would be 3 channels while grayscale only uses 1 channel.
public abstract java.util.Optional<java.lang.Integer> getImageWidth()
public abstract java.util.Optional<java.lang.Integer> getImageHeight()
public abstract java.util.List<java.lang.String> getClasses()