当前位置:网站首页>[MAE]Masked Autoencoders掩膜自编码器
[MAE]Masked Autoencoders掩膜自编码器
2022-06-23 14:44:00 【luemeon】
目录
随机遮盖输入图片的子块,重建丢失像素
由MAE预训练的模型具有很好的泛化性能
非对称的编码-解码架构:
编码器的输入为没有被mask的子块;
解码器为轻量级
(解码器仅在图像重建的预训练中起作用,因此解码器设计可独立于编码器,且灵活和轻量级),
输入为编码器的输入和被mask部分的位置信息,
输出为待重建的丢失像素的值。
方法
与经典自编码器不同之处在于:
采用了非对称设计,
使编码器仅依赖于 部分观测信息 (无需掩码token信息,BERT需要),
轻量解码器则直接与 所得隐式表达 与 掩码token 进行原始信号重建

流程
- 对图片切分 patch, 随机挑选少部分(比如文中25%)作为网络输入;
- 输入通过 encoder 得到对应编码后的 encoded patches
- 将 encoded patches 还原到对应的原始位置,并在缺失的部分补上 masked patches
- 送入 decoder, 每个 decoder 预测对应 patch 的图像像素点;
- 计算预测的像素和原始图片的像素之间 MSE 作为 loss。(损失函数则采用了MSE,注:类似于BERT仅在掩码块计算损失。)
- 取训练完的模型的 encoder 部分作为下游任务的 basemodel 并在下游任务下 finetune。

编码器
采用ViT架构,但仅作用于可见的未被Mask的块。
先通过 Linear Projection 编码图片,
再加上位置编码,
随后送入一堆连续的 Transformer Block 里面。
编码器的输出将通过reshape构建重建图像,
Reconstruction target 该MAE通过预测每个掩码块的像素值进行原始信息重建 。
由于该编解码仅在较小子集块(比如25%)进行处理,且未用到掩码Token信息。
这就使得可以训练一个非常大的编码器 。
解码器
输入包含:整个图片 patches 集合
(1) 编码器的输出;
(2) 掩码token。
每个 mask tokens 都是一个共享的、学习的向量,它指示了这里有一个待预测的 tokens
将位置嵌入添加到这个完整 image patch 集合中的所有 tokens 中
解码器同样包含一系列Transformer模块。
解码器的最后一层为线性投影层(Linear Projection),其输出通道数等于每个块的像素数量。
MAE解码器 仅在 预训练阶段 用于 图像重建,编码器 则用来生成用于 识别 的图像表达 。
解码器的设计可独立于编码设计,具有高度的灵活性
其重建目标为每个掩码块的规范化像素值 。
计算每个块的均值与标准差,对该块进行归一化,采用归一化的像素作为重建目标提升表达能力。
Simple implementation MAE预训练极为高效:
1.通过 线性投影Linear Projection 与 位置编码 对每个输入块生成token;
2.随机置换(random shuffle)token序列 并根据 掩码比例masking ratio移除 最后一部分token;
3.完成编码后,把 unmasked patches 输出到 Encoder 中,得到这些 tokens 的表征.
在编码块中插入掩码token并反置换(unshuffle)得到全序列token以便于与target进行对齐;
4.把 Encoder 的输出,结合 masked tokens (可学习的向量),执行 unshuffle操作恢复顺序,再一起输入到 Decoder 中。将解码器作用于上述全序列token。
正如上所述:MAE无需稀疏操作。此外,shuffle与unshuffle操作非常快,引入的计算量可以忽略。
分类有ImageNet数据,检测有COCO数据,分割有ADE数据

Partial Fine-tuning
提出了一种 Partial Fine-tuning 的新套路,它不同于之前人们常用的 Linear Probing (只训练最后一层线性分类器的参数) 和 Fine-tuning (训练所有层的参数)。
Partial Fine-tuning 是指 只训练最后模型的若干层的参数
参考链接:
深度分析何恺明新作MAE:通向CV大模型_极市平台的博客-CSDN博客
Masked Autoencoders Are Scalable Vision Learners 论文研读_herosunly的博客-CSDN博客
边栏推荐
- SQL injection vulnerability (principle)
- MySQL series: overview of the overall architecture
- Convert JSON file of labelme to coco dataset format
- 2021-04-15
- MySQL advanced statement 2
- AXI_ Round_ Robin_ Arbiter design - aw and W channels
- Important knowledge of golang: rwmutex read / write lock analysis
- 力扣解法汇总513-找树左下角的值
- Mysql数据库---日志管理、备份与恢复
- 2021-06-03
猜你喜欢

Six programming insights in these five years!
![[普通物理] 光的衍射](/img/1a/20dbd15e0c8c91a3e59753b2f6797a.png)
[普通物理] 光的衍射

mysql 系列:总体架构概述

变压器只能转换交流电,那直流电怎么转换呢?

golang 重要知识:sync.Cond 机制

【opencv450】椒盐噪声demo

A transformer can only convert alternating current. How can I convert direct current?

2021-05-08

Millions of bonuses are waiting for you to get. The first China Yuan universe innovation and application competition is in hot Recruitment!

从3开始,在业务系统中增加分页功能
随机推荐
golang 重要知识:定时器 timer
Error creating bean with name xxx Factory method ‘sqlSessionFactory‘ threw exception; nested excepti
[普通物理] 半波损失 等厚与等倾干涉
百万奖金等你来拿,首届中国元宇宙创新应用大赛联合创业黑马火热招募中!
Important knowledge of golang: mutex
Force deduction solution summary 513- find the value of the lower left corner of the tree
Six programming insights in these five years!
Top 10 purchase, sales and inventory software rankings!
js的slice()和splice()
The work and development steps that must be done in the early stage of the development of the source code of the live broadcasting room
Important knowledge of golang: sync Cond mechanism
JS create an array (literal)
JS里的数组
山东:美食“隐藏款”,消费“扫地僧”
Un million de bonus vous attend, le premier concours d'innovation et d'application de la Chine Yuan cosmique Joint Venture Black Horse Hot Recruitment!
MySQL高级语句一
2021-05-08
Volatile~ variables are not visible under multithreading
杀入美团、饿了么腹地,京东外卖劲儿有多大?
【Pyside2】 pyside2的窗口在maya置顶(笔记)