提出一种能感知语义的二维位置编码,让视觉Transformer更懂图像中远距离相似区域的关系。
A 2D Semantic-Aware Position Encoding for Vision Transformers
- 用局部内容动态调整位置表示,不再依赖固定坐标或线性顺序
- 在多个数据集上提升模型对不同分辨率和重复结构的适应能力
- 适合处理有语义关联但空间分散的图像任务,如遥感、医学影像
视觉变换器凭借自注意力机制在计算机视觉任务中表现出显著优势,能够捕捉长距离依赖和上下文关系。然而,现有位置编码技术主要借鉴自然语言处理,难以有效捕捉图像块间的语义相关位置关系。传统方法如绝对和相对位置编码仅关注一维线性位置关系,常忽略远距离但语义相关的图像块之间的联系,限制了模型的泛化能力、平移等变性以及对图像中重复或结构化模式的处理能力。本文提出二维语义感知位置编码($ ext{SaPE}^2$),一种基于局部内容动态适应位置表示的新方法,不依赖固定的空间坐标或线性位置关系。通过将$ ext{SaPE}^2$集成到视觉变换器中,增强了模型在不同图像分辨率和尺度下的泛化能力,提升了平移等变性,并更好聚合视觉相似但空间分离的特征。该方法弥合了位置编码与感知相似性之间的差距,显著改善了各类视觉任务的性能。
原文摘要 · Abstract (English)
Vision transformers have demonstrated significant advantages in computer vision tasks due to their ability to capture long-range dependencies and contextual relationships through self-attention. However, existing position encoding techniques, which are largely borrowed from natural language processing, fail to effectively capture semantic-aware positional relationships between image patches. Traditional approaches like absolute position encoding and relative position encoding primarily focus on 1D linear position relationship, often neglecting the semantic similarity between distant yet contextually related patches. These limitations hinder model generalization, translation equivariance, and the ability to effectively handle repetitive or structured patterns in images. In this paper, we propose 2-Dimensional Semantic-Aware Position Encoding ($\text{SaPE}^2$), a novel position encoding method with semantic awareness that dynamically adapts position representations by leveraging local content instead of fixed linear position relationship or spatial coordinates. Our method enhances the model's ability to generalize across varying image resolutions and scales, improves translation equivariance, and better aggregates features for visually similar but spatially distant patches. By integrating $\text{SaPE}^2$ into vision transformers, we bridge the gap between position encoding and perceptual similarity, thereby improving performance on computer vision tasks.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。