The emergence of vision transformers (ViTs) in image classification has shifted the methodologies for visual representation learning. In particular, ViTs learn visual representation at full receptive field per layer across all the image patches, in comparison to the increasing receptive fields of CNNs across layers and other alternatives (e.g., large kernels and atrous convolution). In this work, for the first time we explore the global context learning potentials of ViTs for dense visual prediction (e.g., semantic segmentation). Our motivation is that through learning global context at full receptive field layer by layer, ViTs may capture stronger long-range dependency information, critical for dense prediction tasks. We first demonstrate that encoding an image as a sequence of patches, a vanilla ViT without local convolution and resolution reduction can yield stronger visual representation for semantic segmentation. For example, our model, termed as SEgmentation TRansformer (SETR), excels on ADE20K (50.28% mIoU, the first position in the test leaderboard on the day of submission) and Pascal Context (55.83% mIoU), and performs competitively on Cityscapes. For tackling general dense visual prediction tasks in a cost-effective manner, we further formulate a family of Hierarchical Local-Global (HLG) Transformers, characterized by local attention within windows and global-attention across windows in a pyramidal architecture. Extensive experiments show that our methods achieve appealing performance on a variety of dense prediction tasks (e.g., object detection and instance segmentation and semantic segmentation) as well as image classification. Our code and models are available at https://github.com/fudan-zvg/SETR.
翻译:视觉Transformer(ViTs)在图像分类中的出现,改变了视觉表征学习的方法论。与CNN逐层递增感受野及其他替代方案(如大核卷积和空洞卷积)不同,ViT在每一层对所有图像块进行全感受野的视觉表征学习。本文首次探索了ViT在密集视觉预测(如语义分割)中的全局上下文学习潜力。我们的动机在于:通过逐层学习全感受野的全局上下文,ViT可能捕捉到更强的长距离依赖信息,这对于密集预测任务至关重要。我们首先证明,将图像编码为序列块后,不使用局部卷积和分辨率缩减的原始ViT能够为语义分割生成更强的视觉表征。例如,我们的模型——语义分割Transformer(SETR)——在ADE20K(50.28% mIoU,提交当天测试排行榜第一名)和Pascal Context(55.83% mIoU)上表现优异,在Cityscapes上也具有竞争力。为以经济高效的方式处理通用密集视觉预测任务,我们进一步提出了一系列分层局部-全局(HLG)Transformer,其核心特征是在金字塔架构中实现窗口内的局部注意力与窗口间的全局注意力。大量实验表明,我们的方法在多种密集预测任务(如物体检测、实例分割和语义分割)及图像分类上均取得了令人满意的性能。我们的代码与模型已开源:https://github.com/fudan-zvg/SETR。