Skip to content
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

LocalNet Upsampling #5782

Closed
fvlntn opened this issue Dec 21, 2022 · 2 comments · Fixed by #5807
Closed

LocalNet Upsampling #5782

fvlntn opened this issue Dec 21, 2022 · 2 comments · Fixed by #5807
Assignees

Comments

@fvlntn
Copy link

fvlntn commented Dec 21, 2022

Hello,

I've been using your LocalNet/GlobalNet and there was something off with my DDFs for a long time but couldn't think there was a direct error in your implementation. After checking it, there indeed is one small mistake.

Original is using Trilinear Upsampling (look at papers or DeepReg).
But here it is using F.interpolate which uses "Nearest" interpolation by default, both in

class RegistrationExtractionBlock(nn.Module):
and in
class AdditiveUpSampleBlock(nn.Module):
.

Try looking at your output DDFs with LocalNet, it is really non-linear.
Changing both method to "trilinear" for 3D data fixes the problem and makes the DDFs smooth like in the LocalNet paper.

F.interpolate() => F.interpolate(mode="trilinear")
Linear/Bilinear/Trilinear depending on dimensions.

Thanks a lot for your hard work,
Franck

@fvlntn
Copy link
Author

fvlntn commented Dec 21, 2022

Maybe torch updated F.interpolate to use "nearest" by default in a recent update. In such case you should also check all F.interpolate uses?

@wyli
Copy link
Contributor

wyli commented Jan 4, 2023

thanks for reporting, I'll make a PR to make it flexible.

cc @yiheng-wang-nv do you have any experience of different interpolating modes here:

out_all.append(interpolate(feature_map, out.shape[2:]))

@wyli wyli self-assigned this Jan 4, 2023
@wyli wyli closed this as completed in #5807 Jan 5, 2023
wyli added a commit that referenced this issue Jan 5, 2023
Signed-off-by: Wenqi Li <wenqil@nvidia.com>

Fixes #5782

### Description
- adds 'mode' and 'align_corners' options to the blocks and nets
- fixes a few typos

### 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).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [x] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants