2021SC@SDUSC
一、项目简介
1.简介
GFP-GAN 模型由退化去除模块和预先训练的人脸生成器组成。它们通过直接潜在代码映射连接到使用 CS SFT 层的粗到细通道。CS-SFT 层对分割的特征执行空间调制,并让左侧的特征直接通过以更好地保存信息,从而允许所提出的方法结合生成先验,同时有效地重新训练高保真度。此外,研究人员在局部鉴别器中引入了面部成分损失,以进一步增强感知面部细节和身份保留增益,从而提高整体质量。
2.人脸修复示例展示
3.GFPGAN主要框架
论文地址:https://arxiv.org/pdf/2101.04061.pdf
项目:https://xinntao.github.io/projects/gfpgan
Github:https://github.com/TencentARC/GFPGAN
二、项目导入
1.项目与系统需求:
Python >= 3.7 (Recommend to use Anaconda or Miniconda) PyTorch >= 1.7 Option::NVIDIA GPU + CUDA Option: Linux (We have not tested on Windows) 项目列表:
2. 安装依赖项
# Install basicsr - https://github.com/xinntao/BasicSR
# We use BasicSR for both training and inference
pip install basicsr
# Install facexlib - https://github.com/xinntao/facexlib
# We use face detection and face restoration helper in the facexlib package
pip install facexlib
pip install -r requirements.txt
python setup.py develop
3.Quick Inference
Download pre-trained models: GFPGANCleanv1-NoCE-C2.pth
wget https://github.com/TencentARC/GFPGAN/releases/download/v0.2.0/GFPGANCleanv1-NoCE-C2.pth -P experiments/pretrained_models
Inference!
python inference_gfpgan.py --upscale_factor 2 --test_path inputs/whole_imgs --save_root results
4.Training
(2)预先训练模型及相关数据下载,需导入 experiments/pretrained_models 中.
1. [Pretrained StyleGAN2 model: StyleGAN2_512_Cmul1_FFHQ_B12G4_scratch_800k.pth](https://github.com/TencentARC/GFPGAN/releases/download/v0.1.0/StyleGAN2_512_Cmul1_FFHQ_B12G4_scratch_800k.pth)
1. [Component locations of FFHQ: FFHQ_eye_mouth_landmarks_512.pth](https://github.com/TencentARC/GFPGAN/releases/download/v0.1.0/FFHQ_eye_mouth_landmarks_512.pth)
1. [A simple ArcFace model: arcface_resnet18.pth](https://github.com/TencentARC/GFPGAN/releases/download/v0.1.0/arcface_resnet18.pth)
(3)Modify the configuration file options/train_gfpgan_v1.yml accordingly.
(4)Training
python -m torch.distributed.launch --nproc_per_node=4 --master_port=22021 gfpgan/train.py -opt options/train_gfpgan_v1.yml --launcher pytorch
三、小组分工
小组成员共四人,经过讨论确定核心代码后,我主要负责gfpganv1_clean_arch.py部分核心代码的阅读分析。
|