IanTaehoonYoo / semantic-segmentation-pytorch

Pytorch implementation of FCN, UNet, PSPNet, and various encoder models.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Skip layer connections from the second layer

zhou-rui1 opened this issue · comments

Hi, when I try to edit the unet to unet++, it seems that the horizontal connections are only added from the second layer, and the last output layer is up-sampled by one layer to restore the dimensions, which is not the same as the original model.

is this for the design to use the pretrained model?

With great appreciation!

Hi, and plus...how did you get the channel calculation function for unet to adapt to different backbones...I have trouble when I change the structure to unet++

b4448e4858a2e98ffa95a7837094837
a4e328ff89f292e4f115a1ecf1ee885

Hi, Zhou
It's different between your snapshot and my code. The 'get_last_out_channels' function gets the last channel of features. So you don't need 'cfi_idx' in 'get_last_out_channels' and reconsider to use 'self.features[cfi_idx] as features'.
Also, I checked my code and the unet is working as the original model.
스크린샷 2021-08-02 오후 2 38 46

스크린샷 2021-08-02 오후 2 39 55

Thanks,

Thanks for your reply!
Yes, I found out that this is because the first layer of vgg is divided into two layers in resnet....
b5039c459e846a03cadb47536a30144

I change 'get_last_out_channels' to plus the number of channels added by the unet++ dense connection, and it seems I am unable to get a channel calculation function like you designed for unet, thus I can not change the backbones directly
407acfa95724f4ecae4fd29b8d2ecb5

but if use 'self.features[cfi_idx] as features', the features are backbone