Segformer++: Efficient Token-Merging Strategies for High-Resolution Semantic Segmentation
Daniel Kienzle, Marco Kantonis, Robin Schön, Rainer Lienhart
TL;DR
The paper tackles the prohibitive quadratic cost of self-attention in high-resolution semantic segmentation by introducing Segformer++, a token merging strategy adapted to the Segformer architecture. By applying merging after Spatial Reduction Attention with stage-wise rates for queries and keys/values, Segformer++ achieves substantial inference speedups (e.g., up to 61% on Cityscapes) while preserving mIoU and small-object accuracy, and it also reduces training memory and improves throughput. It presents two practical variants, Segformer++HQ and Segformer++fast, and compares them against a 2D Neighbor Merging baseline across semantic segmentation and human pose estimation tasks. The results indicate strong potential for real-time, edge-optimized deployment of transformer-based dense-prediction models on high-resolution data, with the method generalizable to other architectures that combine convolution and attention.
Abstract
Utilizing transformer architectures for semantic segmentation of high-resolution images is hindered by the attention's quadratic computational complexity in the number of tokens. A solution to this challenge involves decreasing the number of tokens through token merging, which has exhibited remarkable enhancements in inference speed, training efficiency, and memory utilization for image classification tasks. In this paper, we explore various token merging strategies within the framework of the Segformer architecture and perform experiments on multiple semantic segmentation and human pose estimation datasets. Notably, without model re-training, we, for example, achieve an inference acceleration of 61% on the Cityscapes dataset while maintaining the mIoU performance. Consequently, this paper facilitates the deployment of transformer-based architectures on resource-constrained devices and in real-time applications.
