Open maxime915 opened 1 month ago
Hi @maxime915,
Thank you for reporting this issue!
You're right—there is indeed a behavior change here. As I mentioned in the PR: https://github.com/Project-MONAI/MONAI/pull/7813#discussion_r1618920989
In MONAI, we expect the same seed to be used across all keys in the dictionary-based version of the transforms. We didn’t include a specific note regarding this because the change aligns with the behavior of other transforms in MONAI, and we considered it an expected improvement. Apologies if this caused any confusion.
Your report will help bring more attention to this change, and I’ll make sure to enhance the docstring in the class to better explain this behavior.
Thanks again!
Thank you for the prompt reply.
There is one more thing I do not understand about this PR, can you help me ? I see that there were modification regarding the params
field of CutMix, but I also see that for the processing of the label, the old code in CutMix.__call__
used CutMix.apply_on_label
whereas it now uses CutMix.apply
(the same as the image). Is this change related to the determinism as well ? Looking at the implementation of apply
and apply_on_label
, both methods seem to be deterministic after the update.
For clarity, here is a link to the implementation in v1.3.2 : https://github.com/Project-MONAI/MONAI/blob/59a7211070538586369afd4a01eca0a7fe2e742e/monai/transforms/regularization/array.py#L142
And here is a link to the implementation in v1.4.0 : https://github.com/Project-MONAI/MONAI/blob/76ef9f40c8da626928238c91eacddc789b0b4530/monai/transforms/regularization/array.py#L161-L163
Yes, that's what I mentioned here: https://github.com/Project-MONAI/MONAI/pull/7813#discussion_r1618920989 We want ensure every key in the dictionary transform works as expected.
The behavior of the CutMix transform on labels was changed significantly from v1.3.2 to v1.4.0rc1. This change originates from #7813, in which I have left a comment, but I'm creating an issue to increase visibility.
Here is a script using the GlaS dataset.
Before, the label produced was a linear combination of the two labels.
In v1.4.0.rc1 (bottom) it is created similarly to the images.
The paper (https://arxiv.org/abs/1905.04899) mentioned in #2872 only describe how to transform a classification. While I have no authority on this subject, I believe the new implementation makes a lot more sense than the previous implementation.
However, warning users in a release note for this fixed bug / breaking change may be a good idea, if this change is to be kept.
Thank you for your consideration.
Environment
Ensuring you use the relevant python executable, please paste the output of:
For v1.4.0rc1
for v1.3.2