Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UNet decoder layers double conv might have logical errors #148

Open
ruiqic opened this issue Apr 30, 2023 · 1 comment
Open

UNet decoder layers double conv might have logical errors #148

ruiqic opened this issue Apr 30, 2023 · 1 comment

Comments

@ruiqic
Copy link

ruiqic commented Apr 30, 2023

In the UNet implementation, the layers are bugged due to how x2conv is defined.
Since the inner_channels parameter is not given, it is calculated as inner_channels = out_channels // 2 if inner_channels is None else inner_channels.
For instance, when initializing a decoder(in_channels=128, out_channels=64), the double convolutional layers will be Conv2d(128, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) and Conv2d(32, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False). I do not think going from 128 to 32 then to 64 channels is intended in the UNet.
An easy fix would be changing the definition of inner_channels in x2conv to be inner_channels = out_channels if inner_channels is None else inner_channels or inner_channels = in_channels if inner_channels is None else inner_channels.

If this is indeed a bug, I am surprised it was never caught. Let me know and I can make a pull request.

@LiNanyan2001
Copy link
Contributor

Hello ,I meet the same question. And I found bug in FCN and Segnet. Oh, troubled me a lot. The author didn't recurrent the model as same as the original paper ......

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants