Project-MONAI / Project-MONAI/tutorials
Fix (+suggestions) to instantiation of LocalNet in 3D registration tutorial
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 2.5k
- Forks
- 803
- Avg merge
- 6d 22h
- Merged PRs (30d)
- 3
Description
The LocalNet in the 3D registration tutorial is currently instantiated as:
model = LocalNet(
spatial_dims=3,
in_channels=2,
out_channels=3,
num_channel_initial=32,
extract_levels=[3],
out_activation=None,
out_kernel_initializer="zeros",
).to(device)
However, the number of extraction levels should be set as extract_levels=[3, 2, 1, 0] in order for the average over feauture maps to be takes over all possible resolutions. With extract_levels=[3] the average is only taken over the coarsest (deepest) feature map, meaning a very coarse displacement field is predicted by the network, impacting performance negatively.
I would further recommend that out_kernel_initializer is set to "kaiming_uniform", as this is the default value in the LocalNet constructor (not "zeros"), and we have seen instabilities during training when using "zeros". An additional proposal would be to use an additional layer in the network, and adjust num_channel_initial, accordingly.
All in all, the instantiation would become:
model = LocalNet(
spatial_dims=3,
in_channels=2,
out_channels=3,
num_channel_initial=16,
extract_levels=[4, 3, 2, 1, 0],
out_activation=None,
out_kernel_initializer="kaiming_uniform",
).to(device)
Or simplified (using defaults):
model = LocalNet(
spatial_dims=3,
in_channels=2,
out_channels=3,
num_channel_initial=16,
extract_levels=[4, 3, 2, 1, 0],
).to(device)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open 3d_registration/paired_lung_ct.ipynb and locate the LocalNet instantiation. Review the linked regunet_block.py behavior, resolve whether to use the proposed configuration or simplified defaults, then update the notebook and run the relevant tutorial cells to confirm it executes with the agreed parameters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook, python, pytorch
- Domain
- documentation, machine-learning
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100