We provide correct dilated pre-trained ResNet and DenseNet (stride of 8) for semantic segmentation.
For dilation of DenseNet, we provide
All provided models have been verified.
This code is provided together with the paper
- Hang Zhang, Kristin Dana, Jianping Shi, Zhongyue Zhang, Xiaogang Wang, Ambrish Tyagi, Amit Agrawal. “Context Encoding for Semantic Segmentation” The IEEE Conference on Computer Vision and Pattern Recognition (CVPR) 2018
ResNet(block, layers, num_classes=1000, dilated=False, multi_grid=False, deep_base=True, norm_layer=<class 'torch.nn.modules.batchnorm.BatchNorm2d'>)¶
Dilated Pre-trained ResNet Model, which preduces the stride of 8 featuremaps at conv5.
- block (Block) – Class for the residual block. Options are BasicBlockV1, BottleneckV1.
- layers (list of python:int) – Numbers of layers in each block
- classes (int, default 1000) – Number of classification classes.
- dilated (bool, default False) – Applying dilation strategy to pretrained ResNet yielding a stride-8 model, typically used in Semantic Segmentation.
- norm_layer (object) – Normalization layer used in backbone network (default:
mxnet.gluon.nn.BatchNorm; for Synchronized Cross-GPU BachNormalization).
- 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.”
Defines the computation performed at every call.
Should be overridden by all subclasses.
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.