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

Mixup or CutMix augmentations #340

Open
ogencoglu opened this issue Sep 5, 2019 · 12 comments
Open

Mixup or CutMix augmentations #340

ogencoglu opened this issue Sep 5, 2019 · 12 comments

Comments

@ogencoglu
Copy link

Any plan on adding Mixup or CutMix augmentations?

@bmabey
Copy link
Contributor

bmabey commented Nov 12, 2019

I am looking into contributing both Mixup and CutMix augmentations. Both of these augmentations take multiple images in order to do the augmentation. As far as I can tell all of the existing augmentations in the library only operates on a single image and the entire API is build around a single image being fetched in the datalaoder. Is that correct? To implement these new augmentations we would be operating on the batch level. Do you have any thoughts on how this should be implemented API wise within the library?

@ogencoglu
Copy link
Author

Now when I checked the API, you are right. For CutMix, if the mixed image is fixed it can be treated as an input variable (numpy array etc.) but Mixup is more tricky obviously.

@JeffreyWardman
Copy link

@bmabey Randomly sampling within the dataloader for multiple images. Would be nice to augment labels as well. These can then be fed in with

AUGMENTATION = MIXUP(p=0.6)  # Second image is 1-p, although ideally this scales for n mixups
aug = albumentations.AUGMENTATION(images=[image1, image2, ...], labels=[[0, 0, 1], [0, 1, 0]]) 
print(aug['labels'])
-->
[0, 0.4, 0.6]

@mathmanu
Copy link

Please see the repository https://github.com/naver-ai/relabel_imagenet
It shows impressive accuracy improvements with CutMix

CutMix implementation: https://github.com/naver-ai/relabel_imagenet/blob/main/utils/data_augment.py#L54
It does mixing within the batch.

This may be a simpler alternative to using multiple images. Looking forward to see this in albumentations

@dimimal
Copy link

dimimal commented Mar 1, 2022

Is anyone working on this? I would be happy to take it and do a PR

@vedal
Copy link

vedal commented Mar 4, 2022

The following paper also shows good improvements with MixUp/CutMix
https://arxiv.org/abs/2111.05328

@chAwater
Copy link

Ref PR #1147

@mikel-brostrom
Copy link

MixUp PR here: #1409

@nopps07
Copy link

nopps07 commented Apr 25, 2023

Any follow up on this?

@rusmux
Copy link

rusmux commented Aug 16, 2023

Any updates on this? This issue is almost 3 years old

@Aryan-Garg
Copy link

Yeah, better to use keras-cv at this point instead of albumentations (for these augmentations)

@ternaus
Copy link
Collaborator

ternaus commented Mar 5, 2024

MixUp added in #1549

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

No branches or pull requests