hi,
I use pytorch to create model ,this model has dilation >2 layer ?
thanks!!
resnet101 = torchvision.models.resnet101(pretrained=True)
hi,
I use pytorch to create model ,this model has dilation >2 layer ?
thanks!!
resnet101 = torchvision.models.resnet101(pretrained=True)
All conv layers should have a dilation of (1, 1)
:
resnet101 = models.resnet101(pretrained=False)
for name, module in resnet101.named_modules():
if isinstance(module, nn.Conv2d):
print(name, module.dilation)
thanks!
If I want to set a dilation convolution of more than 2 in the last 2 blocks, and I want them to have a step size of 1, how can I change it?
You could change the dilation by simply assigning a new value to the module:
resnet101.layer4[2].conv1.dilation = (2, 2)
However, since the outputs might be used on a residual connection etc. you would have to make sure to provide the desired spatial size of the new output.