Official implementation of Multi-Granularity Feature Decomposition with Ranking-Aware Regularization for Old Film Restoration.
MgfrOFR is an old-film restoration framework built on a recurrent video restoration backbone. It introduces multi-granularity feature decomposition for degradation-aware restoration and ranking-aware temporal regularization for more stable video recovery.
Paper and pretrained weight links will be updated after the final camera-ready/release assets are frozen. The source code, evaluation scripts, and configuration files are already available in this repository.
- 2026-05-10: Initial public-release codebase prepared with training/testing configs and BasicOFR/BasicSR runtime.
- Old-film restoration focus: designed for mixed analog degradations such as scratches, noise, blur, flicker, and local structured artifacts.
- Multi-granularity feature decomposition: adds MGFE modules to separate restoration cues at different feature granularities.
- Ranking-aware temporal regularization: provides a training loss for temporally consistent restoration behavior.
- Reproducible configs: includes full-model and ablation configs for training and testing.
- Standalone release: packages the required
mgfrofr,basicofr, andbasicsrcode paths in one repository.
MgfrOFR architecture. The model extends a recurrent Mamba-based old-film restoration backbone with multi-granularity feature extraction and training-time ranking-aware regularization.
Synthetic REDS-style old-film restoration. MgfrOFR improves structural recovery and suppresses local old-film artifacts compared with the recurrent baseline.
Real-world archival footage. MgfrOFR produces visually cleaner restorations on real-world SRWOV clips without ground-truth supervision at test time.
- Add paper link.
- Add pretrained model download URLs and SHA256 checksums.
- Add final benchmark tables after metric provenance is frozen.
- Add qualitative examples and method figures.
MgfrOFR/
├── mgfrofr/ # MgfrOFR architecture, model wrapper, and RATR loss
├── basicofr/ # Video restoration runtime components
├── basicsr/ # BasicSR-style training/testing infrastructure
├── options/
│ ├── train/ # Training and ablation configs
│ └── test/ # Synthetic and real-world evaluation configs
├── scripts/ # Train/test entry points
├── docs/ # Dataset, model-zoo, and result notes
├── tests/ # Import/registry/config smoke test
├── CITATION.cff
├── LICENSE
├── requirements.txt
└── setup.py
git clone https://github.com/wscffaa/MgfrOFR.git
cd MgfrOFRconda create -n mgfrofr python=3.10 -y
conda activate mgfrofrInstall PyTorch according to your CUDA version from the official PyTorch instructions. For example:
# Example only. Pick the command matching your CUDA/driver.
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121Then install the remaining dependencies and this repository:
pip install -r requirements.txt
pip install -e .mamba-ssm and CUDA extensions can be environment-sensitive. If installation fails, install the PyTorch/CUDA-compatible wheel first and then rerun pip install -r requirements.txt.
Run the lightweight smoke test after installation:
python tests/test_mgfrofr_smoke.pyExpected output:
MgfrOFR import, registry, and config smoke test passed
This checks package imports, registry entries, and YAML config parsing. It does not require pretrained restoration weights.
This repository does not redistribute REDS, SRWOV, or third-party datasets. Please download datasets from their official sources and arrange them as follows:
datasets/OldFilmRestoration/
├── train/
│ └── REDS/train_sharp/
├── val/
│ ├── miniREDS/
│ │ ├── GT/val_sharp/
│ │ └── LQ/val_sharp_degraded/
│ ├── REDS/
│ │ ├── GT/val_sharp/
│ │ └── LQ/val_sharp_degraded/
│ └── RealFilm/MambaOFR_SRWOV/
└── noise_data/
See docs/DATASETS.md for more notes.
Weights are not committed to git. Put downloaded models under pretrained/:
pretrained/
├── mambaofr_reds_16_net_g_best.pth
├── mgfrofr_a3_full.pth
└── mgfrofr_a0_mambaofr.pth
| Model | Config | Download | Notes |
|---|---|---|---|
| MgfrOFR-A3 full | options/test/mgfrofr_a3_synthetic.yml |
To be released | Full MGFE + RATR model |
| MgfrOFR-A0 baseline | options/train/mgfrofr_a0_mambaofr.yml |
To be released | Baseline reference |
| MambaOFR warm start | options/train/mgfrofr_a3_full.yml |
To be released | Used for warm-start training |
See docs/MODEL_ZOO.md. Add checksums before publishing pretrained weights.
python scripts/test.py -opt options/test/mgfrofr_a3_synthetic.ymlOutputs are saved under results/.
python scripts/test.py -opt options/test/mgfrofr_a3_realworld.ymlThe real-world config saves restored frames and does not require ground-truth frames.
Full MgfrOFR training:
python scripts/train.py -opt options/train/mgfrofr_a3_full.ymlAblation configs:
| Config | Purpose |
|---|---|
options/train/mgfrofr_a0_mambaofr.yml |
recurrent baseline |
options/train/mgfrofr_a1_mgfe.yml |
baseline + MGFE |
options/train/mgfrofr_a2_ratr.yml |
baseline + RATR |
options/train/mgfrofr_a3_full.yml |
MGFE + RATR full model |
Training logs and checkpoints are written to experiments/ and tb_logger/, both ignored by git.
Final paper metrics will be added after the evaluation protocol, checkpoint hashes, and metric provenance are frozen. See docs/RESULTS.md for the intended reporting fields.
When reporting results, please include:
- checkpoint file and hash;
- config file;
- dataset split;
- metric implementation;
- exact command;
- date and environment.
If this repository helps your research, please cite the paper. The final BibTeX will be updated after publication.
@article{cai2026mgfrofr,
title={Multi-Granularity Feature Decomposition with Ranking-Aware Regularization for Old Film Restoration},
author={Cai, Feifan},
year={2026}
}A machine-readable citation file is provided in CITATION.cff.
This repository follows the BasicSR-style restoration pipeline and includes BasicOFR/BasicSR runtime components required by MgfrOFR. MgfrOFR also builds on the old-film restoration setting and recurrent restoration baseline popularized by prior works such as MambaOFR and earlier old-film restoration frameworks. Please cite the relevant upstream projects and datasets when using this code.
This project is released under the Apache License 2.0.








