Se_resnet50 with Unet


I would like to use se_resnet50 with the Unet, similar to what was used in the carvana challenge.
I understand that model_meta does not contain the cut,cut_lr for this model.

So I used the example given here to extract the encoder part.

The part I replaced for this is the simple_up component from lesson 14

simple_up = nn.Sequential(
nn.ConvTranspose2d(256, 1, 2, stride=2),

While trying to fit, I am getting the below error.

RuntimeError: Given transposed=1, weight of size [512, 256, 2, 2], expected input[8, 2048, 8, 8] to have 512 channels, but got 2048 channels instead

Can anyone confirm if this is the way to approach this? Am I doing something wrong?
cadene_model_ch3 = nn.Sequential(*list(children(model_cadene))[:-2], simple_up)

Hey, I am the author of the notebook linked. The carvana example in lesson 14 uses resnet34. If you look in my notebook at the layers just before the adaptive concat pool for resnet 34, the output channels are 512. However, for se_resnet50 the output channels are 2048. Hence the mismatch.

Things you could do:

  1. Have an additional convolutional layer converting 2048 channels to 512 channels.
  2. Change the first StdUpsample(512, 256) to StdUpsample(20148, 256).

Do note, this is not guaranteed to give you a higher performance. Hyper-parameters may need to be carefully selected and requires some experimentation. Have a closer look at what the carvana guys did, and maybe use the same hyper-parameters

1 Like

Thanks, changing stdupsample to (2048,256) did the trick.