Semantic Image Segmentation with Deep Convolutional Nets and Fully Connected CRFs
- Publication
- ICLR 2015Conference
- First submitted to arXiv
- arXiv:1412.7062
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{segmentationdeeplabv12014,
title = {{Semantic Image Segmentation with Deep Convolutional Nets and Fully Connected CRFs}},
author = {Liang-Chieh Chen and George Papandreou and Iasonas Kokkinos and Kevin Murphy and Alan L. Yuille},
year = {2014},
eprint = {1412.7062},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1412.7062}
}
In November 2014, FCN turned classification networks into fully convolutional ones, and for the first time a convolutional network output a whole segmentation map directly. A month later, Liang-Chieh Chen and Alan Yuille of UCLA, George Papandreou and Kevin Murphy of Google, and their co-authors released this paper. They accepted FCN's starting point but were far from happy with its output, which was too coarse.
The system later got a name, DeepLab, and went all the way to v3+. The first generation has two moves. One is to "punch holes" in the convolution kernel; the other is to attach, after the network, a conditional random field that looks across every pixel.
Defining the Problem
Classification networks are good at answering "is there an airplane in the picture?" and bad at answering "where is the airplane's boundary?" The authors break the reason into two parts.
The first is downsampling. VGG-16 has five max-pooling layers, each halving the feature map's height and width, so the last layer has an output stride of 32 pixels. A image ends up as a grid, and each cell has to stand for a patch of the original image. FCN uses skip layers to add the shallow layers' score maps back in and recover detail, but even at its finest it only reaches stride 8, and it has to train several extra upsampling layers.
The second is spatial invariance. Invariance is exactly what classification needs; move an object a few pixels to the left and the answer should stay the same. Segmentation wants the opposite, and a boundary shifted by one pixel counts as wrong. The authors say outright in the paper that the very invariance that makes DCNNs good at high-level tasks is what makes their localization imprecise.
So the problem has two layers. How do you get the ImageNet-pretrained VGG-16 to output a denser score map without training a new network? And even with a dense enough score map, it is still a fuzzy Gaussian blob at the boundaries, so how do you pull them back onto the object's real outline?
Solving the Problem

The whole system has only two stages. The front stage is a modified VGG-16 that outputs a score map at stride 8, which bilinear interpolation then enlarges 8× back to the original image size. The back stage is a fully connected conditional random field (fully connected CRF), which uses the original image's colors and positions to refine the coarse score map until it fits the boundaries.
Let's take the first stage first.
Removing the Pooling Stride
The most direct idea is to change the stride of the last two max-pooling layers from 2 to 1. Then pool4 and pool5 no longer shrink the feature map, the output stride goes from 32 to 8, and a input gives a score map.
This has a side effect, though. Take the convolutions in conv5. They originally took pool4's output, where adjacent positions are 16 pixels apart in the original image; with pool4's stride removed, adjacent positions are only 8 pixels apart. The pretrained weights haven't changed, but the range they see has shrunk to half, so what they learned no longer fits.
To let the same weights keep seeing as wide a range as before, they have to sample every other position. This is what the paper calls the hole algorithm (also called the atrous algorithm; the French à trous means "with holes").

