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
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) |
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 |
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.
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.pngmae.ptmetrics.jsonseeds.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
- 🚀 Live demos: https://huggingface.co/spaces/cy0307/ropedia-demos
- 🤗 All trained models + collection: https://huggingface.co/cy0307
- 📚 Course & all labs: https://chaoyue0307.github.io/ropedia-academy/ · Labs tab
- 💻 Source / notebooks: github.com/ChaoYue0307/ropedia-academy
Part of the Ropedia Academy trained-model collection. Contributions & issues welcome on GitHub.

