Package ai.djl.training.dataset
Interface Dataset
- All Known Subinterfaces:
RawDataset<T>
- All Known Implementing Classes:
ArrayDataset,RandomAccessDataset
public interface Dataset
An interface to represent a set of sample data/label pairs to train a model.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumAn enum that indicates the mode - training, test or validation. -
Method Summary
Modifier and TypeMethodDescriptionFetches an iterator that can iterate through theDataset.getData(NDManager manager, ExecutorService executorService) Fetches an iterator that can iterate through theDatasetwith multiple threads.default TranslatorOptionsReturnsTranslatorOptionsthat match the pre-processing and post-processing of this dataset.default voidprepare()Prepares the dataset for use.voidprepare(ai.djl.util.Progress progress) Prepares the dataset for use with tracked progress.
-
Method Details
-
getData
Fetches an iterator that can iterate through theDataset.- Parameters:
manager- the dataset to iterate through- Returns:
- an
IterableofBatchthat contains batches of data from the dataset - Throws:
IOException- for various exceptions depending on the datasetTranslateException- if there is an error while processing input
-
getData
default Iterable<Batch> getData(NDManager manager, ExecutorService executorService) throws IOException, TranslateException Fetches an iterator that can iterate through theDatasetwith multiple threads.- Parameters:
manager- the dataset to iterate throughexecutorService- the executorService to use for multi-threading- Returns:
- an
IterableofBatchthat contains batches of data from the dataset - Throws:
IOException- for various exceptions depending on the datasetTranslateException- if there is an error while processing input
-
prepare
Prepares the dataset for use.- Throws:
IOException- for various exceptions depending on the datasetTranslateException- if there is an error while processing input
-
prepare
Prepares the dataset for use with tracked progress.- Parameters:
progress- the progress tracker- Throws:
IOException- for various exceptions depending on the datasetTranslateException- if there is an error while processing input
-
matchingTranslatorOptions
ReturnsTranslatorOptionsthat match the pre-processing and post-processing of this dataset.- Returns:
- matching translators or null if none defined
-