Visual Transformers: Token-based Image Representation and Processing for Computer Vision

TL;DR

Proposed Visual Transformer (VT) with 16 semantic tokens improves ImageNet top-1 accuracy by 4.6-7 points, reduces FLOPs by 6.5x.

cs.CV 🔴 Advanced 2020-06-06 44 views
Bichen Wu Chenfeng Xu Xiaoliang Dai Alvin Wan Peizhao Zhang Zhicheng Yan Masayoshi Tomizuka Joseph Gonzalez Kurt Keutzer Peter Vajda
Computer Vision Transformer Semantic Tokens Efficiency Representation

Key Findings

Methodology

This work shifts image representation from pixel space to semantic token space, combining convolutional low-level feature extraction with token-based semantic grouping. It introduces filter-based and recurrent tokenizers to generate a small set of high-level semantic tokens, then models their relationships via Transformer self-attention modules. The approach replaces the last stage of ResNet and modules in FPN, achieving significant computational savings while boosting accuracy. The framework supports end-to-end training and flexible adaptation for classification and segmentation tasks.

Key Results

  • Replacing the last ResNet stage with VT reduces FLOPs by 6.9x and improves Top-1 accuracy by 4.6-7 points on ImageNet, demonstrating superior efficiency and performance.
  • In semantic segmentation on COCO-stuff and LIP, VT-based FPN achieves 0.35 points higher mIoU with 6.4x fewer FLOPs, validating the effectiveness of semantic token relation modeling.
  • Ablation studies show that as few as 16 tokens suffice for optimal performance, with Transformer-based relation modeling outperforming graph convolution, confirming the importance of content-aware semantic relationships.

Significance

This research addresses fundamental limitations of pixel-based convolutions, such as uniform treatment of all pixels and difficulty modeling long-range dependencies. By introducing semantic tokens and Transformer-based relation modeling, it enables more efficient, content-aware, and scalable vision models. The approach has broad implications for deploying high-performance models in resource-constrained environments, advancing both academic research and industry applications in image classification, segmentation, and beyond.

Technical Contribution

The paper presents a hybrid architecture combining convolutional feature extraction with a small set of semantic tokens processed by Transformer self-attention. It innovates in token generation (filter-based and recurrent), relation modeling (self-attention vs. graph convolution), and feature projection, enabling significant reductions in FLOPs and parameters while maintaining or improving accuracy. The framework supports training from scratch and flexible task adaptation, setting new standards for efficiency and effectiveness.

Novelty

This work is the first to systematically leverage a small set of semantic tokens for high-level image representation, replacing dense pixel processing with a sparse, content-aware approach. Unlike prior ViT models requiring massive data and compute, this method combines convolutional and Transformer modules to achieve superior performance with far fewer tokens and computational resources, representing a paradigm shift in vision modeling.

Limitations

  • The approach relies on a fixed small number of tokens, which may limit fine-grained detail in extremely complex or high-resolution tasks. Its performance in such scenarios needs further validation.
  • Training still demands substantial data and hyperparameter tuning; generalization to unseen domains or low-data regimes remains to be explored.
  • The current multi-scale and multi-layer token mechanisms are preliminary; more sophisticated hierarchical or adaptive token strategies could further improve robustness and scalability.

Future Work

Future directions include developing multi-scale token generation, integrating self-supervised learning for better generalization, and extending the framework to video and 3D data. Enhancing the model's ability to handle ultra-high resolution images and complex scenes will further broaden its practical impact.

AI Executive Summary

Traditional computer vision models rely heavily on pixel-wise convolution operations, which, despite their success, face inherent limitations. They treat all pixels equally, regardless of importance, leading to inefficiencies in computation and representation. Moreover, modeling long-range dependencies between distant semantic concepts remains challenging due to the localized nature of convolution kernels. Recent advances like Vision Transformer (ViT) attempted to address these issues by dividing images into patches and applying self-attention, but this approach incurs enormous computational costs, requiring massive datasets and training resources.

In response, this work proposes a novel architecture called Visual Transformer (VT), which fundamentally redefines image representation. Instead of dense pixel processing, the model first extracts low-level features via convolution, then groups these features into a small set of semantic tokens—compact representations of high-level concepts. These tokens are processed by a Transformer module that models their relationships through self-attention, capturing long-range dependencies efficiently. The key innovation lies in the minimal number of tokens—only 16—yet capable of representing complex semantic content.