Look at one orange output point in the figure. It still uses only three weights, but the three inputs are taken one point apart, so they span 5 positions. On the output side every position is computed, with no skipping.
An equivalent way to put it is inserting zeros into the kernel. A kernel with sampling interval (the paper calls it the input stride; people later started calling it the dilation rate) has an effective size of
With and the effective size is , yet there are still only 9 parameters and 9 multiply-adds.
Back in VGG-16, the authors set the three convolution layers after pool4 to , and the original fc6 after pool5 ( once converted to a convolution) to . These two numbers make up exactly for the two strides that were removed. In practice, they added a sparse-sampling option to Caffe's im2col and left the filters themselves untouched.
After this change the score map has stride 8. The authors found the score map itself quite smooth, so plain bilinear interpolation to enlarge it 8× was enough, with no need to learn upsampling layers as FCN did. Fine-tuning on PASCAL VOC 2012 takes about 10 hours, while the paper notes that FCN reports training times of several days.
The training objective is plain too. The ground-truth map is downsampled 8× as well, and 21-class cross-entropy is computed at every position of the score map, with all positions and all classes weighted equally.
A Receptive Field Too Large to Compute
There is also a practical problem. VGG-16's fc6, once converted to a convolution, is 4096 filters of size , and with on top, this layer becomes the computational bottleneck of the whole network. Run fully convolutionally, VGG-16 has a receptive field of pixels.
The authors' fix is blunt. They simply subsample fc6's weights down to or , and both the receptive field and the computation drop with them. On a Titan GPU, a input gives a score map, and testing runs at about 8 images per second.
Once the kernel is smaller, the receptive field can be won back by increasing . Using the formula from before, the original with has an effective size of ; for a kernel to span the same 25 positions you need , so . This setting was later named LargeFOV, and the authors also cut the channels of the last two layers from 4096 to 1024. The experiments will show that it is as accurate as the original with only about a sixth of the parameters.
Fully Connected CRF
At this point the network can say "the airplane is roughly here." What's left is the boundary.
Conditional random fields had been used in segmentation for a long time, mostly short-range ones in the early days. Each pixel is linked only to its neighbors above, below, left and right, and neighbors with different labels are penalized; the purpose was to clean up the noisy specks of weak classifiers. The authors point out that on a DCNN this backfires. The DCNN's score map is already smooth and lacks detail, so smoothing it again only blurs it further.
So they switched to the fully connected CRF proposed by Krähenbühl and Koltun in 2011. The energy function is
is the label of each pixel. The unary term takes the probability from the DCNN directly; the more confident the network, the more it costs to change the label.
There is a pairwise term for every pair of pixels in the image, no matter how far apart they are:
is the Potts model, 1 when the two labels differ and 0 when they match, so only "labeled as different classes" gets penalized. How much is penalized is decided by , a weighted sum of two Gaussian kernels:
is pixel position and is color.
The first kernel, , is a bilateral kernel. When two pixels are close in position and also close in color, it strongly prefers that they share a class. The airplane's white fuselage and the blue sky are far apart in color, so this term ties the labels together inside the fuselage and lets go at the boundary. The second kernel, , looks only at position; it does ordinary smoothing and cleans up isolated specks.
Having to compute every pair of pixels sounds terrifying. A VOC image has 187,500 pixels and about pairwise terms. Krähenbühl and Koltun's way around this is mean-field approximate inference, which writes each message-passing step as Gaussian filtering in feature space and then speeds it up with high-dimensional filtering algorithms such as the permutohedral lattice. The authors used their public implementation, which averages under 0.5 seconds per VOC image.

The second column is the DCNN's output, in the right place but shaped like a blob. After the first iteration the wings and tail already appear, and by the 10th it is quite close to the ground truth. Look at the background in the top row too; the CRF also cleared away the low-score regions left in the sky.
A Little Multi-Scale on Top
The authors also tried FCN-style multi-layer fusion. On the input image and on the outputs of the first four max-pooling layers, they attached a small two-layer MLP each (128 filters, then 128 ), and concatenated the results into the last layer, so the features before softmax gain channels. During training only the newly added weights are updated, and the original network stays fixed. This version is called DeepLab-MSc.
Training
The two stages are trained separately. First the DCNN is fine-tuned on VOC, with batch 20, learning rate 0.001 (0.01 for the final classification layer), multiplied by 0.1 every 2000 iterations, momentum 0.9 and weight decay 0.0005.
Once trained, the DCNN is frozen and the CRF's parameters are tuned. and keep their default values; , and are searched coarse-to-fine on 100 images from the validation set, and mean field runs a fixed 10 iterations. So the CRF takes no part in the network's backpropagation; it is post-processing with tuned parameters.
Discussion
All experiments are on PASCAL VOC 2012, with 20 object classes plus background, and the metric is mean IoU over the 21 classes. The original training set has only 1,464 images; with the extra annotations from Hariharan et al. it grows to 10,582.
How Much CRF and Multi-Scale Each Contribute
The table below is compiled from Table 1(a) of the paper, trained on the augmented train set and evaluated on val:
| Model | MSc | LargeFOV | CRF | mIoU (%) |
|---|---|---|---|---|
| DeepLab | 59.80 | |||
| DeepLab-CRF | ✓ | 63.74 | ||
| DeepLab-MSc | ✓ | 61.30 | ||
| DeepLab-MSc-CRF | ✓ | ✓ | 65.21 | |
| DeepLab-LargeFOV | ✓ | 62.25 | ||
| DeepLab-CRF-LargeFOV | ✓ | ✓ | 67.64 | |
| DeepLab-MSc-CRF-LargeFOV | ✓ | ✓ | ✓ | 68.70 |
The CRF adds 3.9 to 5.4 points every time, the largest of the three components. The authors compare this with Krähenbühl and Koltun's own results, where the same CRF attached after TextonBoost only raised it from 27.6% to 29.1%. The stronger the classifier, the more the CRF can actually fix, which fits the earlier point that what the DCNN lacks is detail.
Multi-scale features add only about 1.5 points, and the authors admit they fall short of the CRF.
Receptive Field and Speed
Table 2 of the paper compares the kernel size and sampling interval of fc6; all numbers are val results with the CRF:
| Setting | Kernel | RF | Params | mIoU (%) | Train (img/s) | |
|---|---|---|---|---|---|---|
| CRF-7x7 | 4 | 224 | 134.3M | 67.64 | 1.44 | |
| CRF | 4 | 128 | 65.1M | 63.74 | 2.90 | |
| CRF-4x4 | 8 | 224 | 65.1M | 67.14 | 2.90 | |
| CRF-LargeFOV | 12 | 224 | 20.5M | 67.64 | 4.84 |
Compare the first two rows. Shrinking the kernel from to without raising drops the receptive field (RF) to 128, and mIoU falls by nearly 4 points. The third row raises to 8, the receptive field returns to 224, and the score comes back with it. What really drives the result is the receptive field, not the size of the kernel itself.
LargeFOV matches the original 7x7 score, with parameters going from 134.3M to 20.5M and training 3.36 times faster. Later versions of DeepLab all kept this direction, using small kernels with large sampling intervals to get a large receptive field.
Did the Boundaries Really Improve?
Mean IoU averages over the whole image, and boundaries take up very few pixels, so improvements there are easily drowned out. The authors borrow the void label from the VOC annotations; these "can't quite tell" pixels mostly sit on object edges. They draw a narrow band (trimap) around the void pixels and compute accuracy only inside the band.

Look at the mean IoU plot on the far right. The narrower the band, the closer it is to the boundary, and the wider the gap between the four lines. As the band width approaches 0, the bottom line, plain DeepLab, is below 40%, while the version with MSc and CRF is close to 50%. Widen the band to 40 pixels and the gap shrinks to a few points, because more and more easy object interior gets mixed into the band.
Test Set
Trained on trainval and evaluated on the official test server (Table 3 of the paper), DeepLab-CRF reaches 66.4%, already above FCN-8s's 62.2% and TTI-Zoomout-16's 64.4%. Adding LargeFOV gives 70.3%, and adding multi-scale on top gives 71.6%.
These numbers also record how the paper itself evolved. The v1 submission had only DeepLab-CRF's 66.4%; MSc was added during the rebuttal, and LargeFOV only arrived in the camera-ready version. The v4 we read today is three rounds of revisions stacked together.
What It Can't Fix

The authors close their visualizations with failure cases. Comparing the second and third columns of each group shows the CRF's limit; all it does is redistribute existing labels along color boundaries. In these groups the DCNN column already has the classes wrong or mixed together, and after the CRF the boundaries are cleaner while the wrong color patches stay exactly as they were. What the DCNN gets wrong, the CRF can't rescue.
Another limitation is in the paper's discussion. The DCNN and CRF are trained separately, the CRF's parameters come from a cross-validation search, and during training the network has no idea there is a CRF after it. The authors list end-to-end training as the next step; around the same time, Zheng et al.'s CRF-RNN had already unrolled the mean-field iterations into network layers and backpropagated through everything together.
Conclusion
DeepLab v1 solves the two problems FCN left behind with one off-the-shelf tool each. The hole algorithm lets the ImageNet-pretrained VGG-16 output a stride-8 score map without changing its weights; the fully connected CRF uses color and position to pull blurry boundaries back to the object's outline. On VOC 2012 test it goes from FCN-8s's 62.2% to 71.6%.
The two tools met very different fates. The hole algorithm became dilated convolution; PyTorch's nn.Conv2d has a dilation parameter built in, and turning on replace_stride_with_dilation in torchvision's ResNet swaps the strides of the later stages for sampling intervals, just as this paper does. The CRF was retired in DeepLab v3 in 2017, whose authors wrote in the abstract that even without DenseCRF post-processing it substantially outperformed the earlier versions.
So read the CRF half of this paper as history; the atrous-convolution half still shows up every day in today's segmentation code.