-
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
Simplify existing resnet
API for pretrained
flag
#7047
Comments
resnet
API for pretrained
flag
Fixes: Project-MONAI#7047 Original behaviour did not support True pretrained flag. Signed-off-by: vgrau98 <victor.grau93@gmail.com>
Using gdwon it is possible to download pretrained models developed by https://github.com/Tencent/MedicalNet and published on google drive: https://drive.google.com/u/0/uc?id=13tnSvXY7oDIEloNFiGTsjUIYfS3g3BfG&export=download. |
Finally pretrained models seem to be on hugging face: https://huggingface.co/TencentMedicalNet |
Fixes #7047 ### Description Resnet did not support `True` value (not implemented ) for its pretrained flag. 2 implemented behavior: - When pretrained is True, download weights from https://huggingface.co/TencentMedicalNet - When pretrained is a string, loads weights from the path defined by the string ### 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`. - [ ] 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: vgrau98 <victor.grau93@gmail.com>
Is your feature request related to a problem? Please describe.
The
pretrained
flag in theresnet50
function currently only accepts a boolean value. If it's set to True, the function throws an error pointing the user to download MedicalNet weights. Then, the user has to download these and manually load thestate_dict
into the model.Describe the solution you'd like
This process can be simplified largely by allowing the
pretrained
flag to takestr
values that point to a path and automatically loadingstate_dict
from these paths.This can help with loading the MedicalNet weights more easily and potentially open up this API to loading other models that have been trained with monai as well. If we don't want to support duck typing, then we could also add another flag to the function.
Additional context
I do understand that monai is moving in a different direction with loading bundles etc. but since this
pretrained
flag still exists, it might be useful to simplify it.The text was updated successfully, but these errors were encountered: