Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation
- Publication
- ECCV 2018Conference
- First submitted to arXiv
- arXiv:1802.02611
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{segmentationdeeplabv3plus2018,
title = {{Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation}},
author = {Liang-Chieh Chen and Yukun Zhu and George Papandreou and Florian Schroff and Hartwig Adam},
year = {2018},
eprint = {1802.02611},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1802.02611}
}
DeepLab is a series of semantic segmentation models that Liang-Chieh Chen, George Papandreou of Google and others began in 2014, with each version adding a little to the one before.
v1 uses atrous convolution to keep feature maps at a fairly large resolution, then attaches a fully connected CRF to fix the boundaries. v2 adds ASPP, using several convolutions with different atrous rates to look at ranges of different sizes at the same time. v3 strengthens ASPP, adds global pooling over the whole image, and drops the CRF.
This paper is v3+, and it mainly adds just one thing, a very small decoder.
It later became one of the most commonly compared baselines in semantic segmentation, used as a reference by SegFormer and many later papers. The question here is why something this small earned a version number.
Defining the Problem
Semantic segmentation networks handle multiple scales in roughly two ways.

(a) is the route of PSPNet and DeepLab v3. On the backbone's last feature map, pooling of different sizes or convolutions with different atrous rates capture context at several scales at once, so the semantic information is rich. The problem is that after all the pooling and strided convolutions in the backbone, the objects' boundary detail is long gone, and in the end you can only upsample directly from a very small map.
(b) is the route of SegNet and U-Net. The encoder keeps shrinking, the decoder keeps enlarging, and every layer brings the encoder's detail back in, so the boundaries come out sharper.
DeepLab's old remedy is atrous convolution. Remove the stride from the backbone's last few blocks and use atrous convolution to keep the receptive field, and the feature map doesn't shrink as much.
One term is needed here. Output stride is the ratio of the input resolution to the final feature map's resolution. Classification networks usually have 32, meaning the feature map is only 1/32 of the input. DeepLab v3 uses 16, or 8 when it's going for more accuracy.
But atrous convolution is expensive. The authors take ResNet-101 as an example. To reach output stride 16, the last 3 residual blocks (9 layers) have to switch to atrous convolution; to reach 8, 26 residual blocks, 78 layers, are affected. The feature maps of all 78 layers are computed at 1/8 size.
The experiments later on show this cost too. DeepLab v3 at output stride 16 takes about 81 billion multiply-adds per image; switching to 8 at evaluation brings it to about 276 billion, 3.4 times as much, for only 1.3 more mIoU.
So the authors' idea is to combine (a) and (b) into (c). The encoder is DeepLab v3, using atrous convolution only as far as it's affordable; for the details, a decoder goes back to the shallow features to pick them up.
Solving the Problem
Overall Architecture

The encoder in the top half is just DeepLab v3. The backbone's last few blocks use atrous convolution, and the output goes into ASPP. ASPP has five parallel branches: a 1×1 convolution, three 3×3 convolutions with atrous rates of 6, 12 and 18, and a branch that does global average pooling over the whole feature map. The outputs of the five branches are concatenated and compressed to 256 channels with a 1×1 convolution.
In v3, once these 256-channel features produce the classification, a direct 16× bilinear upsampling gives the answer. The authors count this direct upsampling as a decoder too, just a very naive one.
The bottom half is the new decoder.
Following a 513×513 Image
DeepLab's official setting crops images to 513×513 for training. Let's take this size through the decoder, with a ResNet-101 backbone and output stride 16.
- Encoder output. The 513×513 input passes through the backbone and ASPP to give a 33×33×256 feature map.
- Upsample 4×. Bilinear interpolation enlarges it to 129×129×256.
- Fetch shallow features. Go back into the backbone and find a layer whose resolution is also 129×129, the one at output stride 4. For ResNet-101 that's the last feature map of the Conv2 block (before the strided downsampling), with 256 channels.
- Reduce channels. The shallow features first go through a 1×1 convolution that compresses them from 256 channels to 48.
- Concatenate. Stack the two together to get 129×129×(256 + 48) = 129×129×304.
- Refine. Two 3×3 convolutions with 256 filters follow.
- Upsample 4× again. Bilinear interpolation brings it back to 513×513, giving each pixel's class.
The final output stride of the whole network is 4. The authors say GPU resources were limited, so they didn't push to finer resolutions.
Why Compress to 48 Channels
Step 4 looks unremarkable, but the authors ran experiments specifically to settle it.
Shallow features usually have many channels (256 or 512), while the encoder output has only 256. Concatenate them directly, and the shallow features outnumber the semantically rich encoder features; the authors believe this makes training harder.
They tried several channel counts on the VOC 2012 validation set:
| Channels | 8 | 16 | 32 | 48 | 64 |
|---|---|---|---|---|---|
| mIoU (%) | 77.61 | 77.92 | 78.16 | 78.21 | 77.94 |
32 or 48 works best, and 48 was the final choice.
The 3×3 convolutions that follow were also tested in several configurations. One 3×3 layer with 256 channels gives 78.21; two layers give 78.85; three layers actually fall to 78.02. Cutting the filters to 128, or replacing 3×3 with 1×1, makes things worse.
The authors also tried something closer to U-Net, using two layers of shallow features, Conv2 and Conv3, at the same time, first upsampling 2× and attaching Conv3, then upsampling 2× again and attaching Conv2. The result was 78.61, no better than Conv2 alone. So the final decoder is as simple as it is now: one layer of shallow features, one 1×1 and two 3×3.
Atrous Separable Convolution
The second change in v3+ is bringing in depthwise separable convolution.
An ordinary convolution mixes information across space and channels at the same time. Depthwise separable convolution splits it into two steps: first a spatial convolution on each channel separately (depthwise), then a 1×1 convolution to mix the channels (pointwise).
Here's how much that saves. An ordinary 3×3 convolution with 256 channels in and 256 out has weights. Split up, the depthwise part has and the pointwise part , 67,840 in total, about 8.7 times fewer.
TensorFlow's implementation allows atrous rates in the depthwise step, and the authors call this combination atrous separable convolution, using it in the convolutions of ASPP and the decoder.
Modifying Xception
For the backbone, besides ResNet-101, the authors also modified Xception. Xception is built almost entirely from depthwise separable convolutions. Microsoft Research Asia used a deeper version of it, called Aligned Xception, in the COCO 2017 detection challenge, and the authors made three further changes:
- Go deeper, as Aligned Xception does, but leave the entry flow at the front unchanged, for speed and memory.
- Replace all max pooling with strided depthwise separable convolutions, so they can be switched to atrous convolution where needed, giving arbitrary control over output stride.
- Following MobileNet, add BatchNorm and ReLU after every 3×3 depthwise convolution.
This modified Xception has a top-1 error of 20.19% on ImageNet-1K, better than ResNet-101 retrained under the same setting (22.40%). Removing the BatchNorm and ReLU from point 3 costs 0.75% in top-1.
Discussion
Experimental Setup
The main experiments are on PASCAL VOC 2012: 20 foreground classes plus background, with 1,464 training, 1,449 validation and 1,456 test images in the original data, and the training set expanded to 10,582 images with SBD's extra annotations. The metric is mIoU over 21 classes.
The training setup follows DeepLab v3: a poly learning-rate schedule, an initial learning rate of 0.007, 513×513 crops, BatchNorm fine-tuned at output stride 16, and random scaling. The whole model is trained end to end, with no separate pretraining of individual components.
Decoder or Denser Features: Which Is the Better Deal?
The comparison uses ResNet-101 on the validation set. "Train/eval OS" in the table below is the output stride at training and evaluation, and compute is the number of multiply-adds per image (from the paper's Table 3, single scale, no flipping):
| Train/eval OS | Decoder | mIoU | Compute |
|---|---|---|---|
| 16/16 | 77.21 | 81.0B | |
| 16/8 | 78.51 | 276.2B | |
| 16/16 | ✓ | 78.85 | 101.3B |
| 16/8 | ✓ | 79.35 | 297.9B |
| 32/32 | 75.43 | 52.4B | |
| 32/32 | ✓ | 77.37 | 74.2B |
This table is easy to read.
- The decoder is the better deal. Adding the decoder costs about 20 billion more operations and takes mIoU from 77.21 to 78.85; switching to output stride 8 costs about 195 billion more and only reaches 78.51.
- The two stack, with diminishing returns. Decoder plus output stride 8 gives 79.35, 0.5 more than decoder plus 16, at nearly 3 times the compute.
- You can skip atrous convolution entirely. Output stride 32 plus the decoder gives 77.37 at 74.2 billion operations, about the same as the original DeepLab v3 (output stride 16, 81 billion, 77.21). No matter how evaluation is set up, though, models trained from 32 come out 1 to 1.5 below those trained from 16.
The authors recommend training with 16 and choosing 16 or 8 at evaluation, depending on the budget. Pairing atrous convolution with a decoder also brings this benefit, since the same model can switch output stride at evaluation without retraining.
After Switching to Xception
Results with Xception (from the paper's Table 5, eval OS 16, single scale):
| Setting | mIoU | Compute |
|---|---|---|
| DeepLab v3 (no decoder) | 79.17 | 68.0B |
| + decoder | 79.93 | 89.8B |
| + separable conv | 79.79 | 54.2B |
| + COCO pretraining | 82.20 | 54.2B |
| + JFT pretraining | 83.03 | 54.2B |
Swapping the backbone alone gives nearly 2 more than ResNet-101. The decoder adds about 0.8 here, and its contribution shrinks when evaluation uses output stride 8.
Once both ASPP and the decoder switch to atrous separable convolution, compute drops by 33% to 41% with mIoU nearly unchanged; in the table it goes from 89.8B to 54.2B and loses only 0.14.
Further down is pretraining data. Pretraining on COCO first adds about 2; pretraining the backbone on Google's internal JFT-300M adds another 0.8 to 1.
On the test set, the strongest model switches to output stride 8 and trains with BatchNorm frozen, reaching 87.8% without JFT and 89.0% with it, both above every method on the leaderboard at the time.
Note, though, that the shiny 89.0% requires JFT-300M. That's Google's internal dataset of 300 million images, which outsiders can't get (so the ceiling for everyone else to reproduce is 87.8%).
Did the Boundaries Really Improve?
Overall mIoU rises by only 1 to 2 points, which can't show what the decoder does at the boundaries. The authors used the trimap experiment DeepLab v1 had already used. VOC annotations have a band of void around object boundaries; dilate this void band outward into a strip, and compute mIoU only on the pixels inside it.

The horizontal axis on the left is strip width; further left means closer to the boundary. The two lines with the decoder stay on top the whole way, and the narrower the strip, the wider the gap. At the narrowest point, ResNet-101 gains 4.8 and Xception 5.4. The examples on the right say the same. With bilinear upsampling, the airplane's engine and wing merge into one blob and the horse's legs break into several pieces; the decoder version picks out the engine's outline and joins up all four legs.
The authors also list failure cases: sofas confused with chairs, heavily occluded objects, and objects seen from rare viewpoints.
Cityscapes
On Cityscapes (2,975 finely annotated training images), the modified Xception (65 layers, written X-65) with DeepLab v3 scores 77.33 on the validation set, and 78.79 with the decoder added.
There's an interesting little finding here. Removing the global pooling branch from ASPP actually raises the score to 79.14. The authors leave just one line of explanation, that in DeepLab, the global pooling features are more effective on VOC. Deepening Xception's entry flow (X-71) brings validation to 79.55. After training with about 20,000 additional coarsely annotated images, it reaches 82.1 on the test set, above DeepLab v3's 81.3.
Pitfalls When Reproducing
DeepLab v3+'s official code and pretrained weights are both public, and there are plenty of community ports, but reports of "my numbers come out far below the paper's" have never stopped.
A typical example is keras-deeplab-v3-plus issue #8, from April 2018. A user converted the official model trained on Cityscapes to Keras, measured it on the validation set, and got only about 67%, where the officially published figure is about 80%. Tracking it down, the model's outputs were identical to the original pixel for pixel; the problem lay in the evaluation. The official mIoU ignores pixels labeled "unknown" (label 255), but the user's evaluation code counted them. After fixing that, they measured about 75% (the paper gives 78.79% for the output stride 16 setting), and they put the remaining gap down to whether the image preprocessing exactly matches the official one.
So if your own numbers are far off, check the evaluation protocol and the preprocessing before suspecting the model.
Conclusion
DeepLab v3+'s contribution is simple once you see it. Attach a small decoder after DeepLab v3, join the 4×-upsampled semantic features with shallow features compressed to 48 channels, refine, then upsample again. This decoder costs only about 20 billion extra multiply-adds, far cheaper than changing the whole backbone's output stride to 8, and it adds nearly 5 points of mIoU near the boundaries.
The other half of the contribution is engineering. Atrous separable convolution cuts the compute of ASPP and the decoder by 30 to 40 percent, and the same model can switch output stride at evaluation, so accuracy and speed can be tuned to the budget.
If you use it as a baseline, check two things first. One is output stride. The paper recommends training with 16, but MMSegmentation's default deeplabv3plus_r50-d8 config uses 8 (with ASPP's atrous rates changing to 12, 24 and 36 to match), a severalfold difference in compute that has to be lined up when comparing. The other is to remember to ignore 255 at evaluation, or you'll think your model has suddenly regressed by more than ten points.