Conversation
Signed-off-by: Richard Brown <[email protected]>
wyli
left a comment
There was a problem hiding this comment.
thanks! there might be an implicit int->float casting in the forward, not sure whether we should consider that in the inverse, perhaps could refactor that later
|
Hi @rijobro , I have a concern about this PR: Thanks in advance. |
|
The applied transforms are stored in a list, so we could simply manipulate the list as we need. Untested example might be like this: def remove_transforms(transforms: list, to_be_removed: list):
return [t for t in transforms if t["class"] not in to_be_removed]
transforms = remove_transforms(data["image_transforms"], ["AdjustContrastd"])We could potentially formalise this using a withable or putting it in the Inverter logic: ts = data["image_transforms"]
with InvertibleTransform.skipInverses(ts, ["AdjustContrastd"]):
ts.inverse(data) |
|
Hi @rijobro , Thanks for your proposal, but is there any use case to avoid only 1 of same transforms? Resized(keys="img", spatial_size=[128, 128, 128]),
RandSpatialCrop(keys="img", random_size=True),
Resized(keys="img", spatial_size=[64, 64, 64]),And only skip the first Thanks. |
|
I think there could be lots of different reasons for wanting to do the inverse of some, but not all of the applied transforms, so there won't be any "one size fits all" solution. I don't think we often use multiple instances of the same transform, but If the user wanted to skip the first |
|
Hi @rijobro , Could you please help create a PR to enhance the Thanks in advance. |
|
Glad to hear that the inverse functionality is being used! Sure, I'll create a draft PR and we can discuss if the solution is acceptable there. |
|
Cool, sounds good! |
|
perhaps could have a |
|
Similar to my suggestion here: #2213 (comment). I wonder if we're getting a little too complicated -- what about transforms that are a mix of spatial and intensity, what about invertible transforms that are neither spatial or intensity (we don't have any yet, but may in the future). Would it be worth scheduling a meeting for our transforms? We may want to unify certain things to make them more future-proof. |
|
sure @rijobro let's have a Teams chat soon... |
This reverts commit 4c6af53. Signed-off-by: Wenqi Li <[email protected]>
This reverts commit 4c6af53. Signed-off-by: Wenqi Li <[email protected]>
Starts to address #2213.
Description
Add inverse for
AdjustContrastdandRandAdjustContrastd.Status
Ready
Types of changes
./runtests.sh -f -u --net --coverage../runtests.sh --quick --unittests.make htmlcommand in thedocs/folder.