0
$\begingroup$

The pretrained model accepts the input shape like this;

[batch_Size, Channels, Depth, Height, Width]
[32, 3, 16, 224,224]

I want to give it;

[batch_Size, Channels, Depth, Height, Width]
[32, 2, 16, 224,224]

It is giving me this error;

enter image description here

It is saying that the weight of pretrained model of first layer is [16,3,1,3,3], it expecting to have 3 channels but it got 2 channels instead. I have also kept strict = False in state_dict_load, but still giving me this error, should I have to go through each weight and change the reduce the channel? or should I train it from scratch?

Here is the pretrained model layers and their output;

conv1.conv_1.conv3d.weight : torch.Size([16, 3, 1, 3, 3])
conv1.conv_1.norm.weight : torch.Size([16])
conv1.conv_1.norm.bias : torch.Size([16])
blocks.b0_l0.alpha : torch.Size([])
blocks.b0_l0.expand.conv_1.conv3d.weight : torch.Size([40, 16, 1, 1, 1])
blocks.b0_l0.expand.conv_1.norm.weight : torch.Size([40])
blocks.b0_l0.expand.conv_1.norm.bias : torch.Size([40])
blocks.b0_l0.deep.conv_1.conv3d.weight : torch.Size([40, 1, 1, 5, 5])
blocks.b0_l0.deep.conv_1.norm.weight : torch.Size([40])
blocks.b0_l0.deep.conv_1.norm.bias : torch.Size([40])
blocks.b0_l0.se.fc1.conv_1.conv3d.weight : torch.Size([16, 40, 1, 1, 1])
blocks.b0_l0.se.fc1.conv_1.conv3d.bias : torch.Size([16])
blocks.b0_l0.se.fc2.conv_1.conv3d.weight : torch.Size([40, 16, 1, 1, 1])
blocks.b0_l0.se.fc2.conv_1.conv3d.bias : torch.Size([40])
blocks.b0_l0.project.conv_1.conv3d.weight : torch.Size([16, 40, 1, 1, 1])
blocks.b0_l0.project.conv_1.norm.weight : torch.Size([16])
blocks.b0_l0.project.conv_1.norm.bias : torch.Size([16])
blocks.b0_l0.res.1.conv_1.conv3d.weight : torch.Size([16, 16, 1, 1, 1])
blocks.b0_l0.res.1.conv_1.norm.weight : torch.Size([16])
blocks.b0_l0.res.1.conv_1.norm.bias : torch.Size([16])
blocks.b0_l1.alpha : torch.Size([])
blocks.b0_l1.expand.conv_1.conv3d.weight : torch.Size([40, 16, 1, 1, 1])
blocks.b0_l1.expand.conv_1.norm.weight : torch.Size([40])
blocks.b0_l1.expand.conv_1.norm.bias : torch.Size([40])
blocks.b0_l1.deep.conv_1.conv3d.weight : torch.Size([40, 1, 3, 3, 3])
blocks.b0_l1.deep.conv_1.norm.weight : torch.Size([40])
blocks.b0_l1.deep.conv_1.norm.bias : torch.Size([40])
blocks.b0_l1.se.fc1.conv_1.conv3d.weight : torch.Size([16, 40, 1, 1, 1])
blocks.b0_l1.se.fc1.conv_1.conv3d.bias : torch.Size([16])
blocks.b0_l1.se.fc2.conv_1.conv3d.weight : torch.Size([40, 16, 1, 1, 1])
blocks.b0_l1.se.fc2.conv_1.conv3d.bias : torch.Size([40])
blocks.b0_l1.project.conv_1.conv3d.weight : torch.Size([16, 40, 1, 1, 1])
blocks.b0_l1.project.conv_1.norm.weight : torch.Size([16])
blocks.b0_l1.project.conv_1.norm.bias : torch.Size([16])
blocks.b0_l2.alpha : torch.Size([])
blocks.b0_l2.expand.conv_1.conv3d.weight : torch.Size([64, 16, 1, 1, 1])
blocks.b0_l2.expand.conv_1.norm.weight : torch.Size([64])
blocks.b0_l2.expand.conv_1.norm.bias : torch.Size([64])
blocks.b0_l2.deep.conv_1.conv3d.weight : torch.Size([64, 1, 3, 3, 3])
blocks.b0_l2.deep.conv_1.norm.weight : torch.Size([64])
blocks.b0_l2.deep.conv_1.norm.bias : torch.Size([64])
blocks.b0_l2.se.fc1.conv_1.conv3d.weight : torch.Size([16, 64, 1, 1, 1])
blocks.b0_l2.se.fc1.conv_1.conv3d.bias : torch.Size([16])
blocks.b0_l2.se.fc2.conv_1.conv3d.weight : torch.Size([64, 16, 1, 1, 1])
blocks.b0_l2.se.fc2.conv_1.conv3d.bias : torch.Size([64])
blocks.b0_l2.project.conv_1.conv3d.weight : torch.Size([16, 64, 1, 1, 1])
blocks.b0_l2.project.conv_1.norm.weight : torch.Size([16])
blocks.b0_l2.project.conv_1.norm.bias : torch.Size([16])
blocks.b1_l0.alpha : torch.Size([])
blocks.b1_l0.expand.conv_1.conv3d.weight : torch.Size([96, 16, 1, 1, 1])
blocks.b1_l0.expand.conv_1.norm.weight : torch.Size([96])
blocks.b1_l0.expand.conv_1.norm.bias : torch.Size([96])
blocks.b1_l0.deep.conv_1.conv3d.weight : torch.Size([96, 1, 3, 3, 3])
blocks.b1_l0.deep.conv_1.norm.weight : torch.Size([96])
blocks.b1_l0.deep.conv_1.norm.bias : torch.Size([96])
blocks.b1_l0.se.fc1.conv_1.conv3d.weight : torch.Size([24, 96, 1, 1, 1])
blocks.b1_l0.se.fc1.conv_1.conv3d.bias : torch.Size([24])
blocks.b1_l0.se.fc2.conv_1.conv3d.weight : torch.Size([96, 24, 1, 1, 1])
blocks.b1_l0.se.fc2.conv_1.conv3d.bias : torch.Size([96])
blocks.b1_l0.project.conv_1.conv3d.weight : torch.Size([40, 96, 1, 1, 1])
blocks.b1_l0.project.conv_1.norm.weight : torch.Size([40])
blocks.b1_l0.project.conv_1.norm.bias : torch.Size([40])
blocks.b1_l0.res.1.conv_1.conv3d.weight : torch.Size([40, 16, 1, 1, 1])
blocks.b1_l0.res.1.conv_1.norm.weight : torch.Size([40])
blocks.b1_l0.res.1.conv_1.norm.bias : torch.Size([40])
blocks.b1_l1.alpha : torch.Size([])
blocks.b1_l1.expand.conv_1.conv3d.weight : torch.Size([120, 40, 1, 1, 1])
blocks.b1_l1.expand.conv_1.norm.weight : torch.Size([120])
blocks.b1_l1.expand.conv_1.norm.bias : torch.Size([120])
blocks.b1_l1.deep.conv_1.conv3d.weight : torch.Size([120, 1, 3, 3, 3])
blocks.b1_l1.deep.conv_1.norm.weight : torch.Size([120])
blocks.b1_l1.deep.conv_1.norm.bias : torch.Size([120])
blocks.b1_l1.se.fc1.conv_1.conv3d.weight : torch.Size([32, 120, 1, 1, 1])
blocks.b1_l1.se.fc1.conv_1.conv3d.bias : torch.Size([32])
blocks.b1_l1.se.fc2.conv_1.conv3d.weight : torch.Size([120, 32, 1, 1, 1])
blocks.b1_l1.se.fc2.conv_1.conv3d.bias : torch.Size([120])
blocks.b1_l1.project.conv_1.conv3d.weight : torch.Size([40, 120, 1, 1, 1])
blocks.b1_l1.project.conv_1.norm.weight : torch.Size([40])
blocks.b1_l1.project.conv_1.norm.bias : torch.Size([40])
blocks.b1_l2.alpha : torch.Size([])
blocks.b1_l2.expand.conv_1.conv3d.weight : torch.Size([96, 40, 1, 1, 1])
blocks.b1_l2.expand.conv_1.norm.weight : torch.Size([96])
blocks.b1_l2.expand.conv_1.norm.bias : torch.Size([96])
blocks.b1_l2.deep.conv_1.conv3d.weight : torch.Size([96, 1, 3, 3, 3])
blocks.b1_l2.deep.conv_1.norm.weight : torch.Size([96])
blocks.b1_l2.deep.conv_1.norm.bias : torch.Size([96])
blocks.b1_l2.se.fc1.conv_1.conv3d.weight : torch.Size([24, 96, 1, 1, 1])
blocks.b1_l2.se.fc1.conv_1.conv3d.bias : torch.Size([24])
blocks.b1_l2.se.fc2.conv_1.conv3d.weight : torch.Size([96, 24, 1, 1, 1])
blocks.b1_l2.se.fc2.conv_1.conv3d.bias : torch.Size([96])
blocks.b1_l2.project.conv_1.conv3d.weight : torch.Size([40, 96, 1, 1, 1])
blocks.b1_l2.project.conv_1.norm.weight : torch.Size([40])
blocks.b1_l2.project.conv_1.norm.bias : torch.Size([40])
blocks.b1_l3.alpha : torch.Size([])
blocks.b1_l3.expand.conv_1.conv3d.weight : torch.Size([96, 40, 1, 1, 1])
blocks.b1_l3.expand.conv_1.norm.weight : torch.Size([96])
blocks.b1_l3.expand.conv_1.norm.bias : torch.Size([96])
blocks.b1_l3.deep.conv_1.conv3d.weight : torch.Size([96, 1, 3, 3, 3])
blocks.b1_l3.deep.conv_1.norm.weight : torch.Size([96])
blocks.b1_l3.deep.conv_1.norm.bias : torch.Size([96])
blocks.b1_l3.se.fc1.conv_1.conv3d.weight : torch.Size([24, 96, 1, 1, 1])
blocks.b1_l3.se.fc1.conv_1.conv3d.bias : torch.Size([24])
blocks.b1_l3.se.fc2.conv_1.conv3d.weight : torch.Size([96, 24, 1, 1, 1])
blocks.b1_l3.se.fc2.conv_1.conv3d.bias : torch.Size([96])
blocks.b1_l3.project.conv_1.conv3d.weight : torch.Size([40, 96, 1, 1, 1])
blocks.b1_l3.project.conv_1.norm.weight : torch.Size([40])
blocks.b1_l3.project.conv_1.norm.bias : torch.Size([40])
blocks.b1_l4.alpha : torch.Size([])
blocks.b1_l4.expand.conv_1.conv3d.weight : torch.Size([120, 40, 1, 1, 1])
blocks.b1_l4.expand.conv_1.norm.weight : torch.Size([120])
blocks.b1_l4.expand.conv_1.norm.bias : torch.Size([120])
blocks.b1_l4.deep.conv_1.conv3d.weight : torch.Size([120, 1, 3, 3, 3])
blocks.b1_l4.deep.conv_1.norm.weight : torch.Size([120])
blocks.b1_l4.deep.conv_1.norm.bias : torch.Size([120])
blocks.b1_l4.se.fc1.conv_1.conv3d.weight : torch.Size([32, 120, 1, 1, 1])
blocks.b1_l4.se.fc1.conv_1.conv3d.bias : torch.Size([32])
blocks.b1_l4.se.fc2.conv_1.conv3d.weight : torch.Size([120, 32, 1, 1, 1])
blocks.b1_l4.se.fc2.conv_1.conv3d.bias : torch.Size([120])
blocks.b1_l4.project.conv_1.conv3d.weight : torch.Size([40, 120, 1, 1, 1])
blocks.b1_l4.project.conv_1.norm.weight : torch.Size([40])
blocks.b1_l4.project.conv_1.norm.bias : torch.Size([40])
blocks.b2_l0.alpha : torch.Size([])
blocks.b2_l0.expand.conv_1.conv3d.weight : torch.Size([240, 40, 1, 1, 1])
blocks.b2_l0.expand.conv_1.norm.weight : torch.Size([240])
blocks.b2_l0.expand.conv_1.norm.bias : torch.Size([240])
blocks.b2_l0.deep.conv_1.conv3d.weight : torch.Size([240, 1, 5, 3, 3])
blocks.b2_l0.deep.conv_1.norm.weight : torch.Size([240])
blocks.b2_l0.deep.conv_1.norm.bias : torch.Size([240])
blocks.b2_l0.se.fc1.conv_1.conv3d.weight : torch.Size([64, 240, 1, 1, 1])
blocks.b2_l0.se.fc1.conv_1.conv3d.bias : torch.Size([64])
blocks.b2_l0.se.fc2.conv_1.conv3d.weight : torch.Size([240, 64, 1, 1, 1])
blocks.b2_l0.se.fc2.conv_1.conv3d.bias : torch.Size([240])
blocks.b2_l0.project.conv_1.conv3d.weight : torch.Size([72, 240, 1, 1, 1])
blocks.b2_l0.project.conv_1.norm.weight : torch.Size([72])
blocks.b2_l0.project.conv_1.norm.bias : torch.Size([72])
blocks.b2_l0.res.1.conv_1.conv3d.weight : torch.Size([72, 40, 1, 1, 1])
blocks.b2_l0.res.1.conv_1.norm.weight : torch.Size([72])
blocks.b2_l0.res.1.conv_1.norm.bias : torch.Size([72])
blocks.b2_l1.alpha : torch.Size([])
blocks.b2_l1.expand.conv_1.conv3d.weight : torch.Size([160, 72, 1, 1, 1])
blocks.b2_l1.expand.conv_1.norm.weight : torch.Size([160])
blocks.b2_l1.expand.conv_1.norm.bias : torch.Size([160])
blocks.b2_l1.deep.conv_1.conv3d.weight : torch.Size([160, 1, 3, 3, 3])
blocks.b2_l1.deep.conv_1.norm.weight : torch.Size([160])
blocks.b2_l1.deep.conv_1.norm.bias : torch.Size([160])
blocks.b2_l1.se.fc1.conv_1.conv3d.weight : torch.Size([40, 160, 1, 1, 1])
blocks.b2_l1.se.fc1.conv_1.conv3d.bias : torch.Size([40])
blocks.b2_l1.se.fc2.conv_1.conv3d.weight : torch.Size([160, 40, 1, 1, 1])
blocks.b2_l1.se.fc2.conv_1.conv3d.bias : torch.Size([160])
blocks.b2_l1.project.conv_1.conv3d.weight : torch.Size([72, 160, 1, 1, 1])
blocks.b2_l1.project.conv_1.norm.weight : torch.Size([72])
blocks.b2_l1.project.conv_1.norm.bias : torch.Size([72])
blocks.b2_l2.alpha : torch.Size([])
blocks.b2_l2.expand.conv_1.conv3d.weight : torch.Size([240, 72, 1, 1, 1])
blocks.b2_l2.expand.conv_1.norm.weight : torch.Size([240])
blocks.b2_l2.expand.conv_1.norm.bias : torch.Size([240])
blocks.b2_l2.deep.conv_1.conv3d.weight : torch.Size([240, 1, 3, 3, 3])
blocks.b2_l2.deep.conv_1.norm.weight : torch.Size([240])
blocks.b2_l2.deep.conv_1.norm.bias : torch.Size([240])
blocks.b2_l2.se.fc1.conv_1.conv3d.weight : torch.Size([64, 240, 1, 1, 1])
blocks.b2_l2.se.fc1.conv_1.conv3d.bias : torch.Size([64])
blocks.b2_l2.se.fc2.conv_1.conv3d.weight : torch.Size([240, 64, 1, 1, 1])
blocks.b2_l2.se.fc2.conv_1.conv3d.bias : torch.Size([240])
blocks.b2_l2.project.conv_1.conv3d.weight : torch.Size([72, 240, 1, 1, 1])
blocks.b2_l2.project.conv_1.norm.weight : torch.Size([72])
blocks.b2_l2.project.conv_1.norm.bias : torch.Size([72])
blocks.b2_l3.alpha : torch.Size([])
blocks.b2_l3.expand.conv_1.conv3d.weight : torch.Size([192, 72, 1, 1, 1])
blocks.b2_l3.expand.conv_1.norm.weight : torch.Size([192])
blocks.b2_l3.expand.conv_1.norm.bias : torch.Size([192])
blocks.b2_l3.deep.conv_1.conv3d.weight : torch.Size([192, 1, 3, 3, 3])
blocks.b2_l3.deep.conv_1.norm.weight : torch.Size([192])
blocks.b2_l3.deep.conv_1.norm.bias : torch.Size([192])
blocks.b2_l3.se.fc1.conv_1.conv3d.weight : torch.Size([48, 192, 1, 1, 1])
blocks.b2_l3.se.fc1.conv_1.conv3d.bias : torch.Size([48])
blocks.b2_l3.se.fc2.conv_1.conv3d.weight : torch.Size([192, 48, 1, 1, 1])
blocks.b2_l3.se.fc2.conv_1.conv3d.bias : torch.Size([192])
blocks.b2_l3.project.conv_1.conv3d.weight : torch.Size([72, 192, 1, 1, 1])
blocks.b2_l3.project.conv_1.norm.weight : torch.Size([72])
blocks.b2_l3.project.conv_1.norm.bias : torch.Size([72])
blocks.b2_l4.alpha : torch.Size([])
blocks.b2_l4.expand.conv_1.conv3d.weight : torch.Size([240, 72, 1, 1, 1])
blocks.b2_l4.expand.conv_1.norm.weight : torch.Size([240])
blocks.b2_l4.expand.conv_1.norm.bias : torch.Size([240])
blocks.b2_l4.deep.conv_1.conv3d.weight : torch.Size([240, 1, 3, 3, 3])
blocks.b2_l4.deep.conv_1.norm.weight : torch.Size([240])
blocks.b2_l4.deep.conv_1.norm.bias : torch.Size([240])
blocks.b2_l4.se.fc1.conv_1.conv3d.weight : torch.Size([64, 240, 1, 1, 1])
blocks.b2_l4.se.fc1.conv_1.conv3d.bias : torch.Size([64])
blocks.b2_l4.se.fc2.conv_1.conv3d.weight : torch.Size([240, 64, 1, 1, 1])
blocks.b2_l4.se.fc2.conv_1.conv3d.bias : torch.Size([240])
blocks.b2_l4.project.conv_1.conv3d.weight : torch.Size([72, 240, 1, 1, 1])
blocks.b2_l4.project.conv_1.norm.weight : torch.Size([72])
blocks.b2_l4.project.conv_1.norm.bias : torch.Size([72])
blocks.b3_l0.alpha : torch.Size([])
blocks.b3_l0.expand.conv_1.conv3d.weight : torch.Size([240, 72, 1, 1, 1])
blocks.b3_l0.expand.conv_1.norm.weight : torch.Size([240])
blocks.b3_l0.expand.conv_1.norm.bias : torch.Size([240])
blocks.b3_l0.deep.conv_1.conv3d.weight : torch.Size([240, 1, 5, 3, 3])
blocks.b3_l0.deep.conv_1.norm.weight : torch.Size([240])
blocks.b3_l0.deep.conv_1.norm.bias : torch.Size([240])
blocks.b3_l0.se.fc1.conv_1.conv3d.weight : torch.Size([64, 240, 1, 1, 1])
blocks.b3_l0.se.fc1.conv_1.conv3d.bias : torch.Size([64])
blocks.b3_l0.se.fc2.conv_1.conv3d.weight : torch.Size([240, 64, 1, 1, 1])
blocks.b3_l0.se.fc2.conv_1.conv3d.bias : torch.Size([240])
blocks.b3_l0.project.conv_1.conv3d.weight : torch.Size([72, 240, 1, 1, 1])
blocks.b3_l0.project.conv_1.norm.weight : torch.Size([72])
blocks.b3_l0.project.conv_1.norm.bias : torch.Size([72])
blocks.b3_l1.alpha : torch.Size([])
blocks.b3_l1.expand.conv_1.conv3d.weight : torch.Size([240, 72, 1, 1, 1])
blocks.b3_l1.expand.conv_1.norm.weight : torch.Size([240])
blocks.b3_l1.expand.conv_1.norm.bias : torch.Size([240])
blocks.b3_l1.deep.conv_1.conv3d.weight : torch.Size([240, 1, 3, 3, 3])
blocks.b3_l1.deep.conv_1.norm.weight : torch.Size([240])
blocks.b3_l1.deep.conv_1.norm.bias : torch.Size([240])
blocks.b3_l1.se.fc1.conv_1.conv3d.weight : torch.Size([64, 240, 1, 1, 1])
blocks.b3_l1.se.fc1.conv_1.conv3d.bias : torch.Size([64])
blocks.b3_l1.se.fc2.conv_1.conv3d.weight : torch.Size([240, 64, 1, 1, 1])
blocks.b3_l1.se.fc2.conv_1.conv3d.bias : torch.Size([240])
blocks.b3_l1.project.conv_1.conv3d.weight : torch.Size([72, 240, 1, 1, 1])
blocks.b3_l1.project.conv_1.norm.weight : torch.Size([72])
blocks.b3_l1.project.conv_1.norm.bias : torch.Size([72])
blocks.b3_l2.alpha : torch.Size([])
blocks.b3_l2.expand.conv_1.conv3d.weight : torch.Size([240, 72, 1, 1, 1])
blocks.b3_l2.expand.conv_1.norm.weight : torch.Size([240])
blocks.b3_l2.expand.conv_1.norm.bias : torch.Size([240])
blocks.b3_l2.deep.conv_1.conv3d.weight : torch.Size([240, 1, 3, 3, 3])
blocks.b3_l2.deep.conv_1.norm.weight : torch.Size([240])
blocks.b3_l2.deep.conv_1.norm.bias : torch.Size([240])
blocks.b3_l2.se.fc1.conv_1.conv3d.weight : torch.Size([64, 240, 1, 1, 1])
blocks.b3_l2.se.fc1.conv_1.conv3d.bias : torch.Size([64])
blocks.b3_l2.se.fc2.conv_1.conv3d.weight : torch.Size([240, 64, 1, 1, 1])
blocks.b3_l2.se.fc2.conv_1.conv3d.bias : torch.Size([240])
blocks.b3_l2.project.conv_1.conv3d.weight : torch.Size([72, 240, 1, 1, 1])
blocks.b3_l2.project.conv_1.norm.weight : torch.Size([72])
blocks.b3_l2.project.conv_1.norm.bias : torch.Size([72])
blocks.b3_l3.alpha : torch.Size([])
blocks.b3_l3.expand.conv_1.conv3d.weight : torch.Size([240, 72, 1, 1, 1])
blocks.b3_l3.expand.conv_1.norm.weight : torch.Size([240])
blocks.b3_l3.expand.conv_1.norm.bias : torch.Size([240])
blocks.b3_l3.deep.conv_1.conv3d.weight : torch.Size([240, 1, 3, 3, 3])
blocks.b3_l3.deep.conv_1.norm.weight : torch.Size([240])
blocks.b3_l3.deep.conv_1.norm.bias : torch.Size([240])
blocks.b3_l3.se.fc1.conv_1.conv3d.weight : torch.Size([64, 240, 1, 1, 1])
blocks.b3_l3.se.fc1.conv_1.conv3d.bias : torch.Size([64])
blocks.b3_l3.se.fc2.conv_1.conv3d.weight : torch.Size([240, 64, 1, 1, 1])
blocks.b3_l3.se.fc2.conv_1.conv3d.bias : torch.Size([240])
blocks.b3_l3.project.conv_1.conv3d.weight : torch.Size([72, 240, 1, 1, 1])
blocks.b3_l3.project.conv_1.norm.weight : torch.Size([72])
blocks.b3_l3.project.conv_1.norm.bias : torch.Size([72])
blocks.b3_l4.alpha : torch.Size([])
blocks.b3_l4.expand.conv_1.conv3d.weight : torch.Size([144, 72, 1, 1, 1])
blocks.b3_l4.expand.conv_1.norm.weight : torch.Size([144])
blocks.b3_l4.expand.conv_1.norm.bias : torch.Size([144])
blocks.b3_l4.deep.conv_1.conv3d.weight : torch.Size([144, 1, 1, 5, 5])
blocks.b3_l4.deep.conv_1.norm.weight : torch.Size([144])
blocks.b3_l4.deep.conv_1.norm.bias : torch.Size([144])
blocks.b3_l4.se.fc1.conv_1.conv3d.weight : torch.Size([40, 144, 1, 1, 1])
blocks.b3_l4.se.fc1.conv_1.conv3d.bias : torch.Size([40])
blocks.b3_l4.se.fc2.conv_1.conv3d.weight : torch.Size([144, 40, 1, 1, 1])
blocks.b3_l4.se.fc2.conv_1.conv3d.bias : torch.Size([144])
blocks.b3_l4.project.conv_1.conv3d.weight : torch.Size([72, 144, 1, 1, 1])
blocks.b3_l4.project.conv_1.norm.weight : torch.Size([72])
blocks.b3_l4.project.conv_1.norm.bias : torch.Size([72])
blocks.b3_l5.alpha : torch.Size([])
blocks.b3_l5.expand.conv_1.conv3d.weight : torch.Size([240, 72, 1, 1, 1])
blocks.b3_l5.expand.conv_1.norm.weight : torch.Size([240])
blocks.b3_l5.expand.conv_1.norm.bias : torch.Size([240])
blocks.b3_l5.deep.conv_1.conv3d.weight : torch.Size([240, 1, 3, 3, 3])
blocks.b3_l5.deep.conv_1.norm.weight : torch.Size([240])
blocks.b3_l5.deep.conv_1.norm.bias : torch.Size([240])
blocks.b3_l5.se.fc1.conv_1.conv3d.weight : torch.Size([64, 240, 1, 1, 1])
blocks.b3_l5.se.fc1.conv_1.conv3d.bias : torch.Size([64])
blocks.b3_l5.se.fc2.conv_1.conv3d.weight : torch.Size([240, 64, 1, 1, 1])
blocks.b3_l5.se.fc2.conv_1.conv3d.bias : torch.Size([240])
blocks.b3_l5.project.conv_1.conv3d.weight : torch.Size([72, 240, 1, 1, 1])
blocks.b3_l5.project.conv_1.norm.weight : torch.Size([72])
blocks.b3_l5.project.conv_1.norm.bias : torch.Size([72])
blocks.b4_l0.alpha : torch.Size([])
blocks.b4_l0.expand.conv_1.conv3d.weight : torch.Size([480, 72, 1, 1, 1])
blocks.b4_l0.expand.conv_1.norm.weight : torch.Size([480])
blocks.b4_l0.expand.conv_1.norm.bias : torch.Size([480])
blocks.b4_l0.deep.conv_1.conv3d.weight : torch.Size([480, 1, 5, 3, 3])
blocks.b4_l0.deep.conv_1.norm.weight : torch.Size([480])
blocks.b4_l0.deep.conv_1.norm.bias : torch.Size([480])
blocks.b4_l0.se.fc1.conv_1.conv3d.weight : torch.Size([120, 480, 1, 1, 1])
blocks.b4_l0.se.fc1.conv_1.conv3d.bias : torch.Size([120])
blocks.b4_l0.se.fc2.conv_1.conv3d.weight : torch.Size([480, 120, 1, 1, 1])
blocks.b4_l0.se.fc2.conv_1.conv3d.bias : torch.Size([480])
blocks.b4_l0.project.conv_1.conv3d.weight : torch.Size([144, 480, 1, 1, 1])
blocks.b4_l0.project.conv_1.norm.weight : torch.Size([144])
blocks.b4_l0.project.conv_1.norm.bias : torch.Size([144])
blocks.b4_l0.res.1.conv_1.conv3d.weight : torch.Size([144, 72, 1, 1, 1])
blocks.b4_l0.res.1.conv_1.norm.weight : torch.Size([144])
blocks.b4_l0.res.1.conv_1.norm.bias : torch.Size([144])
blocks.b4_l1.alpha : torch.Size([])
blocks.b4_l1.expand.conv_1.conv3d.weight : torch.Size([384, 144, 1, 1, 1])
blocks.b4_l1.expand.conv_1.norm.weight : torch.Size([384])
blocks.b4_l1.expand.conv_1.norm.bias : torch.Size([384])
blocks.b4_l1.deep.conv_1.conv3d.weight : torch.Size([384, 1, 1, 5, 5])
blocks.b4_l1.deep.conv_1.norm.weight : torch.Size([384])
blocks.b4_l1.deep.conv_1.norm.bias : torch.Size([384])
blocks.b4_l1.se.fc1.conv_1.conv3d.weight : torch.Size([96, 384, 1, 1, 1])
blocks.b4_l1.se.fc1.conv_1.conv3d.bias : torch.Size([96])
blocks.b4_l1.se.fc2.conv_1.conv3d.weight : torch.Size([384, 96, 1, 1, 1])
blocks.b4_l1.se.fc2.conv_1.conv3d.bias : torch.Size([384])
blocks.b4_l1.project.conv_1.conv3d.weight : torch.Size([144, 384, 1, 1, 1])
blocks.b4_l1.project.conv_1.norm.weight : torch.Size([144])
blocks.b4_l1.project.conv_1.norm.bias : torch.Size([144])
blocks.b4_l2.alpha : torch.Size([])
blocks.b4_l2.expand.conv_1.conv3d.weight : torch.Size([384, 144, 1, 1, 1])
blocks.b4_l2.expand.conv_1.norm.weight : torch.Size([384])
blocks.b4_l2.expand.conv_1.norm.bias : torch.Size([384])
blocks.b4_l2.deep.conv_1.conv3d.weight : torch.Size([384, 1, 1, 5, 5])
blocks.b4_l2.deep.conv_1.norm.weight : torch.Size([384])
blocks.b4_l2.deep.conv_1.norm.bias : torch.Size([384])
blocks.b4_l2.se.fc1.conv_1.conv3d.weight : torch.Size([96, 384, 1, 1, 1])
blocks.b4_l2.se.fc1.conv_1.conv3d.bias : torch.Size([96])
blocks.b4_l2.se.fc2.conv_1.conv3d.weight : torch.Size([384, 96, 1, 1, 1])
blocks.b4_l2.se.fc2.conv_1.conv3d.bias : torch.Size([384])
blocks.b4_l2.project.conv_1.conv3d.weight : torch.Size([144, 384, 1, 1, 1])
blocks.b4_l2.project.conv_1.norm.weight : torch.Size([144])
blocks.b4_l2.project.conv_1.norm.bias : torch.Size([144])
blocks.b4_l3.alpha : torch.Size([])
blocks.b4_l3.expand.conv_1.conv3d.weight : torch.Size([480, 144, 1, 1, 1])
blocks.b4_l3.expand.conv_1.norm.weight : torch.Size([480])
blocks.b4_l3.expand.conv_1.norm.bias : torch.Size([480])
blocks.b4_l3.deep.conv_1.conv3d.weight : torch.Size([480, 1, 1, 5, 5])
blocks.b4_l3.deep.conv_1.norm.weight : torch.Size([480])
blocks.b4_l3.deep.conv_1.norm.bias : torch.Size([480])
blocks.b4_l3.se.fc1.conv_1.conv3d.weight : torch.Size([120, 480, 1, 1, 1])
blocks.b4_l3.se.fc1.conv_1.conv3d.bias : torch.Size([120])
blocks.b4_l3.se.fc2.conv_1.conv3d.weight : torch.Size([480, 120, 1, 1, 1])
blocks.b4_l3.se.fc2.conv_1.conv3d.bias : torch.Size([480])
blocks.b4_l3.project.conv_1.conv3d.weight : torch.Size([144, 480, 1, 1, 1])
blocks.b4_l3.project.conv_1.norm.weight : torch.Size([144])
blocks.b4_l3.project.conv_1.norm.bias : torch.Size([144])
blocks.b4_l4.alpha : torch.Size([])
blocks.b4_l4.expand.conv_1.conv3d.weight : torch.Size([480, 144, 1, 1, 1])
blocks.b4_l4.expand.conv_1.norm.weight : torch.Size([480])
blocks.b4_l4.expand.conv_1.norm.bias : torch.Size([480])
blocks.b4_l4.deep.conv_1.conv3d.weight : torch.Size([480, 1, 1, 5, 5])
blocks.b4_l4.deep.conv_1.norm.weight : torch.Size([480])
blocks.b4_l4.deep.conv_1.norm.bias : torch.Size([480])
blocks.b4_l4.se.fc1.conv_1.conv3d.weight : torch.Size([120, 480, 1, 1, 1])
blocks.b4_l4.se.fc1.conv_1.conv3d.bias : torch.Size([120])
blocks.b4_l4.se.fc2.conv_1.conv3d.weight : torch.Size([480, 120, 1, 1, 1])
blocks.b4_l4.se.fc2.conv_1.conv3d.bias : torch.Size([480])
blocks.b4_l4.project.conv_1.conv3d.weight : torch.Size([144, 480, 1, 1, 1])
blocks.b4_l4.project.conv_1.norm.weight : torch.Size([144])
blocks.b4_l4.project.conv_1.norm.bias : torch.Size([144])
blocks.b4_l5.alpha : torch.Size([])
blocks.b4_l5.expand.conv_1.conv3d.weight : torch.Size([480, 144, 1, 1, 1])
blocks.b4_l5.expand.conv_1.norm.weight : torch.Size([480])
blocks.b4_l5.expand.conv_1.norm.bias : torch.Size([480])
blocks.b4_l5.deep.conv_1.conv3d.weight : torch.Size([480, 1, 3, 3, 3])
blocks.b4_l5.deep.conv_1.norm.weight : torch.Size([480])
blocks.b4_l5.deep.conv_1.norm.bias : torch.Size([480])
blocks.b4_l5.se.fc1.conv_1.conv3d.weight : torch.Size([120, 480, 1, 1, 1])
blocks.b4_l5.se.fc1.conv_1.conv3d.bias : torch.Size([120])
blocks.b4_l5.se.fc2.conv_1.conv3d.weight : torch.Size([480, 120, 1, 1, 1])
blocks.b4_l5.se.fc2.conv_1.conv3d.bias : torch.Size([480])
blocks.b4_l5.project.conv_1.conv3d.weight : torch.Size([144, 480, 1, 1, 1])
blocks.b4_l5.project.conv_1.norm.weight : torch.Size([144])
blocks.b4_l5.project.conv_1.norm.bias : torch.Size([144])
blocks.b4_l6.alpha : torch.Size([])
blocks.b4_l6.expand.conv_1.conv3d.weight : torch.Size([576, 144, 1, 1, 1])
blocks.b4_l6.expand.conv_1.norm.weight : torch.Size([576])
blocks.b4_l6.expand.conv_1.norm.bias : torch.Size([576])
blocks.b4_l6.deep.conv_1.conv3d.weight : torch.Size([576, 1, 1, 3, 3])
blocks.b4_l6.deep.conv_1.norm.weight : torch.Size([576])
blocks.b4_l6.deep.conv_1.norm.bias : torch.Size([576])
blocks.b4_l6.se.fc1.conv_1.conv3d.weight : torch.Size([144, 576, 1, 1, 1])
blocks.b4_l6.se.fc1.conv_1.conv3d.bias : torch.Size([144])
blocks.b4_l6.se.fc2.conv_1.conv3d.weight : torch.Size([576, 144, 1, 1, 1])
blocks.b4_l6.se.fc2.conv_1.conv3d.bias : torch.Size([576])
blocks.b4_l6.project.conv_1.conv3d.weight : torch.Size([144, 576, 1, 1, 1])
blocks.b4_l6.project.conv_1.norm.weight : torch.Size([144])
blocks.b4_l6.project.conv_1.norm.bias : torch.Size([144])
conv7.conv_1.conv3d.weight : torch.Size([640, 144, 1, 1, 1])
conv7.conv_1.norm.weight : torch.Size([640])
conv7.conv_1.norm.bias : torch.Size([640])
classifier.0.conv_1.conv3d.weight : torch.Size([2048, 640, 1, 1, 1])
classifier.0.conv_1.conv3d.bias : torch.Size([2048])
classifier.3.conv_1.conv3d.weight : torch.Size([600, 2048, 1, 1, 1])
classifier.3.conv_1.conv3d.bias : torch.Size([600])

Process finished with exit code 0
$\endgroup$

1 Answer 1

2
$\begingroup$

You can add a conv layer before the pre-trained model (like an adapter) The added conv layer will be defined to match your input size and produce output that matches the original input size of the pre-trained model (you probably need to train the new first layer)

first_conv_layer = [nn.Conv2d(2, 3, kernel_size=3, stride=1, padding=1, dilation=1, groups=1, bias=True)]
first_conv_layer.extend(list(model.features))  
model.features= nn.Sequential(*first_conv_layer )  
output = model(x)

```
$\endgroup$
3
  • $\begingroup$ This is good way, but it will cancel out the pretrained weights which I don't want. $\endgroup$ Sep 1, 2021 at 10:02
  • $\begingroup$ The point here is that it wouldn't cancel the existing weights, just add few new weights with the new first layer (the previous first layer will stay as is). $\endgroup$ Sep 1, 2021 at 10:06
  • $\begingroup$ Yes, but it adds a layer with new random weights which is not pretrained weights, I want to use the layers with pretrained weights. I solved it by reducing one dimension of input channels by going into the pretrained model parameters, wherever it is showing incompatibility of input channels. $\endgroup$ Sep 2, 2021 at 5:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.