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

[WIP] Starting point for batch-level data augmentation #254

Merged
merged 61 commits into from
Jun 25, 2021

Conversation

cedricrommel
Copy link
Collaborator

No description provided.

@cedricrommel cedricrommel marked this pull request as draft June 21, 2021 09:41
@robintibor
Copy link
Contributor

robintibor commented Jun 21, 2021

Hi, very interesting thanks, seems a lot of work, will need to have a closer look! This works fine with what was done in https://github.com/braindecode/braindecode/pull/198/files ? Note the discussion there as well

Copy link
Collaborator

@tomMoral tomMoral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A first batch of comments

braindecode/augmentation/base.py Outdated Show resolved Hide resolved
braindecode/augmentation/base.py Outdated Show resolved Hide resolved
braindecode/augmentation/base.py Outdated Show resolved Hide resolved
braindecode/augmentation/base.py Outdated Show resolved Hide resolved
braindecode/augmentation/base.py Outdated Show resolved Hide resolved
braindecode/augmentation/functionals.py Outdated Show resolved Hide resolved
braindecode/augmentation/transforms.py Outdated Show resolved Hide resolved
@cedricrommel
Copy link
Collaborator Author

Hey @robintibor, thanks a lot ! Glad it looks interesting. @sbbrandt will soon add his nice MixUp implementation as well and we are still working on polishing things a little with him and @tomMoral. Concerning @hubertjb's PR, yes we are aware. We've discussed that when the PR was opened and have a few ideas on how to ensure both are compatible (since both logics of batch-level and sample-level data augmentation have their own pros and cons). We will get to that as soon as we are done polishing :)

Copy link
Collaborator

@tomMoral tomMoral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few more comments on transform.

braindecode/augmentation/transforms.py Outdated Show resolved Hide resolved
braindecode/augmentation/transforms.py Outdated Show resolved Hide resolved
braindecode/augmentation/transforms.py Outdated Show resolved Hide resolved
braindecode/augmentation/transforms.py Outdated Show resolved Hide resolved
braindecode/augmentation/transforms.py Outdated Show resolved Hide resolved
braindecode/augmentation/transforms.py Outdated Show resolved Hide resolved
braindecode/augmentation/transforms.py Outdated Show resolved Hide resolved
braindecode/augmentation/transforms.py Outdated Show resolved Hide resolved
braindecode/augmentation/transforms.py Outdated Show resolved Hide resolved
braindecode/augmentation/transforms.py Outdated Show resolved Hide resolved
Co-authored-by: Thomas Moreau <thomas.moreau.2010@gmail.com>
Copy link
Collaborator

@tomMoral tomMoral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last few comments for the day. I will do a second review tomorrow.
But this looks good overall.

test/unit_tests/augmentation/test_base.py Outdated Show resolved Hide resolved
test/unit_tests/augmentation/test_transforms.py Outdated Show resolved Hide resolved
cedricrommel and others added 2 commits June 21, 2021 15:39
Co-authored-by: Thomas Moreau <thomas.moreau.2010@gmail.com>
Co-authored-by: Thomas Moreau <thomas.moreau.2010@gmail.com>
@robintibor
Copy link
Contributor

Definitely looks like this is growing to something nice! Make sure to also create some examples, an add to API docs etc. .

-added mixup functional
-adapted base to handle tuple as return from transform
-added mixup loss
-added mixup tests
braindecode/augmentation/base.py Outdated Show resolved Hide resolved
braindecode/augmentation/base.py Outdated Show resolved Hide resolved
braindecode/augmentation/base.py Outdated Show resolved Hide resolved
braindecode/augmentation/base.py Outdated Show resolved Hide resolved
@robintibor
Copy link
Contributor

I would still also argue to write transforms that only transform X on a per example basis using the existing https://github.com/braindecode/braindecode/pull/198/files solution. And keep the dataloader way for those transformations that need access to either X and y or to batch-level examples? Or what do you think? Otherwise it becomes confusing when to use which one? You could try to recreate your Transform Superclass as an "ExampleTransform" superclass it would make this transitition easier.

@robintibor
Copy link
Contributor

also @hubertjb let me know what you think

braindecode/augmentation/base.py Outdated Show resolved Hide resolved
braindecode/augmentation/base.py Outdated Show resolved Hide resolved
braindecode/augmentation/base.py Outdated Show resolved Hide resolved
braindecode/augmentation/base.py Outdated Show resolved Hide resolved
braindecode/augmentation/base.py Outdated Show resolved Hide resolved
braindecode/augmentation/transforms.py Outdated Show resolved Hide resolved
braindecode/augmentation/transforms.py Outdated Show resolved Hide resolved
braindecode/training/losses.py Outdated Show resolved Hide resolved
braindecode/training/losses.py Outdated Show resolved Hide resolved
braindecode/augmentation/_functionals.py Outdated Show resolved Hide resolved
@agramfort agramfort changed the title [WIP] Starting point for batch-level data augmentation [MRG] Starting point for batch-level data augmentation Jun 25, 2021
@agramfort
Copy link
Collaborator

agramfort commented Jun 25, 2021 via email

@robintibor robintibor changed the title [MRG] Starting point for batch-level data augmentation [WIP] Starting point for batch-level data augmentation Jun 25, 2021
@robintibor
Copy link
Contributor

yes then he can change to [MRG] when example is there so I see it as well.

examples/plot_data_augmentation.py Outdated Show resolved Hide resolved
examples/plot_data_augmentation.py Outdated Show resolved Hide resolved
examples/plot_data_augmentation.py Outdated Show resolved Hide resolved
examples/plot_data_augmentation.py Outdated Show resolved Hide resolved
@cedricrommel
Copy link
Collaborator Author

I've fixed things. Will push soon. Just making a final check at the html :)

@cedricrommel
Copy link
Collaborator Author

cedricrommel commented Jun 25, 2021

Ok Alles gut for me ! 😃 I just need confirmation from @sbbrandt that he is ok with my commit where I put his email address in the file to add him as contributor and then I'm ok for merging 💪
(fyi @robintibor @agramfort @tomMoral )

@agramfort
Copy link
Collaborator

@robintibor green button is yours !

@robintibor robintibor merged commit e5b3d73 into braindecode:master Jun 25, 2021
@robintibor
Copy link
Contributor

robintibor commented Jun 25, 2021

Great work, merged!
@sbbrandt mail is already in other parts of the repo, so should be fine.
Thanks so much for all the effort that went into this! Really great to have so much new functionality implemented in a clean way!

Here a celebratory gif:
album_1f9292s0f

@agramfort
Copy link
Collaborator

agramfort commented Jun 25, 2021 via email

@cedricrommel
Copy link
Collaborator Author

Niiiice ! 👏 👏 👏 👏
Thank you both for the really nice event, as well as @hubertjb 💪

@sbbrandt
Copy link
Collaborator

🎉🎉🎉

Thank you guys! Also for critics and correction of errors.

From me also thanks for the event and thank you @cedricrommel for the nice augmentation implementation :)

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.

5 participants