RestoreFormer++ β ONNX for the browser
A web-ready ONNX export of RestoreFormer++ (blind face restoration) for running in the browser with onnxruntime-web on WebGPU or WebAssembly.
Used by the free Doetra Photo Restorer.
What changed vs. the original
- Converted from the official PyTorch checkpoint to ONNX.
- Weights stored as fp16, compute in fp32: large float initializers are stored as float16 and cast back to
float32 inside the graph. This halves the download (β147 MB instead of β294 MB) with no visible quality loss,
and it runs on GPUs without
shader-f16support.
Input / output
| Name | Shape | Range | |
|---|---|---|---|
| Input | input |
[1, 3, 512, 512] float32, RGB |
[-1, 1] |
| Output | first output (session.outputNames[0]) |
[1, 3, 512, 512] float32, RGB |
[-1, 1] |
The graph also exposes intermediate tensors β request only the first output. Faces should be aligned to the FFHQ 512Γ512 five-point template (eyes, nose, mouth corners), e.g. with the YuNet face detector.
import * as ort from 'onnxruntime-web/webgpu'
const session = await ort.InferenceSession.create(url, { executionProviders: ['webgpu', 'wasm'] })
const out = await session.run({ input: tensor }, [session.outputNames[0]])
Credits & license
- Paper / code: RestoreFormer++: Towards Real-World Blind Face Restoration from Undegraded Key-Value Pairs, Zhouxia Wang et al. β https://github.com/wzhouxiff/RestoreFormerPlusPlus (Apache-2.0).
- This export is redistributed under the same Apache-2.0 license.