-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Support Mixup and Cutmix transformation #2872
Comments
Hi @JiYuanFeng , Thanks for your feedback. Thanks in advance. Thanks. |
for the mixup, I can find this paper as a reference https://openreview.net/pdf?id=rkBBChjiG. not sure if we have an example/renference for cutmix. |
@wyli For CutMix, you can refer to this paper. These two augmentations mix one image with another randomly selected one, which can be selected from the same batch or the whole dataset. Thus, the API of these two augmentations are slightly different from the other ones. |
Thanks, I think these are good augmentations to have. @Nic-Ma these could be in v0.8? |
Sounds good to me. Thanks. |
Hi @wyli , Currently, all the MONAI transforms work with a single image, so I think maybe this feature is not a transform, It should be a layer before the network to mix up a batch data? Thanks. |
My thoughts on mixup that I wanted to play with at some point was as a special sort of DataLoader that would combine images from a batch to make a smaller batch with some controls for how the mixing would be done. Alternatively if we wanted to do it as a transform we would have to first create a dataset of image pairs that are to be mixed (this wouldn't involve copying the original images though so should be lightweight), a normal transform sequence, and a final transform that does the mixing of the two images to produce one. This can get us around the issue of transform sequences being one-to-one for the most part, they operate on individual items in a batch rather than being able to operate on a whole batch. |
@Nic-Ma Just to add to discussion here, there is an existing implementation of this for medical images, perhaps for paper @wyli linked (https://openreview.net/pdf?id=rkBBChjiG), in NiftNet at: https://github.com/NifTK/NiftyNet/blob/935bf4334cd00fa9f9d50f6a95ddcbfdde4031e0/niftynet/application/segmentation_application.py#L325 |
Hi @masadcv , Thanks for your sharing. Thanks. |
Hi @Nic-Ma , It seems that Mixup and Cutmix are still unsupported. Is there any consideration to include this data transformation method? Thanks. |
Hi @JohnMasoner , Thanks for your interest here. |
Thanks for your reply, I readed @ericspod comments, i will contribute a PR about CutOut( Maybe like 'RandCoarseDropout', also similar to Mixup and Cutmix) |
Hi @JohnMasoner, thanks for looking into this. I'd definitely like to see some contributions along the lines of mixup/cutmix, something new you're working on would be great as well as reference implementations of what's been published already. I had suggested implementing it as a dataloader of some sort but it's possible to be instead a special collate function, or some other implementation entirely, so feel free to propose your own solution. |
Fixes #2872 ### Description Implementation of mixup, cutmix and cutout as described in the original papers. Current implementation support both, the dictionary-based batches and tuples of tensors. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [x] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [x] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Juan Pablo de la Cruz Gutiérrez <juampatronics@gmail.com> Signed-off-by: monai-bot <monai.miccai2019@gmail.com> Signed-off-by: elitap <elias.tappeiner@gmx.at> Signed-off-by: Felix Schnabel <f.schnabel@tum.de> Signed-off-by: YanxuanLiu <yanxuanl@nvidia.com> Signed-off-by: ytl0623 <david89062388@gmail.com> Signed-off-by: Dženan Zukić <dzenan.zukic@kitware.com> Signed-off-by: KumoLiu <yunl@nvidia.com> Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> Signed-off-by: Ishan Dutta <ishandutta0098@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: kaibo <ktang@unc.edu> Signed-off-by: heyufan1995 <heyufan1995@gmail.com> Signed-off-by: binliu <binliu@nvidia.com> Signed-off-by: axel.vlaminck <axel.vlaminck@gmail.com> Signed-off-by: Ibrahim Hadzic <ibrahimhadzic45@gmail.com> Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com> Signed-off-by: Timothy Baker <bakertim@umich.edu> Signed-off-by: Mathijs de Boer <m.deboer-41@umcutrecht.nl> Signed-off-by: Fabian Klopfer <fabian.klopfer@ieee.org> Signed-off-by: Lucas Robinet <robinet.lucas@iuct-oncopole.fr> Signed-off-by: Lucas Robinet <67736918+Lucas-rbnt@users.noreply.github.com> Signed-off-by: chaoliu <chaoliu@nvidia.com> Signed-off-by: cxlcl <chaoliucxl@gmail.com> Signed-off-by: chaoliu <chaoliucxl@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: monai-bot <64792179+monai-bot@users.noreply.github.com> Co-authored-by: elitap <elitap@users.noreply.github.com> Co-authored-by: Felix Schnabel <f.schnabel@tum.de> Co-authored-by: YanxuanLiu <104543031+YanxuanLiu@users.noreply.github.com> Co-authored-by: ytl0623 <david89062388@gmail.com> Co-authored-by: Dženan Zukić <dzenan.zukic@kitware.com> Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Co-authored-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> Co-authored-by: Ishan Dutta <ishandutta0098@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kaibo Tang <ktang@unc.edu> Co-authored-by: Yufan He <59374597+heyufan1995@users.noreply.github.com> Co-authored-by: binliunls <107988372+binliunls@users.noreply.github.com> Co-authored-by: Ben Murray <ben.murray@gmail.com> Co-authored-by: axel.vlaminck <axel.vlaminck@gmail.com> Co-authored-by: Mingxin Zheng <18563433+mingxin-zheng@users.noreply.github.com> Co-authored-by: Ibrahim Hadzic <ibrahimhadzic45@gmail.com> Co-authored-by: Dr. Behrooz Hashemian <3968947+drbeh@users.noreply.github.com> Co-authored-by: Timothy J. Baker <62781117+tim-the-baker@users.noreply.github.com> Co-authored-by: Mathijs de Boer <8137653+MathijsdeBoer@users.noreply.github.com> Co-authored-by: Mathijs de Boer <m.deboer-41@umcutrecht.nl> Co-authored-by: Fabian Klopfer <fabian.klopfer@ieee.org> Co-authored-by: Yiheng Wang <68361391+yiheng-wang-nv@users.noreply.github.com> Co-authored-by: Lucas Robinet <67736918+Lucas-rbnt@users.noreply.github.com> Co-authored-by: Lucas Robinet <robinet.lucas@iuct-oncopole.fr> Co-authored-by: cxlcl <chaoliucxl@gmail.com>
Fixes Project-MONAI#2872 ### Description Implementation of mixup, cutmix and cutout as described in the original papers. Current implementation support both, the dictionary-based batches and tuples of tensors. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [x] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [x] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Juan Pablo de la Cruz Gutiérrez <juampatronics@gmail.com> Signed-off-by: monai-bot <monai.miccai2019@gmail.com> Signed-off-by: elitap <elias.tappeiner@gmx.at> Signed-off-by: Felix Schnabel <f.schnabel@tum.de> Signed-off-by: YanxuanLiu <yanxuanl@nvidia.com> Signed-off-by: ytl0623 <david89062388@gmail.com> Signed-off-by: Dženan Zukić <dzenan.zukic@kitware.com> Signed-off-by: KumoLiu <yunl@nvidia.com> Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> Signed-off-by: Ishan Dutta <ishandutta0098@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: kaibo <ktang@unc.edu> Signed-off-by: heyufan1995 <heyufan1995@gmail.com> Signed-off-by: binliu <binliu@nvidia.com> Signed-off-by: axel.vlaminck <axel.vlaminck@gmail.com> Signed-off-by: Ibrahim Hadzic <ibrahimhadzic45@gmail.com> Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com> Signed-off-by: Timothy Baker <bakertim@umich.edu> Signed-off-by: Mathijs de Boer <m.deboer-41@umcutrecht.nl> Signed-off-by: Fabian Klopfer <fabian.klopfer@ieee.org> Signed-off-by: Lucas Robinet <robinet.lucas@iuct-oncopole.fr> Signed-off-by: Lucas Robinet <67736918+Lucas-rbnt@users.noreply.github.com> Signed-off-by: chaoliu <chaoliu@nvidia.com> Signed-off-by: cxlcl <chaoliucxl@gmail.com> Signed-off-by: chaoliu <chaoliucxl@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: monai-bot <64792179+monai-bot@users.noreply.github.com> Co-authored-by: elitap <elitap@users.noreply.github.com> Co-authored-by: Felix Schnabel <f.schnabel@tum.de> Co-authored-by: YanxuanLiu <104543031+YanxuanLiu@users.noreply.github.com> Co-authored-by: ytl0623 <david89062388@gmail.com> Co-authored-by: Dženan Zukić <dzenan.zukic@kitware.com> Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Co-authored-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> Co-authored-by: Ishan Dutta <ishandutta0098@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kaibo Tang <ktang@unc.edu> Co-authored-by: Yufan He <59374597+heyufan1995@users.noreply.github.com> Co-authored-by: binliunls <107988372+binliunls@users.noreply.github.com> Co-authored-by: Ben Murray <ben.murray@gmail.com> Co-authored-by: axel.vlaminck <axel.vlaminck@gmail.com> Co-authored-by: Mingxin Zheng <18563433+mingxin-zheng@users.noreply.github.com> Co-authored-by: Ibrahim Hadzic <ibrahimhadzic45@gmail.com> Co-authored-by: Dr. Behrooz Hashemian <3968947+drbeh@users.noreply.github.com> Co-authored-by: Timothy J. Baker <62781117+tim-the-baker@users.noreply.github.com> Co-authored-by: Mathijs de Boer <8137653+MathijsdeBoer@users.noreply.github.com> Co-authored-by: Mathijs de Boer <m.deboer-41@umcutrecht.nl> Co-authored-by: Fabian Klopfer <fabian.klopfer@ieee.org> Co-authored-by: Yiheng Wang <68361391+yiheng-wang-nv@users.noreply.github.com> Co-authored-by: Lucas Robinet <67736918+Lucas-rbnt@users.noreply.github.com> Co-authored-by: Lucas Robinet <robinet.lucas@iuct-oncopole.fr> Co-authored-by: cxlcl <chaoliucxl@gmail.com>
Fixes Project-MONAI#2872 ### Description Implementation of mixup, cutmix and cutout as described in the original papers. Current implementation support both, the dictionary-based batches and tuples of tensors. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [x] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [x] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Juan Pablo de la Cruz Gutiérrez <juampatronics@gmail.com> Signed-off-by: monai-bot <monai.miccai2019@gmail.com> Signed-off-by: elitap <elias.tappeiner@gmx.at> Signed-off-by: Felix Schnabel <f.schnabel@tum.de> Signed-off-by: YanxuanLiu <yanxuanl@nvidia.com> Signed-off-by: ytl0623 <david89062388@gmail.com> Signed-off-by: Dženan Zukić <dzenan.zukic@kitware.com> Signed-off-by: KumoLiu <yunl@nvidia.com> Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> Signed-off-by: Ishan Dutta <ishandutta0098@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: kaibo <ktang@unc.edu> Signed-off-by: heyufan1995 <heyufan1995@gmail.com> Signed-off-by: binliu <binliu@nvidia.com> Signed-off-by: axel.vlaminck <axel.vlaminck@gmail.com> Signed-off-by: Ibrahim Hadzic <ibrahimhadzic45@gmail.com> Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com> Signed-off-by: Timothy Baker <bakertim@umich.edu> Signed-off-by: Mathijs de Boer <m.deboer-41@umcutrecht.nl> Signed-off-by: Fabian Klopfer <fabian.klopfer@ieee.org> Signed-off-by: Lucas Robinet <robinet.lucas@iuct-oncopole.fr> Signed-off-by: Lucas Robinet <67736918+Lucas-rbnt@users.noreply.github.com> Signed-off-by: chaoliu <chaoliu@nvidia.com> Signed-off-by: cxlcl <chaoliucxl@gmail.com> Signed-off-by: chaoliu <chaoliucxl@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: monai-bot <64792179+monai-bot@users.noreply.github.com> Co-authored-by: elitap <elitap@users.noreply.github.com> Co-authored-by: Felix Schnabel <f.schnabel@tum.de> Co-authored-by: YanxuanLiu <104543031+YanxuanLiu@users.noreply.github.com> Co-authored-by: ytl0623 <david89062388@gmail.com> Co-authored-by: Dženan Zukić <dzenan.zukic@kitware.com> Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Co-authored-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> Co-authored-by: Ishan Dutta <ishandutta0098@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kaibo Tang <ktang@unc.edu> Co-authored-by: Yufan He <59374597+heyufan1995@users.noreply.github.com> Co-authored-by: binliunls <107988372+binliunls@users.noreply.github.com> Co-authored-by: Ben Murray <ben.murray@gmail.com> Co-authored-by: axel.vlaminck <axel.vlaminck@gmail.com> Co-authored-by: Mingxin Zheng <18563433+mingxin-zheng@users.noreply.github.com> Co-authored-by: Ibrahim Hadzic <ibrahimhadzic45@gmail.com> Co-authored-by: Dr. Behrooz Hashemian <3968947+drbeh@users.noreply.github.com> Co-authored-by: Timothy J. Baker <62781117+tim-the-baker@users.noreply.github.com> Co-authored-by: Mathijs de Boer <8137653+MathijsdeBoer@users.noreply.github.com> Co-authored-by: Mathijs de Boer <m.deboer-41@umcutrecht.nl> Co-authored-by: Fabian Klopfer <fabian.klopfer@ieee.org> Co-authored-by: Yiheng Wang <68361391+yiheng-wang-nv@users.noreply.github.com> Co-authored-by: Lucas Robinet <67736918+Lucas-rbnt@users.noreply.github.com> Co-authored-by: Lucas Robinet <robinet.lucas@iuct-oncopole.fr> Co-authored-by: cxlcl <chaoliucxl@gmail.com> Signed-off-by: Yu0610 <612410030@alum.ccu.edu.tw>
HI, the more strong transformation "RandCoarseDropout" has been released in the latest version.
It's possible to support Mixup or Cutmix in MonAI?
The text was updated successfully, but these errors were encountered: