junyuchen245 / TransMorph_Transformer_for_Medical_Image_Registration

TransMorph: Transformer for Unsupervised Medical Image Registration (PyTorch)
MIT License
432 stars 71 forks source link

Error reproducing Voxelmorph results on IXI. #27

Closed bhosalems closed 2 years ago

bhosalems commented 2 years ago

I am getting the below error -

    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for VxmDense_huge:
        size mismatch for unet_model.downarm.0.main.weight: copying a param with shape torch.Size([8, 2, 3, 3, 3]) from checkpoint, the shape in current model is torch.Size([14, 2, 3, 3, 3]).
        size mismatch for unet_model.downarm.0.main.bias: copying a param with shape torch.Size([8]) from checkpoint, the shape in current model is torch.Size([14]).
        size mismatch for unet_model.downarm.1.main.weight: copying a param with shape torch.Size([32, 8, 3, 3, 3]) from checkpoint, the shape in current model is torch.Size([28, 14, 3, 3, 3]).
...
junyuchen245 commented 2 years ago

Hi @bhosalems ,

I believe you are trying to load VoxelMorph-1 or -2's weights into VoxelMorph-huge. You'll need to change this line according to the model that you are trying to use: https://github.com/junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration/blob/47517d0cc5b7b8b56c77b6b3efa60d59abba3432/IXI/Baseline_registration_methods/VoxelMorph/infer.py#L63

You may find the names of the models here: https://github.com/junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration/blob/47517d0cc5b7b8b56c77b6b3efa60d59abba3432/IXI/Baseline_registration_methods/VoxelMorph/infer.py#L12

Junyu