[Paper Review] UniFormer: Unifying Convolution and Self-attention for Visual Recognition
UniFormer unifies convolution and self-attention in a concise transformer block to tackle local redundancy and global dependency, achieving strong accuracy-efficiency across image and video tasks. It introduces dynamic position embedding and a multi-head relation aggregator with local (shallow) and global (deep) token affinity.
It is a challenging task to learn discriminative representation from images and videos, due to large local redundancy and complex global dependency in these visual data. Convolution neural networks (CNNs) and vision transformers (ViTs) have been two dominant frameworks in the past few years. Though CNNs can efficiently decrease local redundancy by convolution within a small neighborhood, the limited receptive field makes it hard to capture global dependency. Alternatively, ViTs can effectively capture long-range dependency via self-attention, while blind similarity comparisons among all the tokens lead to high redundancy. To resolve these problems, we propose a novel Unified transFormer (UniFormer), which can seamlessly integrate the merits of convolution and self-attention in a concise transformer format. Different from the typical transformer blocks, the relation aggregators in our UniFormer block are equipped with local and global token affinity respectively in shallow and deep layers, allowing to tackle both redundancy and dependency for efficient and effective representation learning. Finally, we flexibly stack our UniFormer blocks into a new powerful backbone, and adopt it for various vision tasks from image to video domain, from classification to dense prediction. Without any extra training data, our UniFormer achieves 86.3 top-1 accuracy on ImageNet-1K classification. With only ImageNet-1K pre-training, it can simply achieve state-of-the-art performance in a broad range of downstream tasks, e.g., it obtains 82.9/84.8 top-1 accuracy on Kinetics-400/600, 60.9/71.2 top-1 accuracy on Sth-Sth V1/V2 video classification, 53.8 box AP and 46.4 mask AP on COCO object detection, 50.8 mIoU on ADE20K semantic segmentation, and 77.4 AP on COCO pose estimation. We further build an efficient UniFormer with 2-4x higher throughput. Code is available at https://github.com/Sense-X/UniFormer.
Motivation & Objective
- Motivate the need to balance local redundancy reduction and global dependency capture in visual recognition.
- Propose a unified transformer block that blends convolutional and self-attention mechanisms in a single framework.
- Design a lightweight, flexible backbone that performs well from image to video tasks with efficient computation.
- Demonstrate strong performance across classification, detection, segmentation, and pose estimation without extra training data or with standard ImageNet pre-training.
Proposed method
- Introduce Dynamic Position Embedding (DPE) to inject position information via lightweight depthwise convolution.
- Develop Multi-Head Relation Aggregator (MHRA) that provides local affinity in shallow layers and global affinity in deep layers.
- Formulate MHRA as R_n(X)=A_n V_n(X) and MHRA(X)=Concat(R_1,...,R_N)U, enabling a unified convolution/self-attention token relation learning.
- Instantiate local MHRA as a PWConv-DWConv-PWConv block with a 5x5 depthwise convolution and a learnable relative-position-like matrix.
- Instantiate global MHRA as a multi-head self-attention with Q/K-based token affinity for joint spatiotemporal relations (image as 1 frame).
- Assemble UniFormer blocks into four-stage backbones for images and extend to 3D for videos, with BN/LN and FFN (GELU) for feature refinement.
- Propose an efficient Hourglass UniFormer (H-UniFormer) variant with token shrinking/recovering to boost throughput.
Experimental results
Research questions
- RQ1Can a unified block that combines local convolution-like affinity and global self-attention improve accuracy and efficiency across image and video tasks?
- RQ2Does dynamic position embedding combined with a local-then-global relation aggregator provide better representation learning than pure CNNs or ViTs?
- RQ3How does UniFormer perform on downstream tasks such as object detection, segmentation, and pose estimation compared to existing backbones?
- RQ4Can a lightweight UniFormer variant maintain performance while significantly increasing throughput?
Key findings
- Achieves 86.3 top-1 accuracy on ImageNet-1K without extra training data.
- With ImageNet-1K pre-training, reaches 82.9/84.8 top-1 on Kinetics-400/600 and 60.9/71.2 on Something-Something V1/V2.
- Attains 53.8 box AP and 46.4 mask AP on COCO object detection and instance segmentation tasks.
- Achieves 50.8 mIoU on ADE20K semantic segmentation and 77.4 AP on COCO pose estimation.
- UniFormer-Hourglass variant delivers 2–4× higher throughput than recent lightweight models while preserving performance.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.