Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce an interface for loading and preprocessing data #424

Merged
merged 4 commits into from
Aug 17, 2022

Conversation

juliabeliaeva
Copy link
Contributor

This PR introduces a DataLoader interface which represents the abstraction for loading data in a form of FloatArray with a TensorShape 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 uses Bitmap 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 are LazyDataset, LoadingDataset and LightweightDataset.

Since DataLoader uses TensorShape, 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.

@juliabeliaeva juliabeliaeva force-pushed the data-loader-interface branch from 78151d7 to 269c27e Compare August 16, 2022 21:04
@juliabeliaeva
Copy link
Contributor Author

juliabeliaeva commented Aug 16, 2022

I removed Preprocessing implementing DataLoader<File> from this branch so that not to interfere with the #425. We can add it back later if we want to when the work in #425 would be finished. Right now I use dataLoader() extension function to convert Preprocessing to a DataLoader which seems to be enough at the moment.
Also it may be a good idea to move loading of BufferedImage from file out of Preprocessing.

@juliabeliaeva juliabeliaeva merged commit 3b0dd3e into Kotlin:master Aug 17, 2022
@juliabeliaeva juliabeliaeva deleted the data-loader-interface branch August 17, 2022 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants