微软老照片自动修复技术

项目代码:

https://kgithub.com/microsoft/Bringing-Old-Photos-Back-to-Life.git

https://github.com/vacancy/Synchronized-BatchNorm-PyTorch

 

 

 Bringing-Old-Photos-Back-to-Life\Face_Enhancement\models\networks\normalization.py

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

import re
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.networks.sync_batchnorm.batchnorm import SynchronizedBatchNorm2d
import torch.nn.utils.spectral_norm as spectral_norm


def get_nonspade_norm_layer(opt, norm_type="instance"):
    # helper function to get # output channels of the previous layer

 

 

 Bringing-Old-Photos-Back-to-Life\Global\detection_models\networks.py

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

import torch
import torch.nn as nn
import torch.nn.functional as F
from detection_models.sync_batchnorm.replicate import DataParallelWithCallback
from detection_models.antialiasing import Downsample


class UNet(nn.Module):
    def __init__(

 

 

shape_predictor_68_face_landmarks.dat

人脸识别的68个特征点检测库dat文件

链接:https://pan.baidu.com/s/1ORhqLS1bkHyyYfzbmftNpg
提取码:va12

 

 

 训练模块:

https://facevc.blob.core.windows.net/zhanbo/oldphoto/pretrain/FaceEnhancement/checkpoints.zip

链接:https://pan.baidu.com/s/13CU_pj1n8D17uN7BsDG0GA 
提取码:b7j1

 

 

 

 

https://facevc.blob.core.windows.net/zhanbo/old_photo/pretrain/Global/checkpoints.zip

链接:https://pan.baidu.com/s/1xub_9z3jyqMEZNqZwg7LEA 
提取码:505v

 

 

 

安装依赖: 

pip install -r requirements.txt

 

执行:

Bringing-Old-Photos-Back-to-Life>python run.py --input_folder D:/workspace/pys/Bringing-Old-Photos-Back-to-Life/test_images/old --output_folder D:/workspace/pys/Bringing-Old-Photos-Back-to-Life/test_images/new --GPU 0

 

效果:

 

 

随后我有DeOldify用给老照片上了色

 

 

 

感觉还是很明显的。

 

参考:

https://blog.csdn.net/cainiao_python/article/details/114811135

https://blog.csdn.net/qq_36320520/article/details/125972766

 

posted @ 2023-03-03 16:13  河北大学-徐小波  阅读(126)  评论(0编辑  收藏  举报