public abstract class ImageDataset
extends ai.djl.training.dataset.RandomAccessDataset
Dataset where the data contains a single
image.| Modifier and Type | Class and Description |
|---|---|
static class |
ImageDataset.BaseBuilder<T extends ImageDataset.BaseBuilder<T>>
Used to build an
ImageClassificationDataset. |
| Modifier and Type | Field and Description |
|---|---|
protected ai.djl.modality.cv.Image.Flag |
flag |
| Constructor and Description |
|---|
ImageDataset(ImageDataset.BaseBuilder<?> builder)
Creates a new instance of
RandomAccessDataset with the given necessary
configurations. |
| Modifier and Type | Method and Description |
|---|---|
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.
|
protected ai.djl.ndarray.NDArray |
getRecordImage(ai.djl.ndarray.NDManager manager,
long index) |
availableSize, get, getData, getData, getData, getData, randomSplit, size, subDataset, toArraypublic ImageDataset(ImageDataset.BaseBuilder<?> builder)
RandomAccessDataset with the given necessary
configurations.builder - a builder with the necessary configurationsprotected ai.djl.ndarray.NDArray getRecordImage(ai.djl.ndarray.NDManager manager,
long index)
throws java.io.IOException
java.io.IOExceptionprotected 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 loadedpublic 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()