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 enum
An 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 theDataset
with multiple threads.default TranslatorOptions
ReturnsTranslatorOptions
that match the pre-processing and post-processing of this dataset.default void
prepare()
Prepares the dataset for use.void
prepare
(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
Iterable
ofBatch
that 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 theDataset
with multiple threads.- Parameters:
manager
- the dataset to iterate throughexecutorService
- the executorService to use for multi-threading- Returns:
- an
Iterable
ofBatch
that 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
ReturnsTranslatorOptions
that match the pre-processing and post-processing of this dataset.- Returns:
- matching translators or null if none defined
-