Hi, I am training 181 images with .png format for the purpose of image registration.
and received this error:
File “/project/med/Hassan_Ghavidel/transformer_target_localization/code/main_train_unsup_TransMorph.py”, line 228, in
train_val_test.train_val_model_unsupervised(model, train_loader, optimizer, config.loss_name, config.loss_weights,
File “/project/med/Hassan_Ghavidel/transformer_target_localization/code/auxiliary/train_val_test.py”, line 61, in train_val_model_unsupervised
train_outputs, train_ddf = model(torch.cat((train_inputs, train_targets), dim=1))
File “/project/med/Hassan_Ghavidel/TransMorph_Transformer_for_Medical_Image_Registration/myenv/lib/python3.8/site-packages/torch/nn/modules/module.py”, line 1194, in _call_impl
return forward_call(*input, **kwargs)
File “/project/med/Hassan_Ghavidel/transformer_target_localization/code/models/TransMorph.py”, line 838, in forward
out = self.up1(out, f2)
File “/project/med/Hassan_Ghavidel/TransMorph_Transformer_for_Medical_Image_Registration/myenv/lib/python3.8/site-packages/torch/nn/modules/module.py”, line 1194, in _call_impl
return forward_call(*input, **kwargs)
File “/project/med/Hassan_Ghavidel/transformer_target_localization/code/models/TransMorph.py”, line 707, in forward
x = torch.cat([x, skip], dim=1)
File “/project/med/Hassan_Ghavidel/TransMorph_Transformer_for_Medical_Image_Registration/myenv/lib/python3.8/site-packages/monai/data/meta_tensor.py”, line 282, in torch_function
ret = super().torch_function(func, types, args, kwargs)
File “/project/med/Hassan_Ghavidel/TransMorph_Transformer_for_Medical_Image_Registration/myenv/lib/python3.8/site-packages/torch/_tensor.py”, line 1279, in torch_function
ret = func(*args, *kwargs)
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 48 but got size 47 for tensor number 1 in the list.
the line that code is complaining is
x = torch.cat([x, skip], dim=1)
located in the following picture:
May you give me a suggestion to solve this issue?