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

Data augmentation proposal #15

Open
rickwierenga opened this issue Jan 26, 2020 · 0 comments
Open

Data augmentation proposal #15

rickwierenga opened this issue Jan 26, 2020 · 0 comments
Labels
proposal Proposal for a new feature

Comments

@rickwierenga
Copy link
Contributor

It would be great if DataLoaders could facilitate data augmentation on batches. I would like to make a proposal for a possible implementation of this.

Start by defining what an augmentation is:

typealias Augmentation = (SomeBatch) -> SomeBatch

Then create a modifier as proposed in #14:

func augmenting(_ augmentation: @escaping Augmentation) -> Self {
    var mutableSelf = self.copy()
    mutableSelf.augmentation = augmentation
    return mutableSelf
}

Make this a requirement on all S5TFDataLoaders:

var augmentation: Augmentation? { get }

Apply the augmentation when loading data (in getElement(at:)):

listOfData.map(augmentation)

Result:

MNIST.train.augmenting(flipRight).augmenting(blur(0.2)).batched(32)

We should offer a list of predefined augmentations using SwiftCV.

Simplified example: https://colab.research.google.com/drive/1YCyx59FXcDXDrtGBHcRFKmbakSNScAJk.

@rickwierenga rickwierenga added the proposal Proposal for a new feature label Jan 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Proposal for a new feature
Projects
None yet
Development

No branches or pull requests

1 participant