hjwdzh / PrimitiveNet

PrimitiveNet: Primitive Instance Segmentation with Local Primitive Embedding under Adversarial Metric (ICCV 2021)
MIT License
62 stars 11 forks source link

There is a runtime error #10

Open happyfox-dot opened 2 years ago

happyfox-dot commented 2 years ago

Hello, thank you for your open source code. I am using sh scripts/test_ sence. sh encountered the following problem when executing the command, which was caused by mismatched parameters. Please tell me your sense.pthfile How did you get it? Can you share it? Error(s) in loading state_dict for SemanticPrediction: size mismatch for input_conv.0.weight: copying a param with shape torch.Size([3, 3, 3, 16, 16]) from checkpoint, the shape in current model is torch.Size([16, 3, 3, 3, 16]). size mismatch for unet.blocks.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 16, 16]) from checkpoint, the shape in current model is torch.Size([16, 3, 3, 3, 16]). size mismatch for unet.blocks.block0.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 16, 16]) from checkpoint, the shape in current model is torch.Size([16, 3, 3, 3, 16]). size mismatch for unet.blocks.block1.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 16, 16]) from checkpoint, the shape in current model is torch.Size([16, 3, 3, 3, 16]). size mismatch for unet.blocks.block1.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 16, 16]) from checkpoint, the shape in current model is torch.Size([16, 3, 3, 3, 16]). size mismatch for unet.conv.2.weight: copying a param with shape torch.Size([2, 2, 2, 16, 32]) from checkpoint, the shape in current model is torch.Size([32, 2, 2, 2, 16]). size mismatch for unet.u.blocks.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 32, 32]) from checkpoint, the shape in current model is torch.Size([32, 3, 3, 3, 32]). size mismatch for unet.u.blocks.block0.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 32, 32]) from checkpoint, the shape in current model is torch.Size([32, 3, 3, 3, 32]). size mismatch for unet.u.blocks.block1.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 32, 32]) from checkpoint, the shape in current model is torch.Size([32, 3, 3, 3, 32]). size mismatch for unet.u.blocks.block1.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 32, 32]) from checkpoint, the shape in current model is torch.Size([32, 3, 3, 3, 32]). size mismatch for unet.u.conv.2.weight: copying a param with shape torch.Size([2, 2, 2, 32, 48]) from checkpoint, the shape in current model is torch.Size([48, 2, 2, 2, 32]). size mismatch for unet.u.u.blocks.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 48, 48]) from checkpoint, the shape in current model is torch.Size([48, 3, 3, 3, 48]). size mismatch for unet.u.u.blocks.block0.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 48, 48]) from checkpoint, the shape in current model is torch.Size([48, 3, 3, 3, 48]). size mismatch for unet.u.u.blocks.block1.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 48, 48]) from checkpoint, the shape in current model is torch.Size([48, 3, 3, 3, 48]). size mismatch for unet.u.u.blocks.block1.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 48, 48]) from checkpoint, the shape in current model is torch.Size([48, 3, 3, 3, 48]). size mismatch for unet.u.u.conv.2.weight: copying a param with shape torch.Size([2, 2, 2, 48, 64]) from checkpoint, the shape in current model is torch.Size([64, 2, 2, 2, 48]). size mismatch for unet.u.u.u.blocks.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 64, 64]) from checkpoint, the shape in current model is torch.Size([64, 3, 3, 3, 64]). size mismatch for unet.u.u.u.blocks.block0.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 64, 64]) from checkpoint, the shape in current model is torch.Size([64, 3, 3, 3, 64]). size mismatch for unet.u.u.u.blocks.block1.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 64, 64]) from checkpoint, the shape in current model is torch.Size([64, 3, 3, 3, 64]). size mismatch for unet.u.u.u.blocks.block1.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 64, 64]) from checkpoint, the shape in current model is torch.Size([64, 3, 3, 3, 64]). size mismatch for unet.u.u.u.conv.2.weight: copying a param with shape torch.Size([2, 2, 2, 64, 80]) from checkpoint, the shape in current model is torch.Size([80, 2, 2, 2, 64]). size mismatch for unet.u.u.u.u.blocks.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 80, 80]) from checkpoint, the shape in current model is torch.Size([80, 3, 3, 3, 80]). size mismatch for unet.u.u.u.u.blocks.block0.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 80, 80]) from checkpoint, the shape in current model is torch.Size([80, 3, 3, 3, 80]). size mismatch for unet.u.u.u.u.blocks.block1.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 80, 80]) from checkpoint, the shape in current model is torch.Size([80, 3, 3, 3, 80]). size mismatch for unet.u.u.u.u.blocks.block1.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 80, 80]) from checkpoint, the shape in current model is torch.Size([80, 3, 3, 3, 80]). size mismatch for unet.u.u.u.u.conv.2.weight: copying a param with shape torch.Size([2, 2, 2, 80, 96]) from checkpoint, the shape in current model is torch.Size([96, 2, 2, 2, 80]). size mismatch for unet.u.u.u.u.u.blocks.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 96, 96]) from checkpoint, the shape in current model is torch.Size([96, 3, 3, 3, 96]). size mismatch for unet.u.u.u.u.u.blocks.block0.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 96, 96]) from checkpoint, the shape in current model is torch.Size([96, 3, 3, 3, 96]). size mismatch for unet.u.u.u.u.u.blocks.block1.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 96, 96]) from checkpoint, the shape in current model is torch.Size([96, 3, 3, 3, 96]). size mismatch for unet.u.u.u.u.u.blocks.block1.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 96, 96]) from checkpoint, the shape in current model is torch.Size([96, 3, 3, 3, 96]). size mismatch for unet.u.u.u.u.u.conv.2.weight: copying a param with shape torch.Size([2, 2, 2, 96, 112]) from checkpoint, the shape in current model is torch.Size([112, 2, 2, 2, 96]). size mismatch for unet.u.u.u.u.u.u.blocks.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 112, 112]) from checkpoint, the shape in current model is torch.Size([112, 3, 3, 3, 112]). size mismatch for unet.u.u.u.u.u.u.blocks.block0.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 112, 112]) from checkpoint, the shape in current model is torch.Size([112, 3, 3, 3, 112]). size mismatch for unet.u.u.u.u.u.u.blocks.block1.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 112, 112]) from checkpoint, the shape in current model is torch.Size([112, 3, 3, 3, 112]). size mismatch for unet.u.u.u.u.u.u.blocks.block1.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 112, 112]) from checkpoint, the shape in current model is torch.Size([112, 3, 3, 3, 112]). size mismatch for unet.u.u.u.u.u.deconv.2.weight: copying a param with shape torch.Size([2, 2, 2, 112, 96]) from checkpoint, the shape in current model is torch.Size([96, 2, 2, 2, 112]). size mismatch for unet.u.u.u.u.u.blocks_tail.block0.i_branch.0.weight: copying a param with shape torch.Size([1, 1, 1, 192, 96]) from checkpoint, the shape in current model is torch.Size([96, 1, 1, 1, 192]). size mismatch for unet.u.u.u.u.u.blocks_tail.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 192, 96]) from checkpoint, the shape in current model is torch.Size([96, 3, 3, 3, 192]). size mismatch for unet.u.u.u.u.u.blocks_tail.block0.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 96, 96]) from checkpoint, the shape in current model is torch.Size([96, 3, 3, 3, 96]). size mismatch for unet.u.u.u.u.u.blocks_tail.block1.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 96, 96]) from checkpoint, the shape in current model is torch.Size([96, 3, 3, 3, 96]). size mismatch for unet.u.u.u.u.u.blocks_tail.block1.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 96, 96]) from checkpoint, the shape in current model is torch.Size([96, 3, 3, 3, 96]). size mismatch for unet.u.u.u.u.deconv.2.weight: copying a param with shape torch.Size([2, 2, 2, 96, 80]) from checkpoint, the shape in current model is torch.Size([80, 2, 2, 2, 96]). size mismatch for unet.u.u.u.u.blocks_tail.block0.i_branch.0.weight: copying a param with shape torch.Size([1, 1, 1, 160, 80]) from checkpoint, the shape in current model is torch.Size([80, 1, 1, 1, 160]). size mismatch for unet.u.u.u.u.blocks_tail.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 160, 80]) from checkpoint, the shape in current model is torch.Size([80, 3, 3, 3, 160]). size mismatch for unet.u.u.u.u.blocks_tail.block0.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 80, 80]) from checkpoint, the shape in current model is torch.Size([80, 3, 3, 3, 80]). size mismatch for unet.u.u.u.u.blocks_tail.block1.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 80, 80]) from checkpoint, the shape in current model is torch.Size([80, 3, 3, 3, 80]). size mismatch for unet.u.u.u.u.blocks_tail.block1.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 80, 80]) from checkpoint, the shape in current model is torch.Size([80, 3, 3, 3, 80]). size mismatch for unet.u.u.u.deconv.2.weight: copying a param with shape torch.Size([2, 2, 2, 80, 64]) from checkpoint, the shape in current model is torch.Size([64, 2, 2, 2, 80]). size mismatch for unet.u.u.u.blocks_tail.block0.i_branch.0.weight: copying a param with shape torch.Size([1, 1, 1, 128, 64]) from checkpoint, the shape in current model is torch.Size([64, 1, 1, 1, 128]). size mismatch for unet.u.u.u.blocks_tail.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 128, 64]) from checkpoint, the shape in current model is torch.Size([64, 3, 3, 3, 128]). size mismatch for unet.u.u.u.blocks_tail.block0.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 64, 64]) from checkpoint, the shape in current model is torch.Size([64, 3, 3, 3, 64]). size mismatch for unet.u.u.u.blocks_tail.block1.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 64, 64]) from checkpoint, the shape in current model is torch.Size([64, 3, 3, 3, 64]). size mismatch for unet.u.u.u.blocks_tail.block1.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 64, 64]) from checkpoint, the shape in current model is torch.Size([64, 3, 3, 3, 64]). size mismatch for unet.u.u.deconv.2.weight: copying a param with shape torch.Size([2, 2, 2, 64, 48]) from checkpoint, the shape in current model is torch.Size([48, 2, 2, 2, 64]). size mismatch for unet.u.u.blocks_tail.block0.i_branch.0.weight: copying a param with shape torch.Size([1, 1, 1, 96, 48]) from checkpoint, the shape in current model is torch.Size([48, 1, 1, 1, 96]). size mismatch for unet.u.u.blocks_tail.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 96, 48]) from checkpoint, the shape in current model is torch.Size([48, 3, 3, 3, 96]). size mismatch for unet.u.u.blocks_tail.block0.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 48, 48]) from checkpoint, the shape in current model is torch.Size([48, 3, 3, 3, 48]). size mismatch for unet.u.u.blocks_tail.block1.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 48, 48]) from checkpoint, the shape in current model is torch.Size([48, 3, 3, 3, 48]). size mismatch for unet.u.u.blocks_tail.block1.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 48, 48]) from checkpoint, the shape in current model is torch.Size([48, 3, 3, 3, 48]). size mismatch for unet.u.deconv.2.weight: copying a param with shape torch.Size([2, 2, 2, 48, 32]) from checkpoint, the shape in current model is torch.Size([32, 2, 2, 2, 48]). size mismatch for unet.u.blocks_tail.block0.i_branch.0.weight: copying a param with shape torch.Size([1, 1, 1, 64, 32]) from checkpoint, the shape in current model is torch.Size([32, 1, 1, 1, 64]). size mismatch for unet.u.blocks_tail.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 64, 32]) from checkpoint, the shape in current model is torch.Size([32, 3, 3, 3, 64]). size mismatch for unet.u.blocks_tail.block0.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 32, 32]) from checkpoint, the shape in current model is torch.Size([32, 3, 3, 3, 32]). size mismatch for unet.u.blocks_tail.block1.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 32, 32]) from checkpoint, the shape in current model is torch.Size([32, 3, 3, 3, 32]). size mismatch for unet.u.blocks_tail.block1.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 32, 32]) from checkpoint, the shape in current model is torch.Size([32, 3, 3, 3, 32]). size mismatch for unet.deconv.2.weight: copying a param with shape torch.Size([2, 2, 2, 32, 16]) from checkpoint, the shape in current model is torch.Size([16, 2, 2, 2, 32]). size mismatch for unet.blocks_tail.block0.i_branch.0.weight: copying a param with shape torch.Size([1, 1, 1, 32, 16]) from checkpoint, the shape in current model is torch.Size([16, 1, 1, 1, 32]). size mismatch for unet.blocks_tail.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 32, 16]) from checkpoint, the shape in current model is torch.Size([16, 3, 3, 3, 32]). size mismatch for unet.blocks_tail.block0.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 16, 16]) from checkpoint, the shape in current model is torch.Size([16, 3, 3, 3, 16]). size mismatch for unet.blocks_tail.block1.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 16, 16]) from checkpoint, the shape in current model is torch.Size([16, 3, 3, 3, 16]). size mismatch for unet.blocks_tail.block1.conv_branch.5.weight: copying a param with shape torch.Size([3, 3, 3, 16, 16]) from checkpoint, the shape in current model is torch.Size([16, 3, 3, 3, 16]). size mismatch for linear_semantics.weight: copying a param with shape torch.Size([2, 32]) from checkpoint, the shape in current model is torch.Size([10, 32]). size mismatch for linear_semantics.bias: copying a param with shape torch.Size([2]) from checkpoint, the shape in current model is torch.Size([10]).

zuixiaosanlang commented 1 year ago

@happyfox-xie image change 10 to 2 can solve this problem

cypacjy commented 3 months ago

i have met this problem too,and i used your solution,but it doesn't work.the output is the same @zuixiaosanlang

cypacjy commented 3 months ago

i have met this problem too,and i used your solution,but it doesn't work.the output is the same @zuixiaosanlang

after check the code between spconv1.x and spconv 2.x,i find the format of the weight of convolution is different,the new version has three types of shapes.which makes the error