Dilated Networks

We provide correct dilated pre-trained ResNet and DenseNet (stride of 8) for semantic segmentation. For dilation of DenseNet, we provide encoding.nn.DilatedAvgPool2d. All provided models have been verified.

Note

This code is provided together with the paper (coming soon), please cite our work.

ResNet

ResNet

class encoding.dilated.ResNet(block, layers, num_classes=1000)[source]

Dilated Pre-trained ResNet Model, which preduces the stride of 8 featuremaps at conv5.

Reference:

  • He, Kaiming, et al. “Deep residual learning for image recognition.” Proceedings of the IEEE conference on computer vision and pattern recognition. 2016.
  • Yu, Fisher, and Vladlen Koltun. “Multi-scale context aggregation by dilated convolutions.”

resnet18

encoding.dilated.resnet18(pretrained=False, **kwargs)[source]

Constructs a ResNet-18 model.

Parameters:pretrained (bool) – If True, returns a model pre-trained on ImageNet

resnet34

encoding.dilated.resnet34(pretrained=False, **kwargs)[source]

Constructs a ResNet-34 model.

Parameters:pretrained (bool) – If True, returns a model pre-trained on ImageNet

resnet50

encoding.dilated.resnet50(pretrained=False, **kwargs)[source]

Constructs a ResNet-50 model.

Parameters:pretrained (bool) – If True, returns a model pre-trained on ImageNet

resnet101

encoding.dilated.resnet101(pretrained=False, **kwargs)[source]

Constructs a ResNet-101 model.

Parameters:pretrained (bool) – If True, returns a model pre-trained on ImageNet

resnet152

encoding.dilated.resnet152(pretrained=False, **kwargs)[source]

Constructs a ResNet-152 model.

Parameters:pretrained (bool) – If True, returns a model pre-trained on ImageNet

DenseNet

DenseNet

class encoding.dilated.DenseNet(growth_rate=32, block_config=(6, 12, 24, 16), num_init_features=64, bn_size=4, drop_rate=0, num_classes=1000)[source]

Dilated Densenet-BC model class

Parameters:
  • growth_rate (int) - how many filters to add each layer (k in paper) –
  • block_config (list of 4 python:ints) –
  • num_init_features (int) –
  • bn_size (int) – (i.e. bn_size * k features in the bottleneck layer)
  • drop_rate (float) –
  • num_classes (int) –
Reference:
Huang, Gao, et al. “Densely Connected Convolutional Networks” CVPR 2017

densenet161

encoding.dilated.densenet161(pretrained=False, **kwargs)[source]

Densenet-161 model from “Densely Connected Convolutional Networks”

Parameters:pretrained (bool) – If True, returns a model pre-trained on ImageNet

densenet121

encoding.dilated.densenet121(pretrained=False, **kwargs)[source]

Densenet-121 model from “Densely Connected Convolutional Networks”

Parameters:pretrained (bool) – If True, returns a model pre-trained on ImageNet

densenet169

encoding.dilated.densenet169(pretrained=False, **kwargs)[source]

Densenet-169 model from “Densely Connected Convolutional Networks”

Parameters:pretrained (bool) – If True, returns a model pre-trained on ImageNet

densenet201

encoding.dilated.densenet201(pretrained=False, **kwargs)[source]

Densenet-201 model from “Densely Connected Convolutional Networks”

Parameters:pretrained (bool) – If True, returns a model pre-trained on ImageNet