[ViT] An Image is worth 16x16 words: Transformers for image recognition at scale
1、目的
用纯transformer结构的网络来进行图像分类任务
2、方法
Vision Transformer (ViT)


1)将图像划分为小patch
->
,其中
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初始化的前传层(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表现最佳
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐


所有评论(0)