arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2107.12292cs.CVcs.AIcs.LGcs.MM
收藏

用于视觉识别的上下文Transformer网络

Contextual Transformer Networks for Visual Recognition

JD AI Research(京东人工智能研究院)

Yehao Li, Ting Yao, Yingwei Pan, Tao Mei

摘要:

具有自我注意力的Transformer导致了自然语言处理领域的革命性变化,最近激发了Transformer风格架构设计的出现,并在众多计算机视觉任务中取得了竞争性结果。然而,大多数现有的设计直接采用自注意的2D特征映射,以获得注意力矩阵的基础上对孤立的查询和关键字在每个空间位置,但离开丰富的上下文之间的邻居关键字开发不足。在这项工作中,我们设计了一个新的transformer风格的模块,即,上下文Transformer(CoT)块,用于视觉识别。这种设计充分利用了输入键之间的上下文信息来指导动态注意矩阵的学习,从而增强了视觉表征能力。从技术上讲,CoT块首先通过$3\times3$卷积对输入键进行上下文编码,从而得到输入的静态上下文表示。我们进一步将编码的键与输入查询连接起来,通过两个连续的$1\times1$卷积来学习动态多头注意力矩阵。学习的注意力矩阵乘以输入值,以实现输入的动态上下文表示。静态和动态语境表征的融合最终作为输出。我们的CoT块很有吸引力,因为它可以很容易地替换ResNet架构中的每个$3\times3$卷积,产生一个名为上下文Transformer网络(CoTNet)的transformer风格的主干。通过在广泛的应用(例如,图像识别、目标检测和实例分割),我们验证了CoTNet作为更强大主干的优越性。源代码可在\url{https://github.com/JDAI-CV/CoTNet}获得。

英文摘要:

Transformer with self-attention has led to the revolutionizing of natural language processing field, and recently inspires the emergence of Transformer-style architecture design with competitive results in numerous computer vision tasks. Nevertheless, most of existing designs directly employ self-attention over a 2D feature map to obtain the attention matrix based on pairs of isolated queries and keys at each spatial location, but leave the rich contexts among neighbor keys under-exploited. In this work, we design a novel Transformer-style module, i.e., Contextual Transformer (CoT) block, for visual recognition. Such design fully capitalizes on the contextual information among input keys to guide the learning of dynamic attention matrix and thus strengthens the capacity of visual representation. Technically, CoT block first contextually encodes input keys via a $3\times3$ convolution, leading to a static contextual representation of inputs. We further concatenate the encoded keys with input queries to learn the dynamic multi-head attention matrix through two consecutive $1\times1$ convolutions. The learnt attention matrix is multiplied by input values to achieve the dynamic contextual representation of inputs. The fusion of the static and dynamic contextual representations are finally taken as outputs. Our CoT block is appealing in the view that it can readily replace each $3\times3$ convolution in ResNet architectures, yielding a Transformer-style backbone named as Contextual Transformer Networks (CoTNet). Through extensive experiments over a wide range of applications (e.g., image recognition, object detection and instance segmentation), we validate the superiority of CoTNet as a stronger backbone. Source code is available at \url{https://github.com/JDAI-CV/CoTNet}.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