Transformers have made great progress in dealing with computer vision tasks. However, existing vision transformers do not yet possess the ability of building the interactions among features of different scales, which is perceptually important to visual inputs. The reasons are two-fold: (1) Input embeddings of each layer are equal-scale, so no cross-scale feature can be extracted; (2) to lower the computational cost, some vision transformers merge adjacent embeddings inside the self-attention module, thus sacrificing small-scale (fine-grained) features of the embeddings and also disabling the cross-scale interactions. To this end, we propose Cross-scale Embedding Layer (CEL) and Long Short Distance Attention (LSDA). On the one hand, CEL blends each embedding with multiple patches of different scales, providing the self-attention module itself with cross-scale features. On the other hand, LSDA splits the self-attention module into a short-distance one and a long-distance counterpart, which not only reduces the computational burden but also keeps both small-scale and large-scale features in the embeddings. Through the above two designs, we achieve cross-scale attention. Besides, we put forward a dynamic position bias for vision transformers to make the popular relative position bias apply to variable-sized images. Hinging on the cross-scale attention module, we construct a versatile vision architecture, dubbed CrossFormer, which accommodates variable-sized inputs. Extensive experiments show that CrossFormer outperforms the other vision transformers on image classification, object detection, instance segmentation, and semantic segmentation tasks. The code has been released: https://github.com/cheerss/CrossFormer.
翻译:然而,现有的视觉变异器尚不具备在不同规模特征之间建立互动的能力,而这种互动对于视觉输入具有明显的重要性。原因有二:(1) 每个层的输入嵌入是等规模的,因此无法提取跨规模的特性;(2) 为了降低计算成本,一些视觉变异器将自控模块内部的相邻嵌入到自控模块内,从而牺牲嵌入的小型(非硬化)功能,同时使跨规模的变压层(CEL)和长距离关注(LSDA) 。一方面, CEL将每个层的嵌入嵌入是等规模的,因此无法提取跨规模的特性;(2) 为了降低计算成本,一些视觉变压器将自控模块分割成一个短距离的模块和长距离的对口,不仅减轻计算负担,而且还保持小层次的变压层跨层(CEL) 和长距离关注(LSD) 一方面, CEL 将每个变压结构的特性混合到动态变压结构中, 向上,我们向上展示了另一个变压式的变压式结构。