Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 10

DeepLabV3 and Atrous Spatial Pyramid Pooling (ASPP)

Recommended resources

Welcome to our next session.

In our last lesson, we focused on atrous convolutions, establishing how this technique enables a network to expand its receptive field and capture broader context without sacrificing the spatial resolution of its feature maps. This was the first key ingredient for building a powerful semantic segmentation model.

Today, we will assemble the full picture. You've already gained practical experience training and using DeepLabV3, and now we will deconstruct its architecture to understand its design principles from the ground up. This lesson directly addresses the learning outcome: Analyze the architecture of DeepLabV3, focusing on its Atrous Spatial Pyramid Pooling (ASPP) module. We will see how the atrous convolution concept is extended to robustly handle objects of varying sizes, leading to the final model design.

The Multi-Scale Challenge

Our previous discussion focused on preserving spatial resolution. The second major challenge in semantic segmentation is the existence of objects at multiple scales. A single image might contain a person far in the background (small) and another person close to the camera (large). A model with a fixed receptive field might be adept at segmenting one but fail on the other.

A successful segmentation model must be able to encode contextual information at multiple scales simultaneously. DeepLabV3's core innovation is a module designed specifically for this purpose.

DeepLabv3 & DeepLabv3+ The Ultimate PyTorch Guide

This guide from LearnOpenCV provides an excellent overview of the DeepLabv3 model. Let's start by reviewing the core problems it was designed to solve.

Please read the section titled "DeepLabv3 Solution To Problems Faced In Segmentation." Focus on the two main problems described: the loss of spatial information (which we've already discussed) and the multi-scale object problem. This will set the stage for understanding the role of the ASPP module.


Atrous Spatial Pyramid Pooling (ASPP)

To address the multi-scale problem, the DeepLab authors drew inspiration from an earlier concept called Spatial Pyramid Pooling (SPP). The idea behind SPP is to probe an image with filters at different scales and then combine the results. DeepLab adapts this by using atrous convolutions as the probing mechanism, creating the Atrous Spatial Pyramid Pooling (ASPP) module.

Instead of having a single atrous convolution with a fixed rate, ASPP applies several atrous convolutions with different rates in parallel to the same input feature map. This allows the model to capture context and identify objects at multiple scales simultaneously.

This diagram shows the high-level architecture of DeepLabV3. An input image passes through a backbone network (the "Blocks") to produce a feature map. This map is then fed into the Atrous Spatial Pyramid Pooling (ASPP) module, which has several parallel branches to process the features at multiple scales.

The ASPP module is the heart of DeepLabV3. Let's examine its structure more closely.

MLT __init__ Session #2: DeepLab — Semantic Image Segmentation

The video from MLT that we used in the previous lesson also contains a clear, concise explanation of the ASPP module. It's helpful to see it explained dynamically.

Watch the segment from this timestamp. The presenter explains how ASPP is inspired by the parallel branches in Inception networks and uses atrous convolutions with different rate parameters to achieve multi-scale feature extraction efficiently.


Deconstructing the ASPP Module

The canonical ASPP module in DeepLabV3 consists of several parallel branches that process the input feature map from the backbone network:

  1. One 1x1 convolution: This branch provides a direct path for the original features, capturing fine-grained local information. Its effective receptive field is the smallest.
  2. Multiple 3x3 atrous convolutions: These are the core multi-scale probes. DeepLabV3 typically uses three such branches with different dilation rates, for example, rate=6, rate=12, and rate=18. Each rate creates a different effective receptive field, capturing context at a different scale.
  3. An Image Pooling branch: This branch performs global average pooling on the entire feature map to encode global context. The result is passed through a 1x1 convolution and then bilinearly upsampled to match the original feature map's spatial dimensions.

Finally, the outputs from all these parallel branches are concatenated along the channel dimension and passed through a final 1x1 convolution to fuse the multi-scale information and reduce the channel depth.

The article below provides a detailed breakdown of this structure.

Atrous Spatial Pyramid Pooling (ASPP)

This article from EmergentMind clearly lists the components of the ASPP block as found in DeepLabv3.

Read the section titled "Architectural Integration and Design Variants". The bulleted list here perfectly outlines the components we just discussed.

Why Image Pooling? A Critical Refinement

You might wonder why the image pooling branch is necessary. It was a key improvement in DeepLabv3 over its predecessor, DeepLabV2. The authors found that as the dilation rate r becomes very large relative to the feature map size, the atrous convolution becomes ineffective. The 3x3 kernel with large gaps between its weights might only have its central weight land on a valid feature pixel, effectively degenerating it into a 1x1 convolution and failing to capture any large-scale context.

The image pooling branch solves this by explicitly capturing global context, ensuring that information from the entire image is always incorporated, regardless of the dilation rates used in the other branches.

DeepLabv3 & DeepLabv3+ The Ultimate PyTorch Guide

Let's return to the LearnOpenCV guide to solidify our understanding of the ASPP module's design, including the motivation for the image pooling branch.

First, read the subsection on ASPP to see how it evolved from SPP. Then, carefully read the following paragraph that explains the problem with large atrous rates. Finally, examine the section "DeepLabv3 Modifications To ASPP" which explicitly lists the addition of the image-level features as a solution.


The Complete DeepLabV3 Architecture

Now we can assemble all the pieces. The full architecture of a DeepLabV3 model follows this flow:

  1. Encoder (Backbone): The model starts with a standard CNN, typically a ResNet, pre-trained on ImageNet. To preserve spatial detail, the striding in the last one or two blocks of the ResNet is removed, and the subsequent convolutions are replaced with atrous convolutions. This produces a final feature map that is rich in semantic information but has a relatively high spatial resolution (e.g., an output stride of 16 or 8, instead of 32).

  2. ASPP Module: This dense feature map is then fed into the Atrous Spatial Pyramid Pooling module, as detailed above, to capture multi-scale context.

  3. Head: The concatenated output of the ASPP module is passed through a final 1x1 convolution to produce the raw output logits for each pixel and each class.

The diagram below illustrates this complete encoder-ASPP structure. While this image is from the DeepLabV3+ paper, the "Encoder" part perfectly represents the DeepLabV3 model we're analyzing.

This diagram shows the full data flow. The input image goes through a Deep CNN (DCNN) backbone modified with atrous convolutions. The resulting feature map is fed into the ASPP module with its parallel branches. The output of the ASPP module is a feature map rich with multi-scale context, which is then used to make the final prediction.

The learnopencv.com resource provides a final summary of this overall design.

DeepLabv3 & DeepLabv3+ The Ultimate PyTorch Guide

This final reading puts everything together, describing the complete model.

In the "DeepLabv3 Architecture" section, focus on the part titled "Atrous Convolution Arranged In Parallel". This section confirms that the architecture combining the modified backbone with the ASPP module is the final, definitive DeepLabv3 design.


Conclusion

In this lesson, we moved from the foundational concept of atrous convolution to the complete architecture of DeepLabV3. Having already worked with this model, you can now appreciate the deep rationale behind its design, connecting your practical skills to a solid theoretical understanding.

Key Takeaways:

  • Core Problem: DeepLabV3 is designed to solve two main issues in segmentation: loss of spatial resolution and the presence of objects at multiple scales.
  • Backbone: It uses a standard CNN backbone (like ResNet) but replaces later downsampling layers with atrous convolutions to preserve resolution while still growing the receptive field.
  • ASPP Module: This is the heart of the model. It processes features using parallel branches with different atrous rates (e.g., 6, 12, 18), a 1x1 convolution, and an image pooling branch.
  • Function of ASPP: This parallel structure allows the model to robustly capture context and segment objects at various scales simultaneously. The image pooling branch specifically ensures global context is captured, overcoming limitations of large dilation rates.

In our next lesson, we will bridge the gap between model output and practical application. We will focus on the learning outcome: Formulate the process of converting raw model logits into a binary mask for a target facial feature (e.g., teeth). This step is essential for preparing the segmentation masks needed for your final project pipeline.