CoolFace
Apppublic

azam897/Masked-Autoencoders-MAE

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
App README

Masked Autoencoder (MAE) — Gradio Demo

Self-supervised image representation learning using Masked Autoencoders trained on TinyImageNet. Built as part of FAST-NUCES AI4009 (Generative AI) Assignment 2, Spring 2026.

Files

  • app.py — Self-contained app with MAE model classes and Gradio UI
  • requirements.txt — Python dependencies
  • mae_model.pth — Trained model weights (tracked via Git LFS)

Model Architecture

ComponentDetails
EncoderViT-Base (B/16) — 12 layers, 768 dim, 12 heads, ~86M params
DecoderViT-Small (S/16) — 12 layers, 384 dim, 6 heads, ~22M params
Patch Size16×16
Image Size224×224
Default Mask Ratio75% (147/196 patches masked)
DatasetTinyImageNet

How It Works

  1. 1.Upload any image
  2. 2.Adjust the masking ratio with the slider (10%–90%)
  3. 3.The app displays three outputs side by side:
  4. 4.Masked Input — image with patches removed
  5. 5.MAE Reconstruction — model's predicted reconstruction
  6. 6.Original — ground truth for comparison

Run Locally

bash
pip install -r requirements.txt
python app.py

Gradio will open at http://127.0.0.1:7860

Notes

  • mae_model.pth must be in the same folder as app.py
  • Large weight files are tracked via Git LFS — run git lfs install before cloning