[ViT] An Image is worth 16x16 words: Transformers for image recognition at scale

1、目的

        用纯transformer结构的网络来进行图像分类任务

2、方法

        Vision Transformer (ViT)

        1)将图像划分为小patch

                x\epsilon \mathbb{R}^{H\times W\times C} -> x_{p}\epsilon \mathbb{R}^{N\times (P^{2}\cdot C)},其中N=HW/P^{2}

        2)patch embedding

                用trainable linear projection将patch展平为D维向量

        3)classification head

                MLP:one hidden layer (pre-training time), single linear layer (fine-tuning time)

        4)position embedding

                和patch embedding相加,作为网络输入

                learnable 1D; 2D-aware 对结果无提升

        5)Transformer encoder

                multiheaded self-attention (MSA)

        6)hybrid architecture

                除了用raw image patches,还可以用CNN提取的feature map

        7)fine-tuning

                去除pre-trained prediciton head,连接一个0初始化的D\times K前传层(K是downstream类别数)

                对于higher resolution图像,保持patch size不变,增加sequence长度;对pre-trained position embedding进行2D插值

3、结论

        1)inductive bias

                CNN每一个卷积层天然包含了一些归纳偏置信息:二维局部相邻信息;平移不变性

                而ViT的归纳偏置信息则较弱。MLP层是局部和平移不变的,而self-attention层则是全局的,初始position embedding不包含2D位置信息,不同patch之间的空间关联需要learn from scratch

        2)在中型数据集上,ViT的表现不如ResNet,但在大数据集上预训练之后再迁移到小数据集上,ViT表现最佳

  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值