Skip to main content
QUICK REVIEW

[Paper Review] TopFormer: Token Pyramid Transformer for Mobile Semantic Segmentation

Wenqiang Zhang, Zilong Huang|arXiv (Cornell University)|Apr 12, 2022
Advanced Neural Network ApplicationsComputer Science16 citations
TL;DR

TopFormer proposes a mobile-optimized Vision Transformer for semantic segmentation that uses a token pyramid module to extract multi-scale features and a semantics injection mechanism to fuse scale-aware global representations into local tokens. It achieves 5% higher mIoU than MobileNetV3 with lower latency on mobile devices, and the tiny version enables real-time inference on ARM-based hardware.

ABSTRACT

Although vision transformers (ViTs) have achieved great success in computer vision, the heavy computational cost hampers their applications to dense prediction tasks such as semantic segmentation on mobile devices. In this paper, we present a mobile-friendly architecture named extbf{To}ken extbf{P}yramid Vision Trans extbf{former} ( extbf{TopFormer}). The proposed extbf{TopFormer} takes Tokens from various scales as input to produce scale-aware semantic features, which are then injected into the corresponding tokens to augment the representation. Experimental results demonstrate that our method significantly outperforms CNN- and ViT-based networks across several semantic segmentation datasets and achieves a good trade-off between accuracy and latency. On the ADE20K dataset, TopFormer achieves 5\% higher accuracy in mIoU than MobileNetV3 with lower latency on an ARM-based mobile device. Furthermore, the tiny version of TopFormer achieves real-time inference on an ARM-based mobile device with competitive results. The code and models are available at: https://github.com/hustvl/TopFormer

Motivation & Objective

  • To design a lightweight, efficient Vision Transformer architecture tailored for mobile semantic segmentation.
  • To address the high computational cost of standard Transformers in dense prediction tasks on resource-constrained devices.
  • To improve accuracy over MobileNetV3 while reducing latency on ARM-based mobile CPUs.
  • To enable real-time inference on mobile devices without model quantization or GPU acceleration.
  • To generalize the architecture to other dense prediction tasks like object detection.

Proposed method

  • A token pyramid module processes high-resolution images using stacked lightweight MobileNetV2 blocks with fast down-sampling to generate multi-scale feature tokens.
  • The Semantics Extractor pools tokens from different stages into a very small resolution (e.g., 1/64 of input size) using average pooling, then feeds them into Transformer blocks to learn scale-aware global semantics.
  • A Semantics Injection Module splits the scale-aware global semantics by channel and fuses them back into the corresponding tokens from each scale to enhance representation.
  • The injected tokens are used as input to the segmentation head, enabling hierarchical feature learning with minimal computational overhead.
  • The architecture uses residual connections in the Transformer blocks to preserve scale-awareness in the global semantics.
  • The model is trained end-to-end with cross-entropy and Dice loss for semantic segmentation, and evaluated on ADE20K, Pascal Context, and COCO-Stuff.

Experimental results

Research questions

  • RQ1Can a Vision Transformer be designed to achieve high accuracy with low latency on mobile CPUs for semantic segmentation?
  • RQ2How can scale-aware global semantics be efficiently extracted and injected into multi-scale features to improve representation?
  • RQ3Can a hybrid CNN-Transformer architecture outperform MobileNetV3 in both accuracy and inference speed on mobile devices?
  • RQ4Does the proposed method generalize to other dense prediction tasks such as object detection?
  • RQ5What is the optimal trade-off between model size, FLOPs, and inference latency for mobile deployment?

Key findings

  • On the ADE20K validation set, TopFormer-B achieves 45.28% mIoU with only 1.25 GFLOPs, outperforming MobileNetV3 by 5% mIoU while reducing latency.
  • The tiny version of TopFormer (TopFormer-T) achieves real-time inference on an ARM-based Snapdragon 865 CPU with 110ms latency and 0.44 GFLOPs.
  • On Pascal Context, TopFormer-S achieves 43.68% mIoU on 60 categories with only 0.80 GFLOPs for the backbone and 0.18 GFLOPs for the head, outperforming all prior CNN and ViT-based methods.
  • On COCO-Stuff, TopFormer-B achieves 33.43% mIoU with 1.38 GFLOPs, 8% higher than MobileNetV3 with comparable computation.
  • In object detection on COCO, RetinaNet with TopFormer-S backbone achieves 30.4% mAP with 3.7 GFLOPs, outperforming MobileNetV3 and ShuffleNet with lower FLOPs.
  • The Semantics Extractor contributes only 10% to actual latency despite having 74% of the total parameters, indicating high efficiency in computation.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.