-
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
RandGaussianNoise and SavitzkyGolaySmooth Torch/NumpyTransforms #2740
Conversation
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
thanks for the PR, I'm looking into the details. @Nic-Ma could you please help review it as well? |
@wyli The test seems to be failing on GaussianFilter, but that hasn't been modified. Any ideas? I tried re-running the tests. |
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, I mainly have some comments on the styles and type hints for discussions @Project-MONAI/core-reviewers (and testing the github team feature...)
looks like it's been addressed by rerunning, probably a GPU testing job scheduling issue, we'll migrate to blossom soon |
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
/build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay response, very happy to see the great progress of this task.
The overall design looks good to me, put some minor comments inline.
And I want to double confirm the direction: do we want to change transforms to accept both numpy and tensor data and use PyTorch tensor for the real computation logic to support differentiable transforms later?
Thanks.
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Correct, the majority of transforms won't need numpy<->torch conversion, so adding in differentiable transforms should be possible. |
@wyli some flake8 errors have appeared since switching to In this snippet: def __call__(self, img: NdarrayTensor) -> NdarrayTensor:
"""
Apply the transform to `img`.
"""
self.randomize(img.shape)
if self._noise is None:
raise AssertionError
if not self._do_transform:
return img
noise, *_ = convert_data_type(
self._noise, type(img), dtype=img.dtype, device=img.device if isinstance(img, torch.Tensor) else None
)
return img + noise It's complaining about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick update.
Looks good to me now.
Thanks.
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
@wyli I'm still struggling with the flake8 problem, do you think you could take a look? Cheers |
Sure I can look into this later today |
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Related #2231, #2278.
Description
This is the first of many PRs to add support for Torch and Numpy input in our transforms, minimising conversion between the two and allowing for GPU data.
In this PR I've added the basic components:
RandGaussianSmooth
)SavitzkyGolaySmooth
)DataObjects
)Status
Ready/Work in progress/Hold
Types of changes
./runtests.sh -f -u --net --coverage
../runtests.sh --quick --unittests
.make html
command in thedocs/
folder.