MAE

Masked Autoencoders Are Scalable Vision Learners[1]

作者是来自FAIR的恺明、Xinlei Chen、Saining Xie等。论文引用[1]:He, Kaiming et al. “Masked Autoencoders Are Scalable Vision Learners.” 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) (2021): 15979-15988.

以下“我们”指代作者

Time

  • 2021.Nov

摘要

  1. MAE:掩码自编码是可扩展的自监督学习器。思路:对输入图片的patches进行随机掩码,然后重构缺失的像素。两个core design:

    • 非对称的encoder-decoder架构;encoder只对patches的visible subset进行操作。lightweight decoder从latent representation和mask tokens中重建原始图片。
    • 对输入图片进行高比例掩码,例如75%,能够产生重要和有意义的自监督任务。

    将两者进行耦合,能够有效和高校地训练大的模型。可扩展的方式能够学习high-capacity models,扩展性很好。普通的(vanilla) ViT-Huge模型在ImageNet-1K上达到87.8%的best accuracy。在下游的任务上迁移的能力超过了监督的预训练,展示出来promising scaling behavior。

总结:

  1. 深度学习见证了能力和容量不断增长的架构的爆炸;在硬件的进步下,模型很容易在 1 million图像上过拟合,开始需要数以亿计的--通常是公开的不可获取的 --标注数据。对大量数据的需求在NLP中通过自己拿度预训练已经成功解决。解决方法是:GPT中基于自回归的模型和BERT中的MAE。它们在概念上都很简单:"they remove a portion of the data and learn to predict the removed content. These methods now enable training of generalizable NLP models containing over one hundred billion parameters."

  2. MAE这个idea,是一般的denosing autoencoders的一种形式,is natural and applicable in computer vision as well。相关的研究早于BERT。尽管在BERT成功之后,很多重要的兴趣在这个idea上,autoencoding的方法的进步在vision中,落后于NLP。what makes MAE different between vision and languange? 我们尝试从下面的角度回答这个问题:

    • in vision, 卷积网络在过去十年占主导地位,卷积操作是典型地在固定的grids上进行操作,不是直接integrate indicators such as mask tokens or positional embeddings into 卷积网络。这个架构的差距,在ViT引入之后得到了解决,不再是一个障碍

    • information density在语言和视觉中是不同的。语言是人类产生的信号:高度的语义和信息密度。当训练一个模型来预测每个句子中少许的缺失的单词时,这个任务似乎引出复杂的语言理解。图像,相反,是自然的信号,有很多空间冗余,a missing patch can be recovered from neighboring patches with little high-level understanding of parts, objects and scenes. To overcome this difference and encourage learning useful features我们展示了一个简单的策略,在计算机视觉里效果很好:masking a very high portion of random pathces这个策略能够减少冗余,创建一个自监督的任务,要求超越低级图像统计的全局理解。

    • Autoencoder's Decoder, which maps the latent representation back to the input, plays a different role between reconstructing text and images在视觉里,decoder重建像素,它的输出是比普通识别任务更低级的语义。和语言相比,语言的decoder预测missing words,包含丰富的语义信息。在BERT中,decoder是无关紧要的(trivial);我们发现,对于图像,decoder的设计在决定学习到的latent representation的语义level是至关重要的。

    通过以上分析,提出了MAE for visual representation learning。MAE对输入图像的patches随机进行mask,在像素空间重建确实的patches。encoder-decoder是非对称的设计。encoder operates only on the visible subset of patches(without mask tokens), decoder is lightweight and reconstructs the input from the latent representation along with mask tokens。将mask tokens shift 到非对称的encoder-decoder中的小的decoder中能够减小计算量。

  3. Related work:

    • Masked language modeling和 its autoregressive counterparts like BERT、GPT,是NLP中很成功的预训练方法,这些方法保留输入序列的一部分,训练模型来预测确实的内容。这些方法展示出了很好的扩展性,大量的证据表明这些预训练的表征在很多下游任务上的泛化性很好。
    • Autoencoding是一个learning representation的经典方法。有一个encoder将输入映射到latent representation,一个decoder重建输入。例如:PCA和k-means 都是autoencoder。Denoising Autoencoders 是一类破坏输入信号、学习重建原始的没有破坏的信号。一些方法可以被视为一种generalized DAE 在不同的corruptions情况下。像是masking pixels 或者removing color channels。MAE是denoising autoencoding的一种,但是和经典的DAE在很多方面不同。
    • Masked image encoding通过从masked的图像中学习representation。Context encoder用卷积网络修复大的确实的区域。受NLP成功的motivated,近期相关的工作都是基于Transformers。iGPT operates on sequences of pixels and predicts unknown pixels。BEiT提出了预测discrete tokens。
    • 自监督学习 focusing on different pretext tasks for pre-training. 近期,对比学习(contrastive learning)很流行。models image similarity and dissimilarity(or only similarity) between two or more views. 对比学习及相关的方法依赖于数据增强。Autoencoding pursues a conceptually different direction。
  4. Approach:

    • MAE的Decoder仅在pre-training期间使用,用来进行图像重建任务。loss function 计算mean square error between 重建的和原始的图像(像素空间),仅计算masked patches,similar to BERT。

Discussion & Conclusion

  • 简单的扩展性良好的算法是深度学习的核心。在NLP中,简单的自监督学习方法可以从指数级扩展的模型中获益。在计算机视觉中,实际的预训练的范式主要是监督学习。在研究中,我们在ImageNet和迁移学习中观察到,一个自动编码器,是一个简单的类似于NLP中的technques的自监督方法。在视觉中的自监督学习可能现在正在开始类似NLP中的轨迹。

  • 图像和语言,是另一种不同本质的信号。图象是记录的光线,没有将语义分解成文字的视觉模拟。intead of attempting to remove objects, we remove random patches that most likely do not form a semantic segment. Likewise, MAE重建像素,这不是语义实体(semantic entities)。然而,我们观察到,我们的MAE方法能够推断出复杂的、整体的重建,表明他萌购学习大量的视觉概念(visual concepts)。我们设想,this behavior occurs by way of a rich hidden representation inside the MAE。

MAE Architecture

\(Figure\ 1^{[1]}\). Our MAE architecture. During pre-training, a large random subset of image patches (e.g., 75%) is masked out. The encoder is applied to the small subset of visible patches. Mask tokens are introduced after the encoder, and the full set of encoded patches and mask tokens is processed by a small decoder that reconstructs the original image in pixels. After pre-training, the decoder is discarded and the encoder is applied to uncorrupted images (full sets of patches) for recognition tasks