3D-SkipDenseSeg
3D-SkipDenseSeg copied to clipboard
up_block num_groups causes error
At segmentor_v1.py line 100 i think you have a potential bug:
Code:
up_block = nn.ConvTranspose3d(num_features, num_classes, kernel_size=2 ** (i + 1) + 2, stride=2 ** (i + 1), padding=1, groups=num_classes, bias=False)
Bug:
while iterating with your settings: config[0] = 6, growth rate = 16 and num_init_features = 32 you will get the following out channels of the Dense Layers:
- 48
- 64
- 80
- 96
- 112
- 128
Let's say, i want to segment into 9 classes, and you set up_block = nn.ConvTranspose3d(... groups=num_classes ...)
then in your code: num_features = 32 + 6 * 16
= 128 is correct for the first loop but 128 is not divisible by 9 and thus creating the following error: ValueError: in_channels must be divisible by groups
- Solution 1: remove the parameter
num_groups
and have more trainable parameters or - Solution 2: calculate the variables based on the num_classes so that the division works
Did i miss something?
If this is intentional, then you might not let the user have to find the correct parameters. You could calculate them based on the num_classes :slightly_smiling_face:
However, thanks for sharing :thumbsup: