再见旧照片,Python一键美颜!
点击上方“数据管道”,选择“置顶星标”公众号
干货福利,第一时间送达


1



2
黑白照片上色,是一个经典上色老算法(2018年):
「DeOldify」


git clone https://github.com/microsoft/Bringing-Old-Photos-Back-to-Lifecd Face_Enhancement/models/networks/git clone https://github.com/vacancy/Synchronized-BatchNorm-PyTorchcp -rf Synchronized-BatchNorm-PyTorch/sync_batchnorm .cd ../../../cd Global/detection_modelsgit clone https://github.com/vacancy/Synchronized-BatchNorm-PyTorchcp -rf Synchronized-BatchNorm-PyTorch/sync_batchnorm .cd ../../
cd Face_Detection/wget http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2bzip2 -d shape_predictor_68_face_landmarks.dat.bz2cd ../
python run.py --input_folder [test_image_folder_path] \--output_folder [output_path] \--GPU 0
将你想修复的图片放到 [test_image_folder_path] 目录下(自己指定),生成的图片会放到 [output_path] 目录中。
python run.py --input_folder [test_image_folder_path] \--output_folder [output_path] \--GPU 0 \--with_scratch
2、DeOldify

#NOTE: This must be the first call in order to work properly!from deoldify import devicefrom deoldify.device_id import DeviceId#choices: CPU, GPU0...GPU7device.set(device=DeviceId.GPU0)import torchif not torch.cuda.is_available():print('GPU not available.')import fastaifrom deoldify.visualize import *import warningswarnings.filterwarnings("ignore", category=UserWarning, message=".*?Your .*? set is empty.*?")colorizer = get_image_colorizer(artistic=True)colorizer.plot_transformed_image("test_images/1.png", render_factor=10, compare=True)

3

评论
