arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2203.11987cs.CV
收藏

PaCa-ViT:在视觉Transformer中学习Patch到Cluster的注意力

PaCa-ViT: Learning Patch-to-Cluster Attention in Vision Transformers

NC State(北卡罗来纳州立大学);BlueHalo(BlueHalo公司)

Ryan Grainger, Thomas Paniagua, Xi Song, Naresh Cuntoor, Mun Wai Lee, Tianfu Wu

AI总结:

本文提出PaCa-ViT,通过将patch到patch的注意力改为patch到聚类的注意力,将复杂度降至线性,提升了模型效率与可解释性,并在分类、检测和分割任务上显著优于现有方法。

摘要:

视觉Transformer(ViTs)建立在将图像块(patch)视为“视觉token”的假设之上,并学习patch到patch的注意力。基于patch嵌入的分词器与其对应物文本分词器之间存在语义鸿沟。patch到patch的注意力存在二次复杂度问题,同时也使得解释学习到的ViT变得困难。为了解决ViT中的这些问题,本文提出在ViT中学习Patch到Cluster的注意力(PaCa)。我们的PaCa-ViT中的查询(queries)以patch开始,而键(keys)和值(values)直接基于聚类(具有预定义的少量簇)。这些簇是端到端学习的,能带来更好的分词器,并引发联合的“为注意力而聚类”和“为聚类而注意力”机制,从而构建更好且可解释的模型。二次复杂度被放宽为线性复杂度。所提出的PaCa模块被用于设计高效且可解释的ViT主干网络和语义分割头网络。在实验中,所提出的方法在ImageNet-1k图像分类、MS-COCO目标检测与实例分割以及MIT-ADE20k语义分割上进行了测试。与现有技术相比,它在ImageNet-1k和MIT-ADE20k上以显著优势优于SWin和PVTs,在所有三个基准测试中均取得更好性能。由于线性复杂度,它在MS-COCO和MIT-ADE20k上也比PVT模型高效得多。学习到的簇具有语义意义。代码和模型检查点可在https://github.com/iVMCL/PaCaViT获取。

英文摘要:

Vision Transformers (ViTs) are built on the assumption of treating image patches as ``visual tokens" and learn patch-to-patch attention. The patch embedding based tokenizer has a semantic gap with respect to its counterpart, the textual tokenizer. The patch-to-patch attention suffers from the quadratic complexity issue, and also makes it non-trivial to explain learned ViTs. To address these issues in ViT, this paper proposes to learn Patch-to-Cluster attention (PaCa) in ViT. Queries in our PaCa-ViT starts with patches, while keys and values are directly based on clustering (with a predefined small number of clusters). The clusters are learned end-to-end, leading to better tokenizers and inducing joint clustering-for-attention and attention-for-clustering for better and interpretable models. The quadratic complexity is relaxed to linear complexity. The proposed PaCa module is used in designing efficient and interpretable ViT backbones and semantic segmentation head networks. In experiments, the proposed methods are tested on ImageNet-1k image classification, MS-COCO object detection and instance segmentation and MIT-ADE20k semantic segmentation. Compared with the prior art, it obtains better performance in all the three benchmarks than the SWin and the PVTs by significant margins in ImageNet-1k and MIT-ADE20k. It is also significantly more efficient than PVT models in MS-COCO and MIT-ADE20k due to the linear complexity. The learned clusters are semantically meaningful. Code and model checkpoints are available at https://github.com/iVMCL/PaCaViT.

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

↑