Hi!
I was using the DynamicUnet
model and I noticed that the number of channels in the decoder’s layers were not powers of two. For example, if you run the following code:
from fastai.vision.all import *
m = resnet34()
m = nn.Sequential(*list(m.children())[:-2])
tst = DynamicUnet(m, 3, (128,128), norm_type=None)
sizes = model_sizes(tst, (128, 128))
sizes
Your will see that sizes
is:
[torch.Size([1, 512, 4, 4]),
torch.Size([1, 512, 4, 4]),
torch.Size([1, 512, 4, 4]),
torch.Size([1, 512, 4, 4]),
torch.Size([1, 512, 8, 8]),
torch.Size([1, 384, 16, 16]),
torch.Size([1, 256, 32, 32]),
torch.Size([1, 96, 64, 64]),
torch.Size([1, 96, 128, 128]),
torch.Size([1, 96, 128, 128]),
torch.Size([1, 99, 128, 128]),
torch.Size([1, 99, 128, 128]),
torch.Size([1, 3, 128, 128])]
The layers with 384, 96, and 99 channels caught my attention. I was expecting powers of two.
This is due to the implementation of UnetBlock.
Is this a feature or a bug? or neither? What do you think?
Thanks!!