Skip to content
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

使用Synapse权重无法进行测试 #43

Open
Candice-Y opened this issue May 8, 2024 · 1 comment
Open

使用Synapse权重无法进行测试 #43

Candice-Y opened this issue May 8, 2024 · 1 comment

Comments

@Candice-Y
Copy link

您好,非常感谢您的工作,收获很多,我在使用您给的Synapse权重尝试直接进行测试得到预测的分割图像时一直报错,如下所示:
Traceback (most recent call last): File "/data/cy-codes/MT-UNet-main/test_Synapse.py", line 23, in <module> model.load_state_dict(torch.load(args.checkpoint)) File "/data/miniconda/envs/torch/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2041, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for MTUNet: size mismatch for SegmentationHead.weight: copying a param with shape torch.Size([9, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([4, 64, 1, 1]). size mismatch for SegmentationHead.bias: copying a param with shape torch.Size([9]) from checkpoint, the shape in current model is torch.Size([4]).
我已经设置了num_classes的值为9,但是仍然报错,所以想向您请教,当然如果您能提供MT-UNet预测的分割结果,我会不胜感激,我的邮箱是allure0719@163.com,非常感谢!!

@Dootmaan
Copy link
Owner

Dootmaan commented May 13, 2024

Hi @Candice-Y and thank you for your question. Seems like you are trying to use ACDC weights for Synapse validation. This will cause a size mismatch for the classifier of MT-UNet as ACDC weights is for 4-class classification task. You can simply change to use our provided Synapse weights for this task.

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

No branches or pull requests

2 participants