OSDFace
Official Repo for CVPR 2025 paper "OSDFace: One-Step Diffusion Model for Face Restoration"
Install / Use
/learn @jkwang28/OSDFaceREADME
OSDFace: One-Step Diffusion Model for Face Restoration
Jingkai Wang, Jue Gong, Lin Zhang, Zheng Chen, Xing Liu, Hong Gu, Yutong Liu, Yulun Zhang, and Xiaokang Yang, "One-Step Diffusion Model for Face Restoration", CVPR, 2025
🔥🔥🔥 News
- 2025-12-23: Inference code and pretrained models are released.
- 2025-04-23: Results are released. (Synthetic dataset: CelebA-Test; Real-world datasets: Wider-Test, LFW-Test, and WebPhoto-Test)
- 2025-02-27: Congratulations! OSDFace is accepted to CVPR 2025.
- 2024-11-25: This repo is released.
Abstract: Diffusion models have demonstrated impressive performance in face restoration. Yet, their multi-step inference process remains computationally intensive, limiting their applicability in real-world scenarios. Moreover, existing methods often struggle to generate face images that are harmonious, realistic, and consistent with the subject’s identity. In this work, we propose OSDFace, a novel one-step diffusion model for face restoration. Specifically, we propose a visual representation embedder (VRE) to better capture prior information and understand the input face. In VRE, low-quality faces are processed by a visual tokenizer and subsequently embedded with a vector-quantized dictionary to generate visual prompts. Additionally, we incorporate a facial identity loss derived from face recognition to further ensure identity consistency. We further employ a generative adversarial network (GAN) as a guidance model to encourage distribution alignment between the restored face and the ground truth. Experimental results demonstrate that OSDFace surpasses current state-of-the-art (SOTA) methods in both visual quality and quantitative metrics, generating high-fidelity, natural face images with high identity consistency.

<!--  -->
<img src="images/CAT-0012.png" height="200"/> <img src="images/CAT-0051.png" height="200"/> <img src="images/CAT-0054.png" height="200"/> <img src="images/CAT-1093.png" height="200"/>
<img src="images/LFW_Abdullatif_Sener.png" height="200"/> <img src="images/WebPhoto_0101.png" height="200"/> <img src="images/WT_0011.png" height="200"/> <img src="images/WT_0000.png" height="200"/>
⚒️ TODO
- [x] Release inference code and pretrained models
- [ ] Release training code
🔗 Contents
- [x] Environment
- [x] Datasets
- [x] Models
- [x] Inference
- [ ] Training
- [x] Results
- [x] Citation
- [ ] Acknowledgements
<a name="environment"></a>⚒️ Environment
- Create conda environment with Python 3.10. (
conda create -n osdface python=3.10) - Install PyTorch 2.4.0. (
pip install torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://mirror.sjtu.edu.cn/pytorch-wheels/cu121) - Install
requirements.txt. (pip install -r requirements.txt)
<a name="datasets"></a>📊 Datasets
Training Dataset:
We use FFHQ and FFHQR for training. All of them are resized to 512x512.
Testing Dataset:
We use CelebA-Test as the synthetic dataset. The download link can refer to DAEFR.
We use Wider-Test, LFW-Test, and WebPhoto-Test as the real-world datasets. The download links can refer to DAEFR and VQFR.
Thanks a lot for their contribution to Face Restoration.
<a name="inference"></a>🧮 Inference
- Download the pretrained model from Google Drive. Put models in
pretrained/, and put the test data indata/ - Run the inference bash
test.sh.
💬 Tips
Since the offcial Stable Diffusion 2.1 is not avaliable, you could visit ModelScope to download it and use it locally.
If you meet an error from diffusers:
File "... lib/python3.10/site-packages/diffusers/utils/dynamic_modules_utils.py", line 28, in <module>
from huggingface_hub import cached_download, hf_hub_download, model_info
you can edit the dynamic_modules_utils.py like:
- Replace line 24 from
from huggingface_hub import cached_download, hf_hub_download, model_infotofrom huggingface_hub import hf_hub_download, model_info. - Replace line 287 from
resolved_module_file = cached_download(toresolved_module_file = hf_hub_download(.
<a name="results"></a>🔎 Results
We achieved state-of-the-art performance on synthetic and real-world datasets. Detailed results can be found in the paper, and the full results could be downloaded here: Google Drive or OneDrive.
<details> <summary> Quantitative Comparisons (click to expand) </summary> <li> Results in Table 1 on synthetic dataset (CelebA-Test) from the main paper. <p align="center"> <img src="images/quan-celeba.png" > </p> </li> <li> Results in Table 2 on real-world datasets (Wider-Test, LFW-Test, WebPhoto-Test) from the main paper. <p align="center"> <img src="images/quan-realworld.png" > </p> </li> </details> <details open> <summary> Visual Comparisons (click to expand) </summary> <li> Results in Figure 5 on synthetic dataset (CelebA-Test) from the main paper. <p align="center"> <img src="images/vis-main-celeba.png" > </p> </li> <li> Results in Figure 6 on real-world dataset (Wider-Test, LFW-Test, WebPhoto-Test) from the main paper. <p align="center"> <img src="images/vis-main-realworld.png" > </p> </li> </details> <details> <summary style="margin-left: 2rem;"> More Comparisons on Synthetic Dataset... </summary> <li style="margin-left: 2rem;"> Results in Figure 4, 5, 6 on synthetic dataset (CelebA-Test) from supplemental material. <p align="center"> <img src="images/vis-supp-celeba-1.png" > </p> <p align="center"> <img src="images/vis-supp-celeba-2.png" > </p> <p align="center"> <img src="images/vis-supp-celeba-3.png" > </p> </li> </details> <details> <summary style="margin-left: 2rem;"> More Comparisons on Real-World Dataset... </summary> <li style="margin-left: 2rem;"> Results in Figure 7, 8, 9, 10 on real-world datasets (Wider-Test, LFW-Test, WebPhoto-Test) from supplemental material. <p align="center"> <img src="images/vis-supp-wider.png" > </p> <p align="center"> <img src="images/vis-supp-lfw.png" > </p> <p align="center"> <img src="images/vis-supp-webphoto.png" > </p> <p align="center"> <img src="images/vis-supp-realworld.png" > </p> </li> </details><a name="citation"></a>📎 Citation
If you find the code helpful in your research or work, please cite the following paper(s).
@InProceedings{wang2025osdface,
author = {Wang, Jingkai and Gong, Jue and Zhang, Lin and Chen, Zheng and Liu, Xing and Gu, Hong and Liu, Yutong and Zhang, Yulun and Yang, Xiaokang},
title = {{OSDFace}: One-Step Diffusion Model for Face Restoration},
booktitle = {Proceedings of the Computer Vision and Pattern Recognition Conference (CVPR)},
month = {June},
year = {2025},
pages = {12626-12636}
}
<a name="acknowledgements"></a>💡 Acknowledgements
[TBD]
<a href="https://www.star-history.com/#jkwang28/OSDFace&type=date&legend=top-left"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=jkwang28/OSDFace&type=date&theme=dark&legend=top-left" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=jkwang28/OSDFace&type=date&legend=top-left" /> <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=jkwang28/OSDFace&type=date&legend=top-left" /> </picture> </a>