Understanding Convolution for Semantic Segmentation
Recent advances in deep learning, especially deep convolutional neural networks (CNNs), have led to significant improvement over previous semantic segmentation systems. Here we show how to improve pixel-wise semantic segmentation by manipulating convolution-related operations that are of both theoretical and practical value. First, we design dense upsampling convolution (DUC) to generate pixel-level prediction, which is able to capture and decode more detailed information that is generally missing in bilinear upsampling. Second, we propose a hybrid dilated convolution (HDC) framework in the encoding phase. This framework 1) effectively enlarges the receptive fields (RF) of the network to aggregate global information; 2) alleviates what we call the "gridding issue" caused by the standard dilated convolution operation. We evaluate our approaches thoroughly on the Cityscapes dataset, and achieve a state-of-art result of 80.1 also have achieved state-of-the-art overall on the KITTI road estimation benchmark and the PASCAL VOC2012 segmentation task. Our source code can be found at https://github.com/TuSimple/TuSimple-DUC.READ FULL TEXT VIEW PDF
Semantic segmentation is the task of assigning a label to each pixel in ...
This paper proposes a new deep convolutional neural network (DCNN)
In this paper, we propose a novel SpatioTemporal convolutional Dense Net...
Recently, some approaches are proposed to harness deep convolutional net...
We consider the task of pixel-wise semantic segmentation given a small s...
Convolutional Neural Networks (CNNs) have been very successful at solvin...
Recent semantic segmentation methods exploit encoder-decoder architectur...
Understanding Convolution for Semantic Segmentation
Semantic segmentation aims to assign a categorical label to every pixel in an image, which plays an important role in image understanding and self-driving systems. The recent success of deep convolutional neural network (CNN) models [17, 26, 13] has enabled remarkable progress in pixel-wise semantic segmentation tasks due to rich hierarchical features and an end-to-end trainable framework [21, 31, 29, 20, 18, 3]. Most state-of-the-art semantic segmentation systems have three key components:1) a fully-convolutional network (FCN), first introduced in , replacing the last few fully connected layers by convolutional layers to make efficient end-to-end learning and inference that can take arbitrary input size; 2) Conditional Random Fields (CRFs), to capture both local and long-range dependencies within an image to refine the prediction map; 3) dilated convolution (or Atrous convolution), which is used to increase the resolution of intermediate feature maps in order to generate more accurate predictions while maintaining the same computational cost.
Since the introduction of FCN in , improvements on fully-supervised semantic segmentation systems are generally focused on two perspectives: First, applying deeper FCN models. Significant gains in mean Intersection-over-Union (mIoU) scores on PASCAL VOC2012 dataset  were reported when the 16-layer VGG-16 model  was replaced by a 101-layer ResNet-101  model ; using 152 layer ResNet-152 model yields further improvements . This trend is consistent with the performance of these models on ILSVRC  object classification tasks, as deeper networks generally can model more complex representations and learn more discriminative features that better distinguish among categories. Second, making CRFs more powerful. This includes applying fully connected pairwise CRFs  as a post-processing step , integrating CRFs into the network by approximating its mean-field inference steps [31, 20, 18] to enable end-to-end training, and incorporating additional information into CRFs such as edges  and object detections .
We are pursuing further improvements on semantic segmentation from another perspective: the convolutional operations for both decoding (from intermediate feature map to output label map) and encoding (from input image to feature map) counterparts. In decoding, most state-of-the-art semantic segmentation systems simply use bilinear upsampling (before the CRF stage) to get the output label map [18, 20, 3]
. Bilinear upsampling is not learnable and may lose fine details. Inspired by work in image super-resolution, we propose a method called dense upsampling convolution (DUC), which is extremely easy to implement and can achieve pixel-level accuracy: instead of trying to recover the full-resolution label map at once, we learn an array of upscaling filters to upscale the downsized feature maps into the final dense feature map of the desired size. DUC naturally fits the FCN framework by enabling end-to-end training, and it increases the mIOU of pixel-level semantic segmentation on the Cityscapes dataset  significantly, especially on objects that are relatively small.
, as it maintains the resolution and receptive field of the network by in inserting “holes”in the convolution kernels, thus eliminating the need for downsampling (by max-pooling or strided convolution). However, an inherent problem exists in the current dilated convolution framework, which we identify as “gridding”: as zeros are padded between two pixels in a convolutional kernel, the receptive field of this kernel only covers an area with checkerboard patterns - only locations with non-zero values are sampled, losing some neighboring information. The problem gets worse when the rate of dilation increases, generally in higher layers when the receptive field is large: the convolutional kernel is too sparse to cover any local information, since the non-zero values are too far apart. Information that contributes to a fixed pixel always comes from its predefined gridding pattern, thus losing a huge portion of information. Here we propose a simplehybrid dilation convolution (HDC) framework as a first attempt to address this problem: instead of using the same rate of dilation for the same spatial resolution, we use a range of dilation rates and concatenate them serially the same way as “blocks”in ResNet-101 . We show that HDC helps the network to alleviate the gridding problem. Moreover, choosing proper rates can effectively increases the receptive field size and improves the accuracy for objects that are relatively big.
We design DUC and HDC to make convolution operations better serve the need of pixel-level semantic segmentation. The technical details are described in Section 3 below. Combined with post-processing by Conditional Random Fields (CRFs), we show that this approach achieves state-of-the art performance on the Cityscapes pixel-level semantic labeling task, KITTI road estimation benchmark, and PASCAL VOC2012 segmentation task.
Decoding of Feature Representation:
In the pixel-wise semantic segmentation task, the output label map has the same size as the input image. Because of the operation of max-pooling or strided convolution in CNNs, the size of feature maps of the last few layers of the network are inevitably downsampled. Multiple approaches have been proposed to decode accurate information from the downsampled feature map to label maps. Bilinear interpolation is commonly used[18, 20, 3], as it is fast and memory-efficient. Another popular method is called deconvolution, in which the unpooling operation, using stored pooling switches from the pooling step, recovers the information necessary for feature visualization . In , a single deconvolutional layer is added in the decoding stage to produce the prediction result using stacked feature maps from intermediate layers. In , multiple deconvolutional layers are applied to generate chairs, tables, or cars from several attributes. Noh et al.  employ deconvolutional layers as mirrored version of convolutional layers by using stored pooled location in unpooling step.  show that coarse-to-fine object structures, which are crucial to recover fine-detailed information, can be reconstructed along the propagation of the deconvolutional layers. Fischer at al.  use a similar mirrored structure, but combine information from multiple deconvolutional layers and perform upsampling to make the final prediction.
Dilated Convolution: Dilated Convolution (or Atrous convolution) was originally developed in algorithme à trous for wavelet decomposition 
. The main idea of dilated convolution is to insert “holes”(zeros) between pixels in convolutional kernels to increase image resolution, thus enabling dense feature extraction in deep CNNs. In the semantic segmentation framework, dilated convolution is also used to enlarge the field of convolutional kernels. Yu & Koltun use serialized layers with increasing rates of dilation to enable context aggregation, while  design an “atrous spatial pyramid pooling (ASPP)”scheme to capture multi-scale objects and context information by placing multiple dilated convolution layers in parallel. More recently, dilated convolution has been applied to a broader range of tasks, such as object detection , optical flow , and audio generation .
Suppose an input image has height , width , and color channels , and the goal of pixel-level semantic segmentation is to generate a label map with size where each pixel is labeled with a category label. After feeding the image into a deep FCN, a feature map with dimension is obtained at the final layer before making predictions, where , , and is the downsampling factor. Instead of performing bilinear upsampling, which is not learnable, or using deconvolution network (as in ), in which zeros have to be padded in the unpooling step before the convolution operation, DUC applies convolutional operations directly on the feature maps to get the dense pixel-wise prediction map. Figure 1 depicts the architecture of our network with a DUC layer.
The DUC operation is all about convolution, which is performed on the feature map from ResNet of dimension to get the output feature map of dimension , where is the total number of classes in the semantic segmentation task. Thus each layer of the dense convolution is learning the prediction for each pixel. The output feature map is then reshaped to
with a softmax layer, and an elementwiseargmax
operator is applied to get the final label map. In practice, the “reshape” operation may not be necessary, as the feature map can be collapsed directly to a vector to be fed into the softmax layer. The key idea of DUC is to divide the whole label map into equalsubparts which have the same height and width as the incoming feature map. This is to say, we transform the whole label map into a smaller label map with multiple channels. This transformation allows us to apply the convolution operation directly between the input feature map and the output label maps without the need of inserting extra values in deconvolutional networks (the “unpooling”operation).
Since DUC is learnable, it is capable of capturing and recovering fine-detailed information that is generally missing in the bilinear interpolation operation. For example, if a network has a downsample rate of , and an object has a length or width less than 16 pixels (such as a pole or a person far away), then it is more than likely that bilinear upsampling will not be able to recover this object. Meanwhile, the corresponding training labels have to be downsampled to correspond with the output dimension, which will already cause information loss for fine details. The prediction of DUC, on the other hand, is performed at the original resolution, thus enabling pixel-level decoding. In addition, the DUC operation can be naturally integrated into the FCN framework, and makes the whole encoding and decoding process end-to-end trainable.
In 1-D, dilated convolution is defined as:
where is the input signal, is the output signal , denotes the filter of length , and corresponds to the dilation rate we use to sample . In standard convolution, .
In a semantic segmentation system, 2-D dilated convolution is constructed by inserting “holes”(zeros) between each pixel in the convolutional kernel. For a convolution kernel with size , the size of resulting dilated filter is , where . Dilated convolution is used to maintain high resolution of feature maps in FCN through replacing the max-pooling operation or strided convolution layer while maintaining the receptive field (or “field of view”in ) of the corresponding layer. For example, if a convolution layer in ResNet-101 has a stride , then the stride is reset to to remove downsampling, and the dilation rate is set to 2 for all convolution kernels of subsequent layers. This process is applied iteratively through all layers that have a downsampling operation, thus the feature map in the output layer can maintain the same resolution as the input layer. In practice, however, dilated convolution is generally applied on feature maps that are already downsampled to achieve a reasonable efficiency/accuracy trade-off .
However, one theoretical issue exists in the above dilated convolution framework, and we call it “gridding”(Figure 2): For a pixel in a dilated convolutional layer , the information that contributes to pixel comes from a nearby region in layer centered at . Since dilated convolution introduces zeros in the convolutional kernel, the actual pixels that participate in the computation from the region are just , with a gap of between them. If , only 9 out of 25 pixels in the region are used for the computation (Figure 2 (a)). Since all layers have equal dilation rates , then for pixel in the top dilated convolution layer , the maximum possible number of locations that contribute to the calculation of the value of is where are the width and height of the bottom dilated convolution layer, respectively. As a result, pixel can only view information in a checkerboard fashion, and lose a large portion (at least when ) of information. When becomes large in higher layers due to additional downsampling operations, the sample from the input can be very sparse, which may not be good for learning because 1) local information is completely missing; 2) the information can be irrelevant across large distances. Another outcome of the gridding effect is that pixels in nearby regions at layer receive information from completely different set of “grids”， which may impair the consistency of local information.
Here we propose a simple solution- hybrid dilated convolution (HDC), to address this theoretical issue. Suppose we have convolutional layers with kernel size that have dilation rates of , the goal of HDC is to let the final size of the RF of a series of convolutional operations fully covers a square region without any holes or missing edges. We define the “maximum distance between two nonzero values” as
with . The design goal is to let . For example, for kernel size , an pattern works as ; however, an pattern does not work as
. Practically, instead of using the same dilation rate for all layers after the downsampling occurs, we use a different dilation rate for each layer. In our network, the assignment of dilation rate follows a sawtooth wave-like heuristic: a number of layers are grouped together to form the “rising edge”of the wave that has an increasing dilation rate, and the next group repeats the same pattern. For example, for all layers that have dilation rate, we form 3 succeeding layers as a group, and change their dilation rates to be 1, 2, and 3, respectively. By doing this, the top layer can access information from a broader range of pixels, in the same region as the original configuration (Figure 2 (b)). This process is repeated through all layers, thus making the receptive field unchanged at the top layer.
Another benefit of HDC is that it can use arbitrary dilation rates through the process, thus naturally enlarging the receptive fields of the network without adding extra modules , which is important for recognizing objects that are relatively big. One important thing to note, however, is that the dilation rate within a group should not have a common factor relationship (like 2,4,8, etc.), otherwise the gridding problem will still hold for the top layer. This is a key difference between our HDC approach and the atrous spatial pyramid pooling (ASPP) module in , or the context aggregation module in , where dilation factors that have common factor relationships are used. In addition, HDC is naturally integrated with the original layers of the network, without any need to add extra modules as in [29, 3].
. We use ResNet-101 or ResNet-152 networks that have been pretrained on the ImageNet dataset as a starting point for all of our models. The output layer contains the number of semantic categories to be classified depending on the dataset (including background, if applicable). We use the cross-entropy error at each pixel over the categories. This is then summed over all pixel locations of the output map, and we optimize this objective function using standard Stochastic Gradient Descent (SGD). We use MXNet to train and evaluate all of our models on NVIDIA TITAN X GPUs.
The Cityscapes Dataset is a large dataset that focuses on semantic understanding of urban street scenes. The dataset contains 5000 images with fine annotations across 50 cities, different seasons, varying scene layout and background. The dataset is annotated with 30 categories, of which 19 categories are included for training and evaluation (others are ignored). The training, validation, and test set contains 2975, 500, and 1525 fine images, respectively. An additional 20000 images with coarse (polygonal) annotations are also provided, but are only used for training.
We use the DeepLab-V2  ResNet-101 framework to train our baseline model. Specifically, the network has a downsampling rate of 8, and dilated convolution with rate of 2 and 4 are applied to res4b and res5b blocks, respectively. An ASPP module with dilation rate of 6, 12, 18, and 24 is added on top of the network to extract multiscale context information. The prediction maps and training labels are downsampled by a factor of 8 compared to the size of original images, and bilinear upsampling is used to get the final prediction. Since the image size in the Cityscapes dataset is , which is too big to fit in the GPU memory, we partition each image into twelve patches with partial overlapping, thus augmenting the training set to have images. This data augmentation strategy is to make sure all regions in an image can be visited. This is an improvement over random cropping, in which nearby regions may be visited repeatedly.
We train the network using mini-batch SGD with patch size (randomly cropped from the patch) and batch size 12, using multiple GPUs. The initial learning rate is set to , and a “poly”learning rate (as in ) with is applied. Weight decay is set to , and momentum is
. The network is trained for 20 epochs and achieves mIoU ofon the validation set.
We examine the effect of DUC on the baseline network. In DUC， the only thing we change is the shape of the top convolutional layer. For example, if the dimension of the top convolutional layer is in the baseline model (19 is the number of classes), then the dimension of the same layer for a network with DUC will be where is the total downsampling rate of the network ( in this case). The prediction map is then reshaped to size . DUC will introduce extra parameters compared to the baseline model, but only at the top convolutional layer. We train the ResNet-DUC network the same way as the baseline model for 20 epochs, and achieve a mean IOU of on the validation set, a increase compared to the baseline model. Visualization of the result of ResNet-DUC and comparison with the baseline model is shown in Figure 3
From Figure 3, we can clearly see that DUC is very helpful for identifying small objects, such as poles, traffic lights, and traffic signs. Consistent with our intuition, pixel-level dense upsampling can recover detailed information that is generally missed by bilinear interpolation.
Ablation Studies We examine the effect of different settings of the network on the performance. Specifically, we examine: 1) the downsampling rate of the network, which controls the resolution of the intermediate feature map; 2) whether to apply the ASPP module, and the number of parallel paths in the module; 3) whether to perform 12-fold data augmentation; and 4) cell size, which determines the size of neighborhood region () that one predicted pixel projects to. Pixel-level DUC should use ; however, since the ground-truth label generally cannot reach pixel-level precision, we also try in the experiments. From Table 1， we can see that making the downsampling rate smaller decreases the accuracy. Also it significantly raises the computational cost due to the increasing resolution of the feature maps. ASPP generally helps to improve the performance, and increasing ASPP channels from 4 to 6 (dilation rate 6 to 36 with interval 6) yields a boost. Data augmentation helps to achieve another improvement. Using yields slightly better performance when compared with , and it helps to reduce computational cost by decreasing the channels of the last convolutional layer by a factor of 4.
Bigger Patch Size Since setting reduces GPU memory cost for network training, we explore the effect of patch size on the performance. Our assumption is that, since the original images are all , the network should be trained using patches as big as possible in order to aggregate both local detail and global context information that may help learning. As such, we make the patch size to be , and set the batch size to be 1 on each of the 4 GPUs used in training. Since the patch size exceeds the maximum dimension () in the previous 12-fold data augmentation framework, we adopt a new 7-fold data augmentation strategy: seven center locations with , are set in the original image; for each center location, a patch is obtained by randomly setting its center within a rectangle area centered at each center. This strategy makes sure that we can sample all areas in the image, including edges. Training with a bigger patch size boosts the performance to 75.7%, a improvement over the previous best result.
Compared with Deconvolution We compare our DUC model with deconvolution, which also involves learning for upsampling. Particularly, we compare with 1) direct deconvolution from the prediction map (dowsampled by 8) to the original resolution; 2) deconvolution with an upsampling factor of 2 first, followed by an upsampling factor of 4. We design the deconv network to have approximately the same number of parameters as DUC. We use the ResNet-DUC bigger patch model to train the networks. The above two models achieve mIOU of and , respectively, lower than the ResNet-DUC model ( mIoU).
Conditional Random Fields (CRFs) Fully-connected CRFs  are widely used for improving semantic segmentation quality as a post-processing step of an FCN . We follow the formation of CRFs as shown in . We perform a grid search on parameters on the validation set, and use , , , , and for all of our models. Applying CRFs to our best ResNet-DUC model yields an mIoU of , a improvement over the model does not use CRFs.
We use the best 101 layer ResNet-DUC model as a starting point of applying HDC. Specifically, we experiment with several variants of the HDC module:
No dilation: For all ResNet blocks containing dilation, we make their dilation rate (no dilation).
Dilation-conv: For all blocks contain dilation, we group every 2 blocks together and make for the first block, and for the second block.
Dilation-RF: For the module that contains 23 blocks with dilation rate , we group every 3 blocks together and change their dilation rates to be 1, 2, and 3, respectively. For the last two blocks, we keep . For the module which contains 3 blocks with dilation rate , we change them to 3, 4, and 5, respectively.
Dilation-bigger: For module, we group every 4 blocks together and change their dilation rates to be 1, 2, 5, and 9, respectively. The rates for the last 3 blocks are 1, 2, and 5. For module, we set the dilation rates to be 5, 9, and 17.
The result is summarized in Table 2. We can see that increasing receptive field size generally yields higher accuracy. Figure 5 illustrates the effectiveness of the ResNet-DUC-HDC model in eliminating the gridding effect. A visualization result is shown in Figure 4. We can see our best ResNet-DUC-HDC model performs particularly well on objects that are relatively big.
|Network||RF increased||mIoU (without CRF)|
Deeper Networks We have also tried replacing our ResNet-101 based model with the ResNet-152 network, which is deeper and achieves better performance on the ILSVRC image classification task than ResNet-101 
. Due to the network difference, we first train the ResNet-152 network to learn the parameters in all batch normalization (BN) layers for 10 epochs, and continue fine-tuning the network by fixing these BN parameters for another 20 epochs. The results are summarized in Table3. We can see that using the deeper ResNet-152 model generally yields better performance than the ResNet-101 model.
Our results on the Cityscapes test set are summarized in Table 4. There are separate entries for models trained using fine-labels only, and using a combination of fine and coarse labels. Our ResNet-DUC-HDC model achieves mIoU using fine data only. Adding coarse data help us achieve 78.5% mIoU.
In addition, inspired by the design of the VGG network , in that a single convolutional layer can be decomposed into two adjacent convolutional layers to increase the expressiveness of the network while maintaining the receptive field size, we replaced the convolutional layer in the original ResNet-101 network by three convolutional layers. By retraining the updated network, we achieve a mIoU of 80.1% on the test set using a single model without CRF post-processing. Our result achieves the state-of-the-art performance on the Cityscapes dataset at the time of submission. Compared with the strong baseline of Chen et al. , we improve the mIoU by a significant margin (), which demonstrates the effectiveness of our approach.
Dataset The KITTI road segmentation task contains images of three various categories of road scenes, including 289 training images and 290 test images. The goal is to decide if each pixel in images is road or not. It is challenging to use neural network based methods due to the limited number of training images. In order to avoid overfitting, we crop patches of pixels with a stride of pixels from the training images, and use the ResNet-101-DUC model pretrained from ImageNet during training. Other training settings are the same as Cityscapes experiment. We did not apply CRFs for post-processing.
Results We achieve the state-of-the-art results at the time of submission without using any additional information of stereo, laser points and GPS. Specifically, our model attains the highest maximum F1-measure in the sub-categories of urban unmarked (UU_ROAD), urban multiple marked (UMM_ROAD) and the overall category URBAN_ROAD of all sub-categories, the highest average precision across all three sub-categories and the overall category by the time of submission of this paper. Examples of visualization results are shown in Figure 6. The detailed results are displayed in Table 5 111For thorough comparison with other methods, please check http://www.cvlibs.net/datasets/kitti/eval_road.php..
Dataset The PASCAL VOC2012 segmentation benchmark contains training images, validation images, and test images. Using the extra annotations provided by , the training set is augmented to have images. The dataset has 20 foreground object categories and 1 background class with pixel-level annotation.
Results We first pretrain our 152 layer ResNet-DUC model using a combination of augmented VOC2012 training set and MS-COCO dataset , and then finetune the pretrained network using augmented VOC2012 trainval set. We use patch size (zero-padded) throughout training. All other training strategies are the same as Cityscapes experiment. We achieve mIOU of 83.1% on the test set using a single model without any model ensemble or multiscale testing, which is the best-performing method at the time of submission222Result link: http://host.robots.ox.ac.uk:8080/anonymous/LQ2ACW.html. The detailed results are displayed in Table 6, and the visualizations are shown in Figure 7.
We propose simple yet effective convolutional operations for improving semantic segmentation systems. We designed a new dense upsampling convolution (DUC) operation to enable pixel-level prediction on feature maps, and hybrid dilated convolution (HDC) to solve the gridding problem, effectively enlarging the receptive fields of the network. Experimental results demonstrate the effectiveness of our framework on various semantic segmentation tasks.
We thank the members of TuSimple and Gary’s Unbelievable Research Unit (GURU) for comments on this work. GWC was supported in part by Guangzhou Science and Technology Planning Project (201704030051) and NSF cooperative agreement SMA 1041755 to the Temporal Dynamics of Learning Center, an NSF Science of Learning Center.
The cityscapes dataset for semantic urban scene understanding.In , 2016.
Conditional random fields as recurrent neural networks.In Proceedings of the IEEE International Conference on Computer Vision, pages 1529–1537, 2015.