Extensive experiments on ImageNet demonstrate that replacing the last stage of ResNet with VT reduces FLOPs by 6.9x while improving accuracy by 4.6-7 points. Similarly, in semantic segmentation tasks on COCO-stuff and LIP, VT-based FPN achieves 0.35 higher mIoU with 6.4x fewer FLOPs. Ablation studies confirm that a small set of tokens suffices, and Transformer-based relation modeling outperforms graph convolution approaches.

This paradigm shift offers a pathway toward more efficient, scalable, and content-aware vision models. It addresses core challenges of computational redundancy and long-range dependency modeling, paving the way for deploying high-performance models in resource-constrained environments. The work opens avenues for future research into multi-scale tokens, self-supervised training, and broader applications across vision tasks.

Deep Analysis

Background

深度学习推动了计算机视觉的快速发展,卷积神经网络(如ResNet、DenseNet)成为主流架构。Transformer在自然语言处理中的成功激发了其在视觉中的应用尝试,如ViT和DETR,但这些模型普遍面临计算成本高、对大规模数据依赖的问题。近年来,研究者引入稀疏关系建模、图卷积等技术,试图提升效率和表达能力,但仍受限于像素级冗余和长距离关系建模困难。本文旨在突破这些瓶颈,提出以少量语义Token为核心的Transformer架构,结合卷积提取低级特征,优化高层语义关系的表达。

Core Problem

现有模型在处理重要区域和长距离依赖时表现不足,导致计算资源浪费和性能瓶颈。全像素Transformer虽能捕获长距离依赖,但计算成本极高,不适合大规模应用。如何在保证信息丰富的同时,显著降低计算复杂度,成为核心难题。此外,模型在不同任务中的语义表达效率和效果仍有提升空间。

Innovation

主要创新点包括:1)引入少量语义Token作为图像的抽象表达,减少冗余信息;2)设计多种Tokenizer(滤波器式、递归式)实现高效语义分组;3)利用Transformer关系模块替代图卷积,支持动态关系建模;4)结合卷积和Transformer优势,优化特征提取与关系建模流程。这些创新使模型在保持高性能的同时,大幅降低计算成本,支持端到端训练。

Methodology

  • �� 输入图像经过卷积提取低级特征,形成特征图X。• 通过Tokenizer(滤波器或递归)将特征图像素分组成少量语义Token(L=16),每个Token代表一个高层语义概念。• 利用Transformer关系模块对Token进行自注意力建模,捕获Token间的长距离依赖。• 将关系信息投影回像素空间,融合到原始特征图,增强像素级表达。• 最终,模型可用于图像分类(通过Token池化)或像素级任务(如语义分割)。• 在ResNet和FPN架构中替换最后一阶段的卷积层,验证模型效果。

Experiments

在ImageNet上,采用SGD优化,学习率0.1,90轮训练,批量256。对比ResNet,VT模型在参数相似条件下,FLOPs降低6.9倍,准确率提升4.6-7点。不同Tokenizer(滤波器、递归)和关系模块(Transformer、图卷积)进行了对比,验证少量Token和Transformer优越性。在COCO-stuff和LIP数据集上,VT-FPN模型在mIoU上优于传统FPN,同时大幅减少FLOPs。多种Token数量和投影策略的消融实验进一步验证了设计选择的合理性。

Results

模型在ImageNet分类中,替换最后一阶段后,FLOPs显著降低,准确率提升,验证了效率和性能的双重提升。在语义分割任务中,VT-FPN模型在保持或超越传统模型性能的同时,FLOPs减少6.4倍,显示出极强的实用性。Token数量的消融实验表明,16个Token已足够表达复杂语义,关系建模优于图卷积,验证了设计的有效性。整体结果证明,少量语义Token结合Transformer关系机制,是提升视觉模型效率和效果的有效途径。

Applications

该架构适用于大规模图像分类、目标检测、语义分割等任务,特别适合边缘设备和资源有限场景。通过减少计算量,能在移动端实现高性能视觉识别。未来,可结合自监督学习,提升模型在无标签数据上的表现,推动智能监控、自动驾驶等行业应用。

Limitations & Outlook

模型对Token数量较少的依赖可能在极端复杂场景下表现不足,尤其在细粒度识别任务中可能存在信息不足的问题。此外,训练仍需大量数据和长时间调优,模型在极端低资源环境下的泛化能力有限。未来需探索多尺度、多层次Token机制和更高效的关系建模策略,以应对更复杂的视觉任务。

Plain Language Accessible to non-experts

想象你在厨房里做饭,传统的方法就像用很多不同的调料,每次都把所有调料都放进去,不管你需要不需要。这会很麻烦,也浪费时间。现在,厨师发现只用几种关键调料就能做出美味的菜,而且还知道哪些调料放多放少。这个新方法就像用少量的“调料Token”来代表菜的主要味道,然后用智能的厨师(Transformer)决定哪些味道需要强调。这样,既省事又能做出更好吃的菜。它用类似的方法,把复杂的图片变成几个代表内容的“调料”,再用聪明的“厨师”分析它们之间的关系,最后还原成完整的菜肴。这个过程比用很多调料一一试验更快更省力,也更智能。

ELI14 Explained like you're 14

想象你在学校的图书馆里找书,传统的方法就像每次都翻遍所有书架,花很多时间。而这个新方法像是只带几本重点书,快速找到你需要的内容。它用一种特别的“标签”把书本的内容总结成几句话(语义Token),然后用聪明的机器人(Transformer)分析这些标签之间的关系,理解整个图书馆的内容。这样,你就可以用更少的时间找到想要的知识,还能理解得更深。这个技术就像让图书馆变得更聪明,知道哪些书最重要,哪些内容需要重点关注。它让我们用更少的努力,得到更好的结果,就像用智慧取胜一样。

Glossary

Transformer(变换器)

一种基于自注意力机制的模型,能捕获序列中远距离元素的关系。论文中用来建模语义Token之间的关系。

用于关系建模和关系关系学习。

语义Token(Semantic Token)

代表图像中高层语义概念的紧凑表达,数量远少于像素点。

核心创新,用于替代像素级特征。

FLOPs(浮点运算次数)

衡量模型计算复杂度的指标,表示每秒浮点数运算次数。

用来比较模型效率。

ResNet(残差网络)

一种深层卷积神经网络,利用残差连接解决深层训练难题。

作为基础架构进行改造。

FPN(特征金字塔网络)

一种多尺度特征融合结构,用于目标检测和语义分割。

与VT结合优化性能。

Open Questions Unanswered questions from this research

  • 1 如何在极端低资源环境下保持模型性能?
  • 2 多尺度Token生成机制的具体实现和优化策略?
  • 3 在更复杂场景(如视频、3D)中的适应性和扩展性?

Applications

Immediate Applications

移动端图像识别

利用低计算成本实现高准确率的手机或边缘设备图像识别,适合实时监控和智能家居。

自动驾驶感知系统

在自动驾驶中,用高效模型实现目标检测和场景理解,减少硬件资源消耗。

Long-term Vision

智能视觉系统普及

推动高性能视觉模型在工业、医疗、安防等行业的广泛应用,实现智能化升级。

Abstract

Computer vision has achieved remarkable success by (a) representing images as uniformly-arranged pixel arrays and (b) convolving highly-localized features. However, convolutions treat all image pixels equally regardless of importance; explicitly model all concepts across all images, regardless of content; and struggle to relate spatially-distant concepts. In this work, we challenge this paradigm by (a) representing images as semantic visual tokens and (b) running transformers to densely model token relationships. Critically, our Visual Transformer operates in a semantic token space, judiciously attending to different image parts based on context. This is in sharp contrast to pixel-space transformers that require orders-of-magnitude more compute. Using an advanced training recipe, our VTs significantly outperform their convolutional counterparts, raising ResNet accuracy on ImageNet top-1 by 4.6 to 7 points while using fewer FLOPs and parameters. For semantic segmentation on LIP and COCO-stuff, VT-based feature pyramid networks (FPN) achieve 0.35 points higher mIoU while reducing the FPN module's FLOPs by 6.5x.

cs.CV cs.LG eess.IV