whatisgithub

What is mae?

facebookresearch/mae — explained in plain English

Analysis updated 2026-06-24

8,315PythonAudience · researcherComplexity · 4/5LicenseSetup · hard

In one sentence

A PyTorch implementation of Masked Autoencoders (MAE) that trains image recognition models by hiding random image patches and learning to reconstruct them, without needing labeled data.

Mindmap

mindmap
  root((mae))
    What it does
      Mask image patches
      Reconstruct missing parts
      Self-supervised learning
    Model sizes
      ViT-Base
      ViT-Large
      ViT-Huge
    Use cases
      Image classification
      Transfer learning
      Robustness testing
    Tech stack
      Python
      PyTorch
      CUDA
    Getting started
      Colab demo
      Pretrained weights
      Fine-tune script
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Pre-train a visual understanding model on your own unlabeled image collection

USE CASE 2

Fine-tune a provided ViT-Base or ViT-Large checkpoint on your own image classification dataset

USE CASE 3

Run the Colab notebook to visualize how the model fills in hidden patches of your own photos

What is it built with?

PythonPyTorchCUDAVision Transformer

How does it compare?

facebookresearch/maedroidrun/mobilerunbaowenbo/dain
Stars8,3158,3138,310
LanguagePythonPythonPython
Setup difficultyhardmoderatehard
Complexity4/53/55/5
Audienceresearcherdeveloperresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Requires an NVIDIA GPU with CUDA and large image datasets, pre-trained weights must be downloaded separately before fine-tuning.

Free for non-commercial use only, you cannot use this in a commercial product without separate permission from Facebook.

So what is it?

This repository contains a PyTorch implementation of Masked Autoencoders (MAE), a technique for training image recognition models developed by researchers at Facebook. The core idea behind MAE is to teach a model to understand images by hiding random patches of an image and asking the model to reconstruct the missing parts. Through this self-supervised training process, the model learns rich visual features without needing labeled data. The training happens in two phases. First, the model is pre-trained on a large collection of unlabeled images using the masking approach. Then the pre-trained model is fine-tuned on a labeled dataset for a specific task, such as classifying what object is in a photo. The researchers found this approach produces models that generalize well: the same pre-trained weights perform strongly across a variety of image recognition benchmarks, including tests that involve sketches, corrupted images, and adversarial examples designed to fool classifiers. Pre-trained model weights are available for three model sizes called ViT-Base, ViT-Large, and ViT-Huge. These names refer to the Vision Transformer architecture, a type of neural network that processes images by dividing them into patches and treating those patches similarly to how language models process words. The largest model (ViT-Huge at 448 pixel input) achieved 87.8% accuracy on ImageNet, which was state of the art at the time of publication. The repository includes code for the visualization demo, fine-tuning on new datasets, and running the pre-training process from scratch. A Colab notebook lets anyone try the visualization without a local GPU. The project is released under the CC-BY-NC 4.0 license, which allows non-commercial use.

Copy-paste prompts

Prompt 1
I have a folder of unlabeled medical images. Using the facebookresearch/mae repository, write me a script to pre-train a ViT-Base MAE model on them and save the checkpoint.
Prompt 2
Using facebookresearch/mae, show me how to fine-tune the ViT-Large pretrained weights on a custom 10-class image dataset using the provided fine-tuning script.
Prompt 3
Walk me through loading a facebookresearch/mae checkpoint and visualizing which patches it reconstructs most and least accurately on a test image.
Prompt 4
Using the mae repo, how do I evaluate a fine-tuned ViT-Huge model on a held-out validation set and print top-1 and top-5 accuracy?

Frequently asked questions

What is mae?

A PyTorch implementation of Masked Autoencoders (MAE) that trains image recognition models by hiding random image patches and learning to reconstruct them, without needing labeled data.

What language is mae written in?

Mainly Python. The stack also includes Python, PyTorch, CUDA.

What license does mae use?

Free for non-commercial use only, you cannot use this in a commercial product without separate permission from Facebook.

How hard is mae to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is mae for?

Mainly researcher.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.