Linfeng-Tang / SwinFusion

This is official Pytorch implementation of "SwinFusion: Cross-domain Long-range Learning for General Image Fusion via Swin Transformer"
161 stars 20 forks source link

An error was reported using in_channel=3 while testing #6

Closed lmn-ning closed 1 year ago

lmn-ning commented 1 year ago

When testing color images (Lytro dataset) using the multi-clustered image pretraining model, you cannot set in_channel=3 in test_swinfusion.py, only in_channel=1。The error message is :

RuntimeError: Error(s) in loading state_dict for SwinFusion: size mismatch for conv_first1_A.weight: copying a param with shape torch.Size([30, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([30, 3, 3, 3]). size mismatch for conv_first1_B.weight: copying a param with shape torch.Size([30, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([30, 3, 3, 3]). size mismatch for conv_last3.weight: copying a param with shape torch.Size([1, 15, 3, 3]) from checkpoint, the shape in current model is torch.Size([3, 15, 3, 3]). size mismatch for conv_last3.bias: copying a param with shape torch.Size([1]) from checkpoint, the shape in current model is torch.Size([3]).

So may I ask whether the pre-training model provided can be used to fuse color images