public abstract class AbstractImageFolder extends ImageClassificationDataset
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractImageFolder.ImageFolderBuilder<T extends AbstractImageFolder.ImageFolderBuilder<T>>
Used to build an
AbstractImageFolder. |
ImageDataset.BaseBuilder<T extends ImageDataset.BaseBuilder<T>>| Modifier and Type | Field and Description |
|---|---|
protected ai.djl.util.PairList<java.lang.String,java.lang.Integer> |
items |
protected ai.djl.repository.MRL |
mrl |
protected boolean |
prepared |
protected java.util.List<java.lang.String> |
synset |
flag| Modifier | Constructor and Description |
|---|---|
protected |
AbstractImageFolder(AbstractImageFolder.ImageFolderBuilder<?> builder) |
| Modifier and Type | Method and Description |
|---|---|
protected long |
availableSize() |
java.util.List<java.lang.String> |
getClasses()
Returns the classes that the images in the dataset are classified into.
|
protected long |
getClassNumber(long index)
Returns the class of the data item at the given index.
|
protected ai.djl.modality.cv.Image |
getImage(long index)
Returns the image at the given index in the dataset.
|
java.util.Optional<java.lang.Integer> |
getImageHeight()
Returns the height of the images in the dataset.
|
protected abstract java.nio.file.Path |
getImagePath(java.lang.String key) |
java.util.Optional<java.lang.Integer> |
getImageWidth()
Returns the width of the images in the dataset.
|
java.util.List<java.lang.String> |
getSynset()
Returns the synsets of the ImageFolder dataset.
|
protected void |
listImages(java.nio.file.Path root,
java.util.List<java.lang.String> classes) |
get, makeTranslatorgetImageChannels, getRecordImagegetData, getData, getData, getData, randomSplit, size, subDataset, toArrayprotected java.util.List<java.lang.String> synset
protected ai.djl.util.PairList<java.lang.String,java.lang.Integer> items
protected ai.djl.repository.MRL mrl
protected boolean prepared
protected AbstractImageFolder(AbstractImageFolder.ImageFolderBuilder<?> builder)
protected ai.djl.modality.cv.Image getImage(long index)
throws java.io.IOException
getImage in class ImageDatasetindex - the index (if the dataset is a list of data items)java.io.IOException - if the image could not be loadedprotected long getClassNumber(long index)
getClassNumber in class ImageClassificationDatasetindex - the index (if the dataset is a list of data items)protected long availableSize()
availableSize in class ai.djl.training.dataset.RandomAccessDatasetpublic java.util.List<java.lang.String> getSynset()
throws java.io.IOException,
ai.djl.translate.TranslateException
java.io.IOException - for various exceptions depending on the datasetai.djl.translate.TranslateException - if there is an error while processing inputprotected void listImages(java.nio.file.Path root,
java.util.List<java.lang.String> classes)
protected abstract java.nio.file.Path getImagePath(java.lang.String key)
public java.util.Optional<java.lang.Integer> getImageWidth()
getImageWidth in class ImageDatasetpublic java.util.Optional<java.lang.Integer> getImageHeight()
getImageHeight in class ImageDatasetpublic java.util.List<java.lang.String> getClasses()
getClasses in class ImageClassificationDataset