Closed alpergel closed 1 year ago
Linking this discussion here as I believe they're related. It seems that the pre-trained weights being used for SwinUNet are not being set up correctly for all datasets:
I'm trying to replicate the Auto3dSeg results on the medical decathlon prostate data (task_05). However, I'm running into the following error during the SwinUnet training stage:
RuntimeError: Error(s) in loading state_dict for SwinUNETR: size mismatch for swinViT.patch_embed.proj.weight: copying a param with shape torch.Size([48, 1, 2, 2, 2]) from checkpoint, >the shape in current model is torch.Size([48, 2, 2, 2, 2]). size mismatch for encoder1.layer.conv1.conv.weight: copying a param with shape torch.Size([48, 1, 3, 3, 3]) from >checkpoint, the shape in current model is torch.Size([48, 2, 3, 3, 3]). size mismatch for encoder1.layer.conv3.conv.weight: copying a param with shape torch.Size([48, 1, 1, 1, 1]) from >checkpoint, the shape in current model is torch.Size([48, 2, 1, 1, 1]).
Which codebase are you using, the BRATS segmentation or the BTCV? The pretrained weights can be different on different tasks, BRATS task used 128x128x128 as input, BTCV CT segmentation used 96x96x96. The size might matters here.
@tangy5 I'm not sure which codebases you are referring to. I am just trying to using the Auto3dSeg AutoRunner with the following command:
python -m monai.apps.auto3dseg AutoRunner run --input='./task.yaml'
In the generated train.py
for each of the SwinUnet folds, it appears the the weights are being downloaded from the following URL:
Does this answer your question?
The issue seems resolved in another thread. I'm closing this one.
@mingxin-zheng can you please link the thread where this was resolved?
Hi @peterhessey I believe this is the PR that it got fixed: https://github.com/Project-MONAI/research-contributions/pull/202 And it is updated in the dev branch of MONAI: https://github.com/Project-MONAI/MONAI/pull/5973
Hello, Im feeding the network data with size of [1,128,128,128] but I keep getting the following error: "RuntimeError: Given normalized_shape=[48], expected input with shape [*, 48], but got input of size[48, 64, 64, 64]". Is there a model setting that I am not setting correctly?
Thank you so much in advance!
Environment (please complete the following information):