Skip to main content
QUICK REVIEW

[Paper Review] Lightweight Vision Transformer with Cross Feature Attention

Youpeng Zhao, Huadong Tang|arXiv (Cornell University)|Jul 15, 2022
Advanced Neural Network ApplicationsComputer Science8 citations
TL;DR

This paper proposes Cross Feature Attention (XFA), a lightweight self-attention mechanism that reduces computational complexity from quadratic to linear by operating on feature dimensions instead of token sequences. The method enables a hybrid CNN-ViT model, XFormer, which achieves state-of-the-art performance on ImageNet-1K (78.5% top-1 accuracy), COCO object detection (33.2 mAP), and Cityscapes semantic segmentation (78.5 mIoU), outperforming MobileNetV2 and DeiT with fewer parameters and FLOPs.

ABSTRACT

Recent advances in vision transformers (ViTs) have achieved great performance in visual recognition tasks. Convolutional neural networks (CNNs) exploit spatial inductive bias to learn visual representations, but these networks are spatially local. ViTs can learn global representations with their self-attention mechanism, but they are usually heavy-weight and unsuitable for mobile devices. In this paper, we propose cross feature attention (XFA) to bring down computation cost for transformers, and combine efficient mobile CNNs to form a novel efficient light-weight CNN-ViT hybrid model, XFormer, which can serve as a general-purpose backbone to learn both global and local representation. Experimental results show that XFormer outperforms numerous CNN and ViT-based models across different tasks and datasets. On ImageNet1K dataset, XFormer achieves top-1 accuracy of 78.5% with 5.5 million parameters, which is 2.2% and 6.3% more accurate than EfficientNet-B0 (CNN-based) and DeiT (ViT-based) for similar number of parameters. Our model also performs well when transferring to object detection and semantic segmentation tasks. On MS COCO dataset, XFormer exceeds MobileNetV2 by 10.5 AP (22.7 -> 33.2 AP) in YOLOv3 framework with only 6.3M parameters and 3.8G FLOPs. On Cityscapes dataset, with only a simple all-MLP decoder, XFormer achieves mIoU of 78.5 and FPS of 15.3, surpassing state-of-the-art lightweight segmentation networks.

Motivation & Objective

  • To address the high computational cost of vision transformers (ViTs) in mobile and lightweight settings.
  • To overcome the limitations of standard self-attention, which scales quadratically with sequence length and hinders deployment on edge devices.
  • To design a hybrid architecture that combines the local inductive bias of CNNs with the global modeling capability of efficient ViTs.
  • To develop a general-purpose, efficient backbone that performs well across classification, detection, and segmentation tasks.

Proposed method

  • Proposes Cross Feature Attention (XFA), a novel attention mechanism that computes attention across feature dimensions rather than token dimensions, reducing complexity to linear with respect to sequence length.
  • Replaces the standard softmax operation in self-attention with a learnable scaling parameter to stabilize training and improve optimization.
  • Introduces a hierarchical XFormer architecture composed of alternating efficient CNN blocks and XFA transformer blocks to balance local and global feature learning.
  • Employs a simple all-MLP decoder for semantic segmentation, minimizing additional computation while maintaining high performance.
  • Uses knowledge distillation and data augmentation techniques during pretraining on ImageNet-1K to improve generalization.
  • Deploys the model in YOLOv3 and SegFormer frameworks to evaluate transferability and efficiency on detection and segmentation tasks.

Experimental results

Research questions

  • RQ1Can a self-attention mechanism be redesigned to achieve linear complexity while preserving global modeling capacity in vision transformers?
  • RQ2How can CNNs and ViTs be effectively combined in a lightweight architecture to improve performance on mobile vision tasks?
  • RQ3Can a hybrid CNN-ViT model outperform both state-of-the-art CNNs and ViTs in terms of accuracy, parameter efficiency, and FLOPs across multiple vision benchmarks?
  • RQ4Does the proposed XFormer backbone generalize well to downstream tasks such as object detection and semantic segmentation without heavy decoders?

Key findings

  • On ImageNet-1K, XFormer achieves 78.5% top-1 accuracy with only 5.5 million parameters and 1.7G FLOPs, outperforming EfficientNet-B0 by 2.2% and DeiT by 6.3% under similar parameter budgets.
  • In object detection on MS COCO, XFormer boosts YOLOv3 performance to 33.2 mAP, a 10.5-point improvement over MobileNetV2, while using 56% fewer parameters and 22% fewer FLOPs.
  • For semantic segmentation on Cityscapes, XFormer achieves 78.5 mIoU with a simple all-MLP decoder, surpassing MobileViT-based SegFormer by 2.9 mIoU and state-of-the-art LVT by 3.6 mIoU.
  • XFormer maintains high inference speed, achieving 15.3 FPS on Cityscapes and outperforming ViT-based models like YOLOS and MobileViT in both accuracy and speed.
  • The model demonstrates strong transferability, significantly improving performance on detection and segmentation tasks when used as a backbone, even with minimal architectural modifications.
  • The ablation study confirms that XFA’s linear complexity and learnable scaling factor contribute to both efficiency and performance gains, especially in low-resource settings.

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.