Ensure deterministic in MixUp, CutMix, CutOut#7813
Conversation
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Co-authored-by: Eric Kerfoot <[email protected]> Signed-off-by: YunLiu <[email protected]>
Co-authored-by: Eric Kerfoot <[email protected]> Signed-off-by: YunLiu <[email protected]>
Co-authored-by: Eric Kerfoot <[email protected]> Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
|
/build |
Signed-off-by: YunLiu <[email protected]>
ericspod
left a comment
There was a problem hiding this comment.
Looks good now, the test changes look good too and capture the actual semantics we want. Thanks!
|
/build |
Fixes Project-MONAI#7697 ### Description A few sentences describing the changes proposed in this pull request. ### 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). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: YunLiu <[email protected]> Co-authored-by: Eric Kerfoot <[email protected]>
| def __call__(self, data: torch.Tensor, labels: torch.Tensor | None = None): | ||
| self.randomize() | ||
| augmented = self.apply(data) | ||
| return (augmented, self.apply_on_labels(labels)) if labels is not None else augmented | ||
| def __call__(self, data: torch.Tensor, labels: torch.Tensor | None = None, randomize=True): | ||
| data = convert_to_tensor(data, track_meta=get_track_meta()) | ||
| data_t = convert_to_tensor(data, track_meta=False) | ||
| if labels is not None: | ||
| labels_t = convert_to_tensor(labels, track_meta=get_track_meta()) | ||
| labels_t = convert_to_tensor(labels, track_meta=False) | ||
| if randomize: | ||
| self.randomize(data) | ||
| augmented = convert_to_dst_type(self.apply(data_t), dst=data)[0] | ||
| if labels is not None: | ||
| augmented_label = convert_to_dst_type(self.apply(labels_t), dst=labels)[0] | ||
| return (augmented, augmented_label) if labels is not None else augmented |
There was a problem hiding this comment.
Hello, I'm a researcher currently working with CutMix and other similar method. My group and I noticed an inconsistent behavior in CutMix on the segmentation labels on our different machines. After some digging, we think it may come from this PR: before this change, self.apply_on_labels(labels) is used for the label, but the modified change use self.apply(labels_t) which uses the same cropping mechanism as for the image.
This PR does not mention the reason for this change, could you enlighten me please ?
Thank you in advance for your time.
Fixes #7697
Description
A few sentences describing the changes proposed in this pull request.
Types of changes
./runtests.sh -f -u --net --coverage../runtests.sh --quick --unittests --disttests.make htmlcommand in thedocs/folder.