Masked Autoencoder (MAE)

Masks half the image patches and reconstructs them on real handwritten digits — the MAE / VideoMAE pretraining objective; reports held-out reconstruction error.

Trained from scratch in Ropedia Academy — an interactive, bilingual course on embodied & spatial AI. Educational model: small and quick to train; the value is the method and a reproducible pipeline, not a leaderboard score. Try it live in the Ropedia demos Space.

At a glance

Base model Trained from scratch (random initialization) — no pretrained base model.
Task self-supervised pretraining
Training objective Masked patch reconstruction (MSE on masked tokens) — self-supervised pretraining.
Track B · 3D & rendering
Notebook Open In Colab

Dataset

  • Name: Handwritten digits (UCI / scikit-learn)
  • Type: real — public dataset
  • Size / stats: 1,797 real 8×8 grayscale digit images; 16 patches of 2×2, 50% masked; 128/batch
  • Split: 1,257 train / 540 test (held-out reconstruction)
  • Source: scikit-learn load_digits (UCI Optical Recognition of Handwritten Digits)

Training config

Adam (lr 1e-3), 1200 steps, batch 128; 16 patches of 2×2, 50% masked; 2-layer transformer enc/dec.

Evaluation results

metric value meaning
recon_mse (final) 0.1393
test_recon_mse 0.1365 held-out masked-patch reconstruction MSE (lower = better)

figure

Robustness (mean ± std over 5 seeds)

Single-run numbers above are one seed; this is the distribution over independent re-trains (honest variance — no cherry-picking).

metric mean ± std
test_recon_mse 0.1349 ± 0.00074

seeds

Inference example

import torch
state = torch.load("mae.pt", map_location="cpu")   # this repo's checkpoint
# Rebuild the exact module from the lab notebook (see "Reproduce"), then:
# model.load_state_dict(state); model.eval()

Limitations

Educational scale. Trained quickly on CPU on small or synthetic data, so absolute numbers are not competitive with production systems — the value is the method and a reproducible pipeline. No large-scale data, no hyperparameter sweep, and no multi-seed variance is reported. Not for production use.

Tiny model on 8×8 digits → blurry reconstructions; not a general visual encoder.

Failure cases

A high mask ratio with only 16 patches removes too much context → over-smoothed fills.

Reproduce / train your own

One click: open the notebook in Colab → Runtime → GPU → Run all, then run its Publish to the Hugging Face Hub cell.

Open In Colab

From a shell:

git clone https://github.com/ChaoYue0307/ropedia-academy.git && cd ropedia-academy
pip install torch numpy matplotlib scikit-learn scikit-image gymnasium
jupyter nbconvert --to notebook --execute notebooks/training/B_mae_pretrain.ipynb --output run.ipynb
# optional: override training length, e.g.  STEPS=2000  (or EPISODES=600)  before running

Files

  • figure.png
  • mae.pt
  • metrics.json
  • seeds.png

License

Code & weights: MIT (this repository) — educational use encouraged.
Handwritten-digits data: UCI ML Repository via scikit-learn — CC BY 4.0.

Citation

If you use this model or the course materials, please cite:

@misc{ropedia_academy,
  title  = {Ropedia Academy: an interactive course on embodied & spatial AI},
  author = {Ropedia Academy},
  year   = {2026},
  howpublished = {\url{https://chaoyue0307.github.io/ropedia-academy/}}
}

Method / original work: He et al., Masked Autoencoders Are Scalable Vision Learners (MAE), CVPR 2022; Tong et al., VideoMAE, NeurIPS 2022.

Related assets


Part of the Ropedia Academy trained-model collection. Contributions & issues welcome on GitHub.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Space using cy0307/b-mae-pretrain 1

Collection including cy0307/b-mae-pretrain

Free AI Image Generator No sign-up. Instant results. Open Now