Skip to content

3264 Enhance DynUNet structure#3265

Merged
wyli merged 14 commits into
Project-MONAI:devfrom
yiheng-wang-nv:enhance-dynunet-accord-brats21
Nov 9, 2021
Merged

3264 Enhance DynUNet structure#3265
wyli merged 14 commits into
Project-MONAI:devfrom
yiheng-wang-nv:enhance-dynunet-accord-brats21

Conversation

@yiheng-wang-nv

@yiheng-wang-nv yiheng-wang-nv commented Nov 5, 2021

Copy link
Copy Markdown
Contributor

Fixes #3264 .

Description

Changes:

  1. Make activation layers and filters configurable (in nnUNet, filters are determined via a rule, but for Brats21 1st place solution, this parameter is different)
  2. Add a parameter to control the bias of transposed conv layers.
  3. Make deep supervision heads more lightly, since only needed (depends on deep_supr_num ) heads are useful, and when deep_supervision=False, there is no need to keep deep_supervision_heads, thus an empty nn.ModuleList() will be created (see: https://github.com/Project-MONAI/MONAI/pull/3265/files#diff-0095d268268e7ee415e079c1f0ccabed72f2c722f92cb0780d2ba8133a088334R341).

Status

Ready

Types of changes

  • 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.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

yiheng-wang-nv and others added 3 commits November 5, 2021 16:39
Signed-off-by: Yiheng Wang <vennw@nvidia.com>
Signed-off-by: Yiheng Wang <vennw@nvidia.com>
@wyli

wyli commented Nov 5, 2021

Copy link
Copy Markdown
Contributor

Thanks, to get this prepared for the upcoming release, could you please update AssertionError with either ValueError or TypeError so that the error types are more informative? and also remove DynUNetV1. cc @Nic-Ma @diazandr3s @SachidanandAlle

@madil90

madil90 commented Nov 5, 2021

Copy link
Copy Markdown
Contributor

/build

@wyli

wyli commented Nov 8, 2021

Copy link
Copy Markdown
Contributor

/build

@wyli wyli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, it looks good to me.

Signed-off-by: Yiheng Wang <vennw@nvidia.com>
…ng-nv/MONAI into enhance-dynunet-accord-brats21
@Nic-Ma

Nic-Ma commented Nov 8, 2021

Copy link
Copy Markdown
Contributor

I think these errors are related to this PR:

https://pipelines.actions.githubusercontent.com/l4HC8ZQBySk3IyeX2xuNSGAMiwZfqm8fOwamutFAAMLyYg6ITN/_apis/pipelines/1/runs/29280/signedlogcontent/4?urlExpires=2021-11-08T15%3A29%3A12.1656696Z&urlSigningMethod=HMACV1&urlSignature=LiJwnk6BaHBQMiwHaA3kHbqSm6FwXznYpytVSRDUxko%3D
======================================================================
ERROR: test_network_consistency_0_Dynunet (__main__.TestNetworkConsistency)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/site-packages/parameterized/parameterized.py", line 533, in standalone_func
    return func(*(a + p.args), **p.kwargs)
  File "tests/test_network_consistency.py", line 57, in test_network_consistency
    model.load_state_dict(loaded_data["model"])
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1413, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for DynUNet:
        Missing key(s) in state_dict: "deep_supervision_heads.0.conv.conv.weight", "deep_supervision_heads.0.conv.conv.bias", "deep_supervision_heads.1.conv.conv.weight", "deep_supervision_heads.1.conv.conv.bias". 

======================================================================
ERROR: test_network_consistency_1_Unet (__main__.TestNetworkConsistency)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/site-packages/parameterized/parameterized.py", line 533, in standalone_func
    return func(*(a + p.args), **p.kwargs)
  File "tests/test_network_consistency.py", line 56, in test_network_consistency
    model = nets.__dict__[net_name](**model_params)
TypeError: __init__() missing 1 required positional argument: 'spatial_dims'

----------------------------------------------------------------------

Could you please help fix it here?

Thanks in advance.

@Nic-Ma

Nic-Ma commented Nov 8, 2021

Copy link
Copy Markdown
Contributor

/build

@yiheng-wang-nv

Copy link
Copy Markdown
Contributor Author

I think these errors are related to this PR:

https://pipelines.actions.githubusercontent.com/l4HC8ZQBySk3IyeX2xuNSGAMiwZfqm8fOwamutFAAMLyYg6ITN/_apis/pipelines/1/runs/29280/signedlogcontent/4?urlExpires=2021-11-08T15%3A29%3A12.1656696Z&urlSigningMethod=HMACV1&urlSignature=LiJwnk6BaHBQMiwHaA3kHbqSm6FwXznYpytVSRDUxko%3D
======================================================================
ERROR: test_network_consistency_0_Dynunet (__main__.TestNetworkConsistency)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/site-packages/parameterized/parameterized.py", line 533, in standalone_func
    return func(*(a + p.args), **p.kwargs)
  File "tests/test_network_consistency.py", line 57, in test_network_consistency
    model.load_state_dict(loaded_data["model"])
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1413, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for DynUNet:
        Missing key(s) in state_dict: "deep_supervision_heads.0.conv.conv.weight", "deep_supervision_heads.0.conv.conv.bias", "deep_supervision_heads.1.conv.conv.weight", "deep_supervision_heads.1.conv.conv.bias". 

======================================================================
ERROR: test_network_consistency_1_Unet (__main__.TestNetworkConsistency)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/site-packages/parameterized/parameterized.py", line 533, in standalone_func
    return func(*(a + p.args), **p.kwargs)
  File "tests/test_network_consistency.py", line 56, in test_network_consistency
    model = nets.__dict__[net_name](**model_params)
TypeError: __init__() missing 1 required positional argument: 'spatial_dims'

----------------------------------------------------------------------

Could you please help fix it here?

Thanks in advance.

Hi @Nic-Ma , @wyli the first error will be fixed if merging this PR (since the network structure of DynUNet changes). The second error seems due to Unet changes (use spatial_dims to replace dimensions). I think https://github.com/Project-MONAI/MONAI-extra-test-data/blob/main/unet_0/Unet_0.json should be modified.

@Nic-Ma

Nic-Ma commented Nov 8, 2021

Copy link
Copy Markdown
Contributor

OK, let's try again the blossom test in PR #3250 when this PR merged.

Thanks.

@wyli

wyli commented Nov 8, 2021

Copy link
Copy Markdown
Contributor

/build

1 similar comment
@wyli

wyli commented Nov 8, 2021

Copy link
Copy Markdown
Contributor

/build

@wyli wyli enabled auto-merge (squash) November 8, 2021 17:33
@wyli

wyli commented Nov 8, 2021

Copy link
Copy Markdown
Contributor

/build

Signed-off-by: Wenqi Li <wenqil@nvidia.com>
@wyli

wyli commented Nov 8, 2021

Copy link
Copy Markdown
Contributor

/build

Signed-off-by: Yiheng Wang <vennw@nvidia.com>
@wyli

wyli commented Nov 9, 2021

Copy link
Copy Markdown
Contributor

/build

@wyli wyli merged commit 8e8e1b3 into Project-MONAI:dev Nov 9, 2021
@wyli wyli mentioned this pull request Nov 18, 2021
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance DynUNet

4 participants