Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PRIS-CV/SSDiff

Repository files navigation

Self-Supervised Selective-Guided Diffusion Model for Old-Photo Face Restoration

1Beijing University of Posts and Telecommunications 2Nanjing University of Science and Technology
🚩 Accepted to NeurIPS 2025

• [Project] [arXiv] [Appendix]•

⭐ If SSDiff is helpful to your paper or project, please consider star this repo or cite our paper. Thanks! 🤗

📮 Update

  • 2025年02月11日: Datas are relased.
  • 2025年12月07日: Codes are relased.
  • 2025年12月03日: Checkpoints and scripts are relased.
  • 2025年12月02日: Config files are relased.
  • 2025年10月11日: This repo is created.

🔧 TODO

  • Relase restoration results.
  • Relase our constructed old-photo face dataset, VintageFace.
  • Relase checkpoint and script for old photo face restoration.
  • Relase codes and config files.
  • Release paper on arxiv.

Dependencies and Installation

  • Pytorch >= 1.7.1
  • CUDA >= 10.1
  • Other required packages in requirements.txt
# git clone this repository
git clone https://github.com/PRIS-CV/SSDiff
cd SSDiff
# create new anaconda env
conda create -n SSDiff python=3.8 -y
conda activate SSDiff
# install python dependencies
conda install mpi4py
pip3 install -r requirements.txt
pip install -e .

Quick Inference

Download Pre-trained Models:

Download the pretrained face generation diffusion model iddpm_ffhq512_ema500000.pth from [Google Drive] to models folder, the pretrained face parsing model resnet34.pt from [Google Drive] to models/face_parsing folder, the pretrained style transfer model photo_image.pt from [Google Drive] to CAP_VSTNet/checkpoints folder.

Download the facelib and dlib pretrained models from [Releases | OneDrive] to the weights/facelib folder and weights folder, separately. You can manually download the pretrained models OR download by running the following command:

python scripts/download_pretrained_models.py facelib
python scripts/download_pretrained_models.py dlib (only for dlib face detector)

Download the pretrained restore model codeformer.pth and pretrained VQGAN model vqgan_code1024.pth from [Releases | OneDrive] to the models/restorer folder and models/vqgan folder, separately. You can manually download the pretrained models OR download by running the following command:

python scripts/download_pretrained_models.py CodeFormer

Download VintageFace Test dataset:

Download the real-world old face photo test set that collected from the Internet called VintageFace from [Google Drive], including old face photos with their corresponding processed masks.

Prepare Testing Data:

You can put the testing images in the inputs/TestWhole folder. If you would like to test on cropped and aligned faces, you can put them in the inputs/cropped_faces folder. You can get the cropped and aligned faces by running the following command:

# you may need to install dlib via: conda install -c conda-forge dlib
python extract_faces.py -i [input folder] -o [output folder]
  • If scratches exist, a folder for mask(s) mask_dir must be specified with the name of each mask image corresponding to that of each input image. Each input mask shoud be a binary map with white pixels representing masked regions. To obtain a scratch map automatically, we recommend using the scratch detection model. One may also further adjust the scratch map with an image editing app (e.g., Photoshop).

Visual results:

You can download visual results from Google Drive.

Testing:

🧑🏻 Old-Photo Face Restoration (cropped and aligned face)

# For generating reference pseudo-labelled faces (512x512)
python inference_fake_label.py --task old_photo_restoration_pseudo --in_dir [input_image_path] --mask_dir [mask_path] --out_dir [output_image_path] --guidance_scale 0.001 --seed 4321
# For breakage, fading, and blur faces (512x512)
# --self_dir refers to the path of the pseudo-labelled faces generated in the previous stage.
python inference_final.py --task old_photo_restoration --in_dir [input_image_path] --mask_dir [mask_path] --out_dir [output_image_path] --guidance_scale 0.0035 --self_dir [pseudo_labelled_faces_path] --seed 4321

🧑🏻 Face Restoration (cropped and aligned face)

# For only blur faces (512x512), You may choose not to use pseudo-labelled faces.
python inference_final.py --task restoration --in_dir [input_image_path] --out_dir [output_image_path] --guidance_scale 0.05

Citation

If our work is useful for your research, please consider citing:

@inproceedings{li2025self,
 title={Self-Supervised Selective-Guided Diffusion Model for Old-Photo Face Restoration},
 author={Li, Wenjie and Wang, Xiangyi and Guo, Heng and Gao, Guangwei and Ma, Zhanyu},
 booktitle={NeurIPs},
 year={2025}
}

Contact

If you have any questions, please feel free to reach me out at lewj2408@gmail.com.

About

[NeurIPS 2025] Self-Supervised Selective-Guided Diffusion Model for Old-Photo Face Restoration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

AltStyle によって変換されたページ (->オリジナル) /