Hierarchical Multi-Scale Attention for Semantic Segmentation

Andrew Tao, Karan Sapra, Bryan CatanzaroarXiv 2020 · OpenReview

Abstract

Multi-scale inference is commonly used to improve the results of semantic segmentation. Multiple images scales are passed through a network and then the results are combined with averaging or max pooling. In this work, we present an attention-based approach to combining multi-scale predictions. We show that predictions at certain scales are better at resolving particular failures modes, and that the network learns to favor those scales for such cases in order to generate better predictions. Our attention mechanism is hierarchical, which enables it to be roughly 4x more memory efficient to train than other recent approaches. In addition to enabling faster training, this allows us to train with larger crop sizes which leads to greater model accuracy. We demonstrate the result of our method on two datasets: Cityscapes and Mapillary Vistas. For Cityscapes, which has a large number of weakly labelled images, we also leverage auto-labelling to improve generalization. Using our approach we achieve a new state-of-the-art results in both Mapillary (61.1 IOU val) and Cityscapes (85.1 IOU test).

Introduction

Semantic segmentation—the task of assigning a class label to every pixel in an image—faces a fundamental resolution trade-off. Fine details, like thin poles or crisp object edges, are best captured at high resolutions. Conversely, large structures (like a wide road or a building) require global context to avoid "class confusion," which is often better handled at lower resolutions where the network's receptive field covers more of the scene.

The standard industry fix is multi-scale inference: running the same image through a network at different scales and merging the results. However, traditional merging methods like simple averaging or max-pooling are often sub-optimal because they average high-quality predictions with poor ones. While prior attention-based merging methods existed, they were incredibly memory-intensive, requiring simultaneous training on all scales.

Methods

The authors propose a hierarchical attention mechanism that intelligently combines predictions from multiple image scales. Instead of learning an attention mask for every scale simultaneously, the network is trained to predict a relative weighting between just two adjacent scales (e.g., 1.0x and 0.5x). Because the mechanism is hierarchical, these learned relationships can be chained together at inference time to combine any number of scales.

This approach is roughly 4x more memory-efficient than previous attention models, allowing for larger image crops and more spatial context during training. Furthermore, because the attention is learned between relative scales, the model can successfully incorporate scales during inference that it never saw during training.

To improve generalization on the Cityscapes dataset, the authors also leverage 20,000 "coarsely" labeled images using a hard-threshold auto-labelling strategy. A teacher model generates pseudo-labels, keeping only those where the model's confidence exceeds 0.9.

Results and Discussion

The model achieved state-of-the-art performance on two major benchmarks: 85.1 mIOU on the Cityscapes test set and 61.1 mIOU on Mapillary Vistas (val).

Scale Specialization

A key insight of this work is that the attention mechanism learns semantic logic. Visualization reveals that the network learns to favor higher scales (e.g., 2.0x) for thin, intricate objects like street signs and poles, while favoring lower scales (e.g., 0.5x) for massive, uniform areas like road surfaces.

Comparison of input images and predictions at 0.5x vs 2.0x scales, demonstrating how the model learns to favor different scales for different object types.

Efficiency Gains

On an Nvidia V100 GPU, the hierarchical method's training minibatch time was 1.17 seconds, compared to 3.08 seconds for the explicit attention method—nearly 3x faster while using significantly less memory. On Cityscapes, adding hierarchical attention provided a +0.5 mIOU boost over simple averaging, and combining it with auto-labelling resulted in a total gain of +1.4 mIOU.

Conclusion

Hierarchical multi-scale attention provides a powerful and memory-efficient framework for semantic segmentation. By specializing at different scales and enabling larger training crops, the method sets new performance benchmarks. While multi-scale inference increases test-time computational costs, the efficiency gains during training represent a significant step forward for large-scale computer vision tasks.

Summary updated

Abstract

Multi-scale inference is commonly used to improve the results of semantic segmentation. Multiple images scales are passed through a network and then the results are combined with averaging or max pooling. In this work, we present an attention-based approach to combining multi-scale predictions. We show that predictions at certain scales are better at resolving particular failures modes, and that the network learns to favor those scales for such cases in order to generate better predictions. Our attention mechanism is hierarchical, which enables it to be roughly 4x more memory efficient to train than other recent approaches. In addition to enabling faster training, this allows us to train with larger crop sizes which leads to greater model accuracy. We demonstrate the result of our method on two datasets: Cityscapes and Mapillary Vistas. For Cityscapes, which has a large number of weakly labelled images, we also leverage auto-labelling to improve generalization. Using our approach we achieve a new state-of-the-art results in both Mapillary (61.1 IOU val) and Cityscapes (85.1 IOU test).
BibTeX
@misc{tao2020hierarchical,
  author = {Andrew Tao and Karan Sapra and Bryan Catanzaro},
  title = {{Hierarchical Multi-Scale Attention for Semantic Segmentation}},
  year = {2020},
  eprint = {2005.10821},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2005.10821},
}
Figure