Skip to content

Commit a86c0e0

Browse files
authored
Remove hard coding of bias_downsample in resnet methods (#6848)
Fixes #6811 . ### Description Remove hard coding of `bias_downsample` in `resnet` methods. This allows for loading `MedicalNet` models. ### 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). - [ ] 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 --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: Suraj Pai <[email protected]>
1 parent 7a760e6 commit a86c0e0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

monai/networks/nets/resnet.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,14 +333,16 @@ def _resnet(
333333
progress: bool,
334334
**kwargs: Any,
335335
) -> ResNet:
336-
model: ResNet = ResNet(block, layers, block_inplanes, bias_downsample=not pretrained, **kwargs)
336+
model: ResNet = ResNet(block, layers, block_inplanes, **kwargs)
337337
if pretrained:
338338
# Author of paper zipped the state_dict on googledrive,
339339
# so would need to download, unzip and read (2.8gb file for a ~150mb state dict).
340340
# Would like to load dict from url but need somewhere to save the state dicts.
341341
raise NotImplementedError(
342342
"Currently not implemented. You need to manually download weights provided by the paper's author"
343343
" and load then to the model with `state_dict`. See https://github.com/Tencent/MedicalNet"
344+
"Please ensure you pass the appropriate `shortcut_type` and `bias_downsample` args. as specified"
345+
"here: https://github.com/Tencent/MedicalNet/tree/18c8bb6cd564eb1b964bffef1f4c2283f1ae6e7b#update20190730"
344346
)
345347
return model
346348

0 commit comments

Comments
 (0)