Hi!
|
conv_type(self.in_planes, planes * block.expansion, kernel_size=1, stride=stride), |
In the above line in the implementation of the ResNet, the downsampling layer is not expected to have a bias parameter (bias=True by default). The argument is explicitly set to False in the 2D torchvision, the 3D MedicalNet paper and the kenshohara implementations on which it is based. Is there any particular reason why bias is not set to False?
To reproduce
If we compare the implementations for a 3D and 2D resnet18:
from torchvision import models
from monai.networks import nets
d2net_torch = models.resnet18()
d2net_monai = nets.resnet18(spatial_dims=2)
d3net_monai = nets.resnet18(spatial_dims=3)
len(list(d2net_torch.parameters())), len(list(d2net_monai.parameters())), len(list(d3net_monai.parameters()))
# 62, 65, 65
The 2D implementation of the ResNet does not match the torch implementation due to the same reason. The same occurs for other deeper resnet variants.
What do you guys think? If this is something that needs fixing, I'd be happy to work on it.
Hi!
MONAI/monai/networks/nets/resnet.py
Line 280 in b05ef9c
In the above line in the implementation of the ResNet, the downsampling layer is not expected to have a bias parameter (
bias=Trueby default). The argument is explicitly set to False in the 2D torchvision, the 3D MedicalNet paper and the kenshohara implementations on which it is based. Is there any particular reason whybiasis not set to False?To reproduce
If we compare the implementations for a 3D and 2D resnet18:
The 2D implementation of the ResNet does not match the torch implementation due to the same reason. The same occurs for other deeper resnet variants.
What do you guys think? If this is something that needs fixing, I'd be happy to work on it.