Introduce an interface for loading and preprocessing data #424
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a
DataLoader
interface which represents the abstraction for loading data in a form ofFloatArray
with aTensorShape
from some source, e.g. a file. Currently this is done in one step: loading and preprocessing together and there is no access to the intermediate data (e.g.BufferedImage
). So far this seems OK to me, but we may want to change it in the future. Currently the interface is mainly used in the datasets, but I intend to use it for onnx models to make them more platform-independent (we should have another implementation which usesBitmap
as a data source for android).After these changes
OnFlyImageDataset
needs a new name since it can work with any data now, not just images, and also "on fly" is not grammatically correct (should be "on the fly", and it also seems more like an adverb, not an adjective). My current candidates areLazyDataset
,LoadingDataset
andLightweightDataset
.Since
DataLoader
usesTensorShape
, the latter had to be moved to the "dataset" module and it does not look too good. Perhaps, "api" module should not depend on the "dataset" and it should be the other way around.