Skip to content

Repository files navigation

Masked Autoencoders: A PyTorch Implementation

This is a PyTorch/GPU re-implementation of the paper Masked Autoencoders Are Scalable Vision Learners:

@Article{MaskedAutoencoders2021,
author = {Kaiming He and Xinlei Chen and Saining Xie and Yanghao Li and Piotr Doll{\'a}r and Ross Girshick},
journal = {arXiv:2111.06377},
title = {Masked Autoencoders Are Scalable Vision Learners},
year = {2021},
}
  • The original implementation was in TensorFlow+TPU. This re-implementation is in PyTorch+GPU.

  • This repo is a modification on the DeiT repo. Installation and preparation follow that repo.

  • This repo is based on timm==0.3.2, for which a fix is needed to work with PyTorch 1.8.1+.

Catalog

  • Visualization demo
  • Pre-trained checkpoints + fine-tuning code
  • Pre-training code

Visualization demo

Run our interactive visualization demo using Colab notebook (no GPU needed):

Fine-tuning with pre-trained checkpoints

The following table provides the pre-trained checkpoints used in the paper, converted from TF/TPU to PT/GPU:

ViT-BaseViT-LargeViT-Huge
pre-trained checkpointdownloaddownloaddownload
md58cad7cb8b06e9bdbb0

The fine-tuning instruction is in FINETUNE.md.

By fine-tuning these pre-trained models, we rank #1 in these classification tasks (detailed in the paper):

ViT-BViT-LViT-HViT-H448prev best
ImageNet-1K (no external data)83.685.986.987.887.1
following are evaluation of the same model weights (fine-tuned in original ImageNet-1K):
ImageNet-Corruption (error rate) 51.741.833.836.842.5
ImageNet-Adversarial35.957.168.276.735.8
ImageNet-Rendition48.359.964.466.548.7
ImageNet-Sketch34.545.349.650.936.0
following are transfer learning by fine-tuning the pre-trained MAE on the target dataset:
iNaturalists 201770.575.779.383.475.4
iNaturalists 201875.480.183.086.881.2
iNaturalists 201980.583.485.788.384.1
Places20563.965.865.966.866.0
Places36557.959.459.860.358.0

Pre-training

The pre-training instruction is in PRETRAIN.md.

License

This project is under the CC-BY-NC 4.0 license. See LICENSE for details.

About

PyTorch implementation of MAE https//arxiv.org/abs/2111.06377

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages