Semantic image segmentation amounts to predicting the category of individual pixels in an image, which has been one of the most active topics in the field of image understanding and computer vision for a long time. Most of the recently proposed approaches to this task are based on deep convolutional networks. Particularly, the fully convolutional network (FCN)
is efficient and at the same time has achieved the state-of-the-art performance. By reusing the computed feature maps for an image, FCN avoids redundant re-computation for classifying individual pixels in the image. FCN becomes the defacto approach to dense prediction and methods were proposed to further improve this framework, e.g., the DeepLab, and the Adelaide-Context model 
. One key reason for the success of these methods is that they are based on rich features learned from the very large ImageNet dataset, often in the form of a 16-layer VGGNet . However, currently, there exist much improved models for image classification, e.g., the ResNet [6, 7].
To the best of our knowledge, building FCNs using ResNets is still an open topic to study on. These networks are so deep that we would inevitably be faced with the limitation of GPU memories. Besides, there are some aspects of the framework of FCN, which need to be explored carefully, such as the size of field-of-view , the resolution of feature maps, and the sampling strategies during training. Based on the above consideration, here we attempt to fulfill the missing part of this topic.
In summary, we highlight the main contributions of this work as follows:
We extensively evaluate different variations of a fully convolutional residual network so as to find the best configuration, including the number of layers, the resolution of feature maps, and the size of field-of-view.
We empirically demonstrate that enlarging the field-of-view and increasing the resolution of feature maps are in general beneficial. However, this inevitably leads to a higher demand for GPU memories. To solve this difficulty, we propose a new method to simulate a high resolution network with a low resolution network, which can be applied during training and/or testing.
We propose an online bootstrapping method for training. We show that online bootstrapping is critically important in achieving the best performance.
We apply dropout regularisation to some of the residual blocks, which further improves the performance. Our method achieves the currently best results on VOC and Cityscapes datasets. We achieve an mean intersection-over-union score on VOC of 78.3% on the PASCAL VOC 2012, which is a new record111http://host.robots.ox.ac.uk:8080/anonymous/W382GA.html .
2 Related work
In this section we briefly review the recent development of research on three topics, which are closely related to this paper.
Very deep convolutional networks. The recent boom of deep convolution networks was originated when Krizhevsky et al.  won the first place in the ILSVRC 2012 competition  with the 8-layer AlexNet. The next year’s method ‘Clarifai’  still had the same number of layers. However, in 2014, the VGGNets  were composed of up to nineteen layers, while the even deeper 22-layer GoogLeNet  won the competition . In 2015, the much deeper ResNets  achieved the best performance , showing deeper networks indeed learn better features. Nevertheless, the most impressive part was that He et al.  won in the object detection task with an overwhelming margin, by replacing the VGGNets in Fast RCNN  with their ResNets, which shows the importance of features in image understanding tasks.
The main contribution that enables them to train so deep networks is that they connect some of the layers with shortcuts, which directly pass through the signals and can thus avoid the vanishing gradient effect which may be a problem for very deep plain networks. In a more recent work, they redesigned their residual blocks to avoid over-fitting, which enabled them to train an even deeper 200-layer residual network. Deep ResNets can be seen as a simplified version of the highway network .
Fully convolutional networks for semantic segmentation. Long et al.  first proposed the framework of FCN for semantic segmentation, which is both effective and efficient. They also enhanced the final feature maps with those from intermediate layers, which enables their model to make finer predictions. Chen et al.  increased the resolution of feature maps by spontaneously removing some of the down-sampling operations and accordingly introducing kernel dilation into their networks. They also found that a classifier composed of small kernels with a large dilation performed as well as a classifier with large kernels, and that reducing the size of field-of-view had an adverse impact on performance. As post-processing, they applied dense CRFs to refine the predicted category score maps for further improvement.
Zheng et al. 
simulate the dense CRFs with an recurrent neural network (RNN), which can be trained end-to-end together with the down-lying convolution layers. Lin et al. jointly trained CRFs with down-lying convolution layers, thus they are able to capture both ‘patch-patch’ and ‘patch-background’ context with CRFs, rather than just pursue local smoothness as most of the previous methods do.
Online bootstrapping for training deep convolutional networks. There are some recent works in the literature exploring sampling methods during training, which are concurrent with ours. Loshchilov and Hutter  studied mini-batch selection in terms of image classification. They picked hard training images from the whole training set according to their current losses, which were lazily updated once an image had been forwarded through the network being trained. Shrivastava et al.  proposed to select hard region-of-interests (RoIs) for object detection. They only computed the feature maps of an image once, and forwarded all RoIs of the image on top of these feature maps. Thus they are able to find the hard RoIs with a small extra computational cost.
The method of  is similar to ours in the sense that they all select hard training samples based on the current losses of individual data-points. However, we only search hard pixels within the current mini-batch, rather than the whole training set. In this sense, the method of  is more similar to ours. To our knowledge, our method is the first to propose online bootstrapping of hard pixel samples for the problem of semantic image segmentation.
3 Our method
We first explain how to construct our baseline fully convolutional residual network (FCRN) based on existing works in the literature, mainly, the fully convolutional network (FCN)  and the ResNet . Then, we demonstrate how we can walk around the limitation on GPU memories when training a very large network, and finally introduce our method that applies online bootstrapping.
3.1 Fully convolutional residual network
We initialize a fully convolutional residual network from the original version of ResNet  but not the newly proposed full pre-activation version . From an original ResNet, we replace the linear classification layer with a convolution layer so as to make one prediction per spatial location. Besides, we also remove the 77 pooling layer. This layer can enlarge the field-of-view (FoV)  of features, which is sometimes useful considering the fact that we human usually tell the category of a pixel by referring to its surrounding context region. However, this pooling layer at the same time smoothes the features. In pixel labeling tasks, features of adjacent pixels should be distinct from each other when they respectively belong to different categories, which may conflict with the pooling layer. Therefore we remove this layer and let the linear convolution layer on top deal with the FoV.
By now, the feature maps below the added linear convolution layer only has a resolution of 1/32, which is apparently too low to precisely discriminate individual pixels. Long et al.  learned extra up-sampling layers to deal with this problem. However, Chen et al.  reported that the hole algorithm (or the àtrous algorithm by Mallat ) can be more efficient. Intuitively, the hole algorithm can be seen as dilating the convolution kernels before applying them to their input feature maps. With this technique, we can build up a new network generating feature maps of any higher resolution, without changing the weights. When there is a layer with down-sampling, we skip the down-sampling part and increase the dilations of subsequent convolution kernels accordingly. Refer to DeepLab  for a graphical explanation.
A sufficiently large FoV was reported to be important by Chen et al. . Intuitively, we need to present context information of a pixel to the top-most classification layer. However, the features at different locations should be discriminative at the same time so that the classifier can tell the differences between adjacent pixels which belong to different categories. Therefore, a natural way is to let the classifier to handle the FoV, which can be achieved by enlarging its kernel size. Unfortunately, the required size can be so large that it can blow up the number of parameters in the classifier. Nevertheless, we can resort to the hole algorithm again. Thus we can use small kernels with large dilations in order to realize a large FoV.
In summary, following the above three steps, we design the baseline FCRN. Although the ResNet has shown its advantages in terms of many tasks due to much richer learned features, we observe that our baseline FCRN is not powerful enough to beat the best algorithm for semantic segmentation , which is based on the VGGNet .
3.2 Training of a large network with limited GPU memories
The limitation of GPU memories is one of the key problems during training of an FCN, and as well as an FCRN. There are at least two reasons to use more memories during training.
To enlarge the FoV. It was reported by Chen et al.  that reducing the size of FoV from 224 down to 128 has an adverse impact on the performance of an FCN in terms of semantic segmentation. What is more, we find that 224 is yet smaller than the optimal size. To support an even larger FoV, we have to feed a network with larger input images, which may fire the limitation on GPU memories.
To train with a high resolution. Many of the previous works [1, 2] made predictions on top of feature maps with a resolution of either 1/16 or 1/8. However, we find that a finer resolution of 1/4 can further improve the performance. More importantly, although the models trained with different resolutions have the same number of parameters, we can usually obtain a better model by training with a higher resolution. Let be a network trained with a resolution of 1/16, while be trained with 1/8. Intuitively, we anticipate that would outperform , which is usually true since makes predictions at a higher resolution. This comparison seems not that fair for . Therefore, we also test at a resolution of 1/8. Nevertheless, the margin between and usually cannot be completely removed, according to our experiments. In this sense, is still better than in the fairer comparison. But unfortunately, increasing the resolution from 1/8 to 1/4 leads to four times larger feature maps, which may well exceed current available GPU memories.
To this end, we modify the implementation of batch normalization
in Caffe to apply a more conservative strategy in using GPU memories. Then, we follow He et al.
to fix the means and variances in all batch normalization layers, which turns them into simple linear transformations. Third, we reduce the number of images per mini-batch, which shows no adverse impact in our preliminarily experiments. However, with these modifications, it is still not feasible to train a very deep FCRN with both large FoV and high resolutions.
One trivial approach is to feed a model with multiple small crops of the same image one by one, and do not update the weights until gradients of all the crops have been aggregated. However, there is still a compromise between large FoV and high resolution in this method. With larger crops (to ensure large FoV), we will have to lower the resolution of feature maps. On the other hand, with higher resolutions, we will have to reduce the size of each crop.
To break this dilemma, we show how to simulate a high resolution model with a low resolution model. We show an example in Fig. 1. Suppose that we can indeed train a network whose score map resolution is 1/8 of the original input images, while we are not able to train a 1/4 resolution one due to limited GPU memories.
So we resort to the 1/8 resolution model. In the first pass, we feed the model with an image, which is large. The feature maps will be down-sampled to 1/8 resolution at some intermediate layer, as depicted by the solid blue lines. Naturally, the predicted score maps will also be at a resolution of 1/8. During training, we only compute the loss and back-forward the gradients, but do not update the weights yet. Here starts the second pass. This time, before down-sampling, we first shift the 1/4 resolution feature maps horizontally with a stride of one, so that the obtained 1/8 resolution feature maps are different from those in the first pass. We do not update the weights until we finish the third and forth passes. During testing, the idea is similar. We only put the obtained scores in four passes into their corresponding locations on 1/4 resolution scores maps.
3.3 Online bootstrapping of hard training pixels
When we train an FCN, depending on the size of image crops, there may be thousands of labeled pixels to predict per crop. However, sometimes many of them can easily be discriminated from others, especially for those lying at the central part of a large semantic region. Keeping on learning from these pixels can hardly improve the objective of semantic segmentation. Based on the above consideration, we propose an online bootstrapping method, which forces networks to focus on hard (and so more valuable) pixels during training.
Let there be different categories in a label space. For simplicity, suppose that there is only one image crop per mini-batch, and let there be pixels to predict in this crop. Let denote the ground truth label of pixel , and
denote the predicted probability of pixelbelonging to category
. Then, the loss function can be defined as,
where is a threshold. Here equals one when the condition inside holds, and otherwise equals zero. In practice, we hope that there should be at least a reasonable number of pixels kept per mini-batch. Hence, we will increase the threshold accordingly if the current model performs pretty well on a specific mini-batch.
The PASCAL VOC 2012 dataset for semantic segmentation consists of photos taken in human daily life. Besides the background category, there are twenty semantic categories to be predicted, including bus, car, cat, sofa, monitor, etc. There are 1,464 fully labeled images for training (the train set) and another 1,449 for validating (the val set). The ground-truth labels of the 1,456 images for testing (the test set) are not public, but there is an online evaluation server. Following the conventional setting in the literature [1, 2], we augment the train set with extra labeled PASCAL VOC images from the semantic boundaries dataset . So, in total there will be 10,582 for training. The side lengths of images in this dataset are always no larger than 500 pixels.
The Cityscapes dataset consists of street scene images taken by car-carried cameras. There are nineteen semantic categories to be predicted, including road, car, pedestrian, bicycle, etc. There are 2975 fully labeled images for training (the train set) and another 500 for validating (the val set). The ground-truth labels of images for testing (the test set) are not public, but there is an online evaluation server. All of the images in this dataset are in the same size. They are 1024 pixels high and 2048 pixels wide.
For evaluation, we report:
(1) the pixel accuracy, which is the percentage of correctly labeled pixels on a whole test set;
(2) the mean pixel accuracy, which is the mean of class-wise pixel accuracies, and
(3) the mean class-wise intersection over union (IoU) scores.Note that we only show these three scores when it is possible for the individual datasets. For example, only the mean IoU is available for the test set of PASCAL VOC 2012.
4.2 Implementation details
We implement our method based on Caffe , and initialize fully convolutional residual networks (FCRN) with the ResNet-50, ResNet-101 and ResNet-152 released by He et al. . We evaluate the hyper-parameters of SGD using the validation sets of PASCAL VOC 2012 and Cityscapes. We also apply random resizing and cropping to the original images to augment the training data.
4.3 Results of the vanilla FCRN
In this subsection we investigate the impact of several configurations on the performance of a vanilla FCRN, which include the network depth, the resolution of feature maps, the kernel size and dilation of the top-most classifier in the FCRN.
We show results on the val set of PASCAL VOC 2012 in Table 1. Firstly, we can achieve a significant improvement by increasing the depth from 50 to 101. However, we observe clear over-fitting when increasing the depth to 152.
Secondly, generating feature maps with a higher resolution is also helpful. Unfortunately, it is not easy to further increasing the resolution due to the limitation on GPU memories. Thirdly, further increasing the size of FoV up to more than 224 is beneficial, which allows a classifier to learn from a larger context region surrounding a pixel. However, note that all of the images in this dataset are no larger than 500500, and we feed a network with original images (without resizing) during testing.
Thus, we have to limit the size of FoV below 500 pixels on this dataset. Otherwise, the dilated kernels of a classifier will be larger than the size of feature maps. As a result, part of a kernel will be applied to padded zeros, which has no merit. Similarly, if the size of FoV is larger than the size of image crops during training, part of a kernel cannot be properly learned. In Table1
, the largest FoV is 392. No matter what is the depth, networks with this setting always achieve the best performance. To realize such a large FoV, we can either enlarge the kernel size of the classifier or increase the dilation of these kernels. However, this dilation should not be too large, since the feature vector per location can only cover a limited size of area. For example, models with a dilation of eighteen show no obvious advantages over those with a dilation of twelve. Especially, when the depth is 152, the model with a dilation of eighteen performs worse than the one with twelve.
|Depth||Resolution||Kernel||Dilation||FoV||Pixel acc. %||Mean acc. %||Mean IoU %|
We then show results on the val set of Cityscapes in Table 2. Most of the observations on this dataset are consistent with those on PASCAL VOC 2012, as demonstrated above. Two notable exceptions are as follows. First, the problem of over-fitting seems lighter. One possible reason is that the resolution of images in this dataset are higher than those in PASCAL VOC 2012, so the total number of pixels are actually larger. On the other hand, the diversity of images in this dataset is smaller than those in PASCAL VOC 2012. In this sense, even less training data can cover a larger proportion of possible situations, which can reduce over-fitting. Second, 392 is still smaller than the optimal size of FoV. Since the original images are in a size of 10242048, we can feed a 50-layer network with larger image crops during both training and testing. In this case, a network will prefer even larger FoV. Therefore, to some extent, the ideal size of FoV depends on the size of image crops during training and testing.
|Depth||Resolution||Kernel||Dilation||FoV||Pixel acc. %||Mean acc. %||Mean IoU %|
4.4 Impact of the feature map resolution
In this subsection, we inspect the importance of training networks with a high resolution. We only evaluate two 101-layer networks whose classifiers are composed of 55 kernels, as shown in Table 3. For each network, once we increase the resolution of predictions during testing, we consistently observe a moderate improvement.
However, comparing the two networks at the same testing resolution, we find that the network trained with a resolution of 1/8 always performs better than the one trained with a resolution of 1/16. As for the cause of this result, if we present finer labels to a network during training, we can force it to better discriminate the pixels located around semantic boundaries. As the resolution increases, the labeled pixels for training become spatially closer, which makes them harder to discriminate. However, a very deep network can learn from them anyway, and will probably perform better during testing.
|Training resolution||Testing resolution||Pixel acc. %||Mean acc. %||Mean IoU %|
4.5 Impact of online bootstrapping of hard training pixels
In this subsection, we evaluate the impact of our proposed online bootstrapping. We introduce this component into several representative FCRNs with settings showing good performance as evaluated previously, and test them on the PASCAL VOC 2012 and Cityscapes datasets.
The results are shown in Table 4. In all cases, the best setting is to keep the 512 top hardest pixels. The number of valid labels per image crop may be less than 512. In this case, we keep all of them. In spite of the consistence, we note that it actually depends on the size of image crops during training, and these networks are trained with similar sizes of image crops. When we increase the size of image crops, it will be better to keep more. Otherwise we should keep less.
We also show the category-wise results in Tables 5 and 6. Generally speaking, the proposed bootstrapping can obviously improve the performance for those categories which are less frequent in training data, e.g., cow and horse on PASCAL VOC 2012, traffic light and train on Cityscapes.
Besides, to deal with the problem of over-fitting observed on the PASCAL VOC dataset, we introduce the traditional dropout  into some of the top-most blocks in FCRNs, which finally enables the 152-layer network to outperform the 101-layer network.
|Depth||Resolution||Kernel||Dilation||Bs./Do.||Pixel acc. %||Mean acc. %||Mean IoU %|
|PASCAL VOC 2012|
4.6 Comparison with previous state-of-the-art
We compare our method with the previous best performers on the PASCAL VOC 2012 datasets in Table 5. When training our model only with the PASCAL VOC data, we achieve a remarkable improvement in terms of mean IoU. Our method outperforms the previous best performer by 2.0% and wins the first place for twelve out of the twenty categories.
When pre-training our model with the Microsoft COCO  data, we achieve a moderate improvement of 1.0% and win the first place for thirteen out of the twenty categories. Generally speaking, our method usually loses for those very hard categories, e.g., ‘bicycle’, ‘chair’, ‘diningtable’, ‘pottedplant’ and ‘sofa’, for which most of the methods can only achieve scores below 70.0%.
The instances of these categories are usually of great diversity and in occluded situation, suggesting that more training data would be needed. But unfortunately, they are generally the less frequent categories in the training data of PASCAL VOC 2012.
|Results on val set|
|FCRN + Bs.||88.3||40.4||86.5||66.6||80.1||91.6||84.3||90.1||36.6||83.7||53.6||84.5||85.1||79.9||83.9||59.0||83.3||44.6||81.1||74.5||74.8|
|Results on test set obtained with models trained only using PASCAL VOC data|
|Results on test set obtained with models trained using PASCAL VOC + COCO data|
|Results on val set|
|FCRN + Bs.||97.6||82.0||91.7||52.3||56.2||57.0||65.7||74.4||91.7||62.5||93.8||79.8||59.6||94.0||66.2||83.7||70.3||64.2||75.5||74.6|
Several other variations we have evaluated are as follows. The first is to set a larger learning rate for the newly added convolution layer, which shows no obvious advantage in most of our experiments. This is not consistent with how we usually fine-tune a VGGNet, e.g., in DeepLab . There seems be some differences to be explored between tuning a residual network and a traditional network. The second is to add random color noise to the images, just as Krizhevsky et al.  did, which shows no improvement either. We have to add the same noise to a whole image crop, compared with adding 128 different noises per mini-batch , which might be the reason why this data augmentation approach does not work in our experiments. Besides, as mentioned before, we observe no obvious adverse impact when decreasing the number of images involved in one mini-batch. An intuition is to use an enough large group of images per mini-batch, e.g., FCN  and DeepLab  both used 20 per mini-batch. However, according to our experiments, it is not that necessary for semantic segmentation as it does for image classification.
In this work, we have built a few fully convolutional residual networks and explored their performances for the task of semantic image segmentation. We have shown the importance of large field-of-view and high resolution features maps. To break the limitation of GPU memories, we have proposed to simulate a high resolution network with a low resolution network. More importantly, we have proposed an online bootstrapping method to mine hard training pixels, which significantly improve the accuracy. Finally, we have achieved the state-of-the-art mean IoU score on the PASCAL VOC 2012 dataset.
-  J. Long, E. Shelhamer, and T. Darrell, “Fully convolutional networks for semantic segmentation,” in Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2015.
-  L. Chen, G. Papandreou, I. Kokkinos, K. Murphy, and A. Yuille, “Semantic image segmentation with deep convolutional nets and fully connected CRFs,” in Proc. Int. Conf. Learn. Representations, 2015.
-  G. Lin, C. Shen, A. van den Hengel, and I. Reid, “Exploring context with deep structured models for semantic segmentation,” arXiv:1603.03183, 2016.
-  J. Deng, A. Berg, S. Satheesh, H. Su, A. Khosla, and L. Fei-Fei, “ImageNet Large Scale Visual Rcognition Challenge 2012 (ILSVRC 2012),” 2012.
-  K. Simonyan and A. Zisserman, “Very deep convolutional networks for large-scale image recognition,” arXiv:1409.1556, 2014.
-  K. He, X. Zhang, S. Ren, and J. Sun, “Deep residual learning for image recognition,” in Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2016.
-  ——, “Identity mappings in deep residual networks,” arXiv:1603.05027, 2016.
A. Krizhevsky, I. Sutskever, and G. Hinton, “ImageNet classification with deep convolutional neural networks,” inProc. Advances in Neural Inf. Process. Syst., 2012.
-  O. Russakovsky, J. Deng, J. Krause, A. Berg, and L. Fei-Fei, “ImageNet Large Scale Visual Rcognition Challenge 2013 (ILSVRC 2013),” 2013.
-  C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Robinovich, “Going deeper with convolutions,” arXiv:1409.4842, 2014.
-  O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Z. Huang, A. Karpathy, A. Khosla, M. Bernstein, A. Berg, and L. Fei-Fei, “ImageNet Large Scale Visual Rcognition Challenge,” 2015.
-  R. Girshick, “Fast R-CNN,” in Proc. IEEE Int. Conf. Comp. Vis., 2015.
-  R. K. Srivastava, K. Greff, and J. Schmidhuber, “Training very deep networks,” in Proc. Advances in Neural Inf. Process. Syst., 2015.
-  S. Zheng, S. Jayasumana, B. Romera-Paredes, V. Vineet, Z. Su, D. Du, C. Huang, and P. Torr, “Conditional random fields as recurrent neural networks,” in Proc. IEEE Int. Conf. Comp. Vis., 2015.
-  I. Loshchilov and F. Hutter, “Online batch selection for faster training of neural networks,” in Proc. Int. Conf. Learn. Representations, 2016.
-  A. Shrivastava, A. Gupta, and R. Girshick, “Training region-based object detectors with online hard example mining,” in Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2016.
-  S. Mallat, A wavelet tour of signal processing, 3rd ed. Academic Press, December 2008.
-  S. Ioffe and C. Szegedy, “Batch normalization: Accelerating deep network training by reducing internal covariate shift,” arXiv:1502.03167, 2015.
-  M. Everingham, S. Eslami, L. van Gool, C. Williams, J. Winn, and A. Zisserman, “The PASCAL visual object classes challenge: A retrospective,” Int. J. Computer Vision, 2014.
M. Cordts, M. Omran, S. Ramos, T. Rehfeld, M. Enzweiler, R. Benenson, U. Franke, S. Roth, and B. Schiele, “The Cityscapes dataset for semantic urban scene understanding,” inProc. IEEE Conf. Comp. Vis. Patt. Recogn., 2016.
-  B. Hariharan, P. Arbelaez, L. Bourdev, S. Maji, and J. Malik, “Semantic contours from inverse detectors,” in Proc. IEEE Int. Conf. Comp. Vis., 2011.
-  Y. Jia, E. Shelhamer, J. Donahue, S. Karayev, J. Long, R. Girshick, S. Guadarrama, and T. Darrell, “Caffe: Convolutional architecture for fast feature embedding,” arXiv:1408.5093, 2014.
-  T. Lin, M. Maire, S. Belongie, J. Hays, P. Perona, D. R. P. Dollár, and C. Zitnick, “Microsoft COCO: Common objects in context,” in Proc. Eur. Conf. Comp. Vis., 2014.
-  H. Noh, S. Hong, and B. Han, “Learning deconvolution network for semantic segmentation,” in Proc. IEEE Int. Conf. Comp. Vis., 2015.
-  Z. Liu, X. Li, P. Luo, C. Loy, and X. Tang, “Semantic image segmentation via deep parsing network,” in Proc. IEEE Int. Conf. Comp. Vis., 2015.