方案 Bringing Old Photos Back to Life
/microsoft/Bringing-Old-Photos-Back-to-Life
快速开始
下载源码git clone git@:microsoft/Bringing-Old-Photos-Back-to-Life.git
下载Net模型
git clone git@:vacancy/Synchronized-BatchNorm-PyTorch.git
下载预训练模型
wget /files/shape_predictor_68_face_landmarks.dat.bz2wget /microsoft/Bringing-Old-Photos-Back-to-Life/releases/download/v1.0/face_checkpoints.zipwget /microsoft/Bringing-Old-Photos-Back-to-Life/releases/download/v1.0/global_checkpoints.zip
解压拷贝Net模型和训练模型到对应源码目录
# 拷贝Net模型到源码目录cp -rf Synchronized-BatchNorm-PyTorch/sync_batchnorm Bringing-Old-Photos-Back-to-Life/Face_Enhancement/models/networkscp -rf Synchronized-BatchNorm-PyTorch/sync_batchnorm Bringing-Old-Photos-Back-to-Life/Global/detection_models# 预测模型cp shape_predictor_68_face_landmarks.dat.bz2 Bringing-Old-Photos-Back-to-Life/Face_Detection# 解压训练模型到源码目录cp face_checkpoints.zip Bringing-Old-Photos-Back-to-Life/Face_Enhancementcp global_checkpoints.zip Bringing-Old-Photos-Back-to-Life/Globalunzip face_checkpoints.zipbzip2 -d shape_predictor_68_face_landmarks.dat.bz2
依赖安装
pip install -r requirements.txt
执行修复
# GPU可设置为0、1、2或0、2; 若使用CPU设置为-1# 若要修复破损可使用--with_scratch参数python run.py --input_folder E:\oldphtoto2 --output_folder E:\newphoto2 --GPU -1 --with_scratchpython run.py --input_folder E:\oldphtoto --output_folder E:\newphoto --GPU -1
Usage: python inference_gfpgan.py -i inputs/whole_imgs -o results -v 1.3 -s 2 [options]…
-h show this help
-i input Input image or folder. Default: inputs/whole_imgs
-o output Output folder. Default: results
-v version GFPGAN model version. Option: 1 | 1.2 | 1.3. Default: 1.3
-s upscale The final upsampling scale of the image. Default: 2
-bg_upsampler background upsampler. Default: realesrgan
-bg_tile Tile size for background sampler, 0 for no tile during testing. Default: 400
-suffix Suffix of the restored faces
-only_center_face Only restore the center face
-aligned Input are aligned faces
-ext Image extension. Options: auto | jpg | png, auto means using the same extension as inputs. Default: auto
修复效果图:
##原图:
修复后的图
#
如果觉得《开源AI项目-老照片修复之 Bringing Old Photos Back to Life》对你有帮助,请点赞、收藏,并留下你的观点哦!