Skip to content

Support Mixup and Cutmix transformation #2872

Closed

Description

@JiYuanFeng

HI, the more strong transformation "RandCoarseDropout" has been released in the latest version.
It's possible to support Mixup or Cutmix in MonAI?
image

Activity

  1. Nic-Ma commented on Aug 31, 2021

    @Nic-Ma
    Contributor

    Hi @JiYuanFeng ,

    Thanks for your feedback.
    Seems like a new transform feature request, I marked for feature discussion.
    @ericspod @wyli Do you guys think it's a common approach in medical imaging augmentation?

    Thanks in advance.

    Thanks.

  2. wyli commented on Sep 1, 2021

    @wyli
    Contributor

    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.

  3. sandylaker commented on Sep 1, 2021

    @sandylaker

    @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.

  4. wyli commented on Sep 2, 2021

    @wyli
    Contributor

    Thanks, I think these are good augmentations to have. @Nic-Ma these could be in v0.8?

  5. Nic-Ma commented on Sep 2, 2021

    @Nic-Ma
    Contributor

    Sounds good to me.
    I can try to implement in v0.8.

    Thanks.

  6. self-assigned this
    on Sep 2, 2021
  7. Nic-Ma commented on Sep 9, 2021

    @Nic-Ma
    Contributor

    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.

  8. ericspod commented on Sep 10, 2021

    @ericspod
    Member

    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.

  9. masadcv commented on Oct 2, 2021

    @masadcv
    Contributor

    @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

  10. Nic-Ma commented on Oct 2, 2021

    @Nic-Ma
    Contributor

    Hi @masadcv ,

    Thanks for your sharing.
    Let me investigate it and get back ASAP.

    Thanks.

  11. assigned and unassigned on Nov 14, 2021
  12. JohnMasoner commented on Jun 2, 2023

    @JohnMasoner
    Contributor

    Hi @Nic-Ma ,

    It seems that Mixup and Cutmix are still unsupported.

    Is there any consideration to include this data transformation method?
    Because I've been working on related content lately, if consider adding these transformations. I will submit pr.

    Thanks.

  13. Nic-Ma commented on Jun 2, 2023

    @Nic-Ma
    Contributor

    Hi @JohnMasoner ,

    Thanks for your interest here.
    If @ericspod and @wyli don't have any other comments, welcome to contribute a PR.

  14. JohnMasoner commented on Jun 2, 2023

    @JohnMasoner
    Contributor

    Thanks for your reply,

    I readed @ericspod comments, i will contribute a PR about CutOut( Maybe like 'RandCoarseDropout', also similar to Mixup and Cutmix)

  15. ericspod commented on Jun 2, 2023

    @ericspod
    Member

    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.

  16. added a commit that references this issue on Mar 26, 2024
    e5bebfc
  17. added a commit that references this issue on Mar 27, 2024
    3264079
  18. added a commit that references this issue on Apr 11, 2024
    869b77f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions