microsoft /Bringing-Old-Photos-Back-to-Life
Bringing Old Photo Back to Life (CVPR 2020 oral)
★ 15,695⑂ 2,082
15,695
stars
+-5+-6+-24
2,082
forks
–
watchers
–
prs
–
issues
–
releases
–
discussions
README
Old Photo Restoration (Official PyTorch Implementation)
Project Page | Paper (CVPR version) | Paper (Journal version) | Pretrained Model | Colab Demo | Replicate Demo & Docker Image :fire:
Bringing Old Photos Back to Life, CVPR2020 (Oral)
Old Photo Restoration via Deep Latent Space Translation, TPAMI 2022
Ziyu Wan1,
Bo Zhang2,
Dongdong Chen3,
Pan Zhang4,
Dong Chen2,
Jing Liao1,
Fang Wen2
1City University of Hong Kong, 2Microsoft Research Asia, 3Microsoft Cloud AI, 4USTC
:sparkles: News
2022.3.31: Our new work regarding old film restoration will be published in CVPR 2022. For more details, please refer to the project website and github repo.
The framework now supports the restoration of high-resolution input.
Training code is available and welcome to have a try and learn the training details.
You can now play with our Colab and try it on your photos.
Requirement
The code is tested on Ubuntu with Nvidia GPUs and CUDA installed. Python=3.6 is required to run the code.
Installation
Clone the Synchronized-BatchNorm-PyTorch repository for
cd Face_Enhancement/models/networks/
git clone https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
cp -rf Synchronized-BatchNorm-PyTorch/sync_batchnorm .
cd ../../../
cd Global/detection_models
git clone https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
cp -rf Synchronized-BatchNorm-PyTorch/sync_batchnorm .
cd ../../
Download the landmark detection pretrained model
cd Face_Detection/
wget http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
bzip2 -d shape_predictor_68_face_landmarks.dat.bz2
cd ../
Download the pretrained model, put the file Face_Enhancement/checkpoints.zip under ./Face_Enhancement, and put the file Global/checkpoints.zip under ./Global. Then unzip them respectively.
cd Face_Enhancement/
wget https://github.com/microsoft/Bringing-Old-Photos-Back-to-Life/releases/download/v1.0/face_checkpoints.zip
unzip face_checkpoints.zip
cd ../
cd Global/
wget https://github.com/microsoft/Bringing-Old-Photos-Back-to-Life/releases/download/v1.0/global_checkpoints.zip
unzip global_checkpoints.zip
cd ../
Install dependencies:
bash
pip install -r requirements.txt
:rocket: How to use?
Note: GPU can be set 0 or 0,1,2 or 0,2; use -1 for CPU
1) Full Pipeline
You could easily restore the old photos with one simple command after installation and downloading the pretrained model.
For images without scratches:
python run.py --input_folder [test_image_folder_path] \
--output_folder [output_path] \
--GPU 0
For scratched images:
python run.py --input_folder [test_image_folder_path] \
--output_folder [output_path] \
--GPU 0 \
--with_scratch
For high-resolution images with scratches:
python run.py --input_folder [test_image_folder_path] \
--output_folder [output_path] \
--GPU 0 \
--with_scratch \
--HR
Note: Please try to use