From c466b9bfddb8ec48692065ecd71252489c69ce3b Mon Sep 17 00:00:00 2001 From: Xintao Date: Fri, 18 Jun 2021 10:07:45 +0800 Subject: [PATCH] update trainining --- README.md | 11 +++++++++++ README_CN.md | 11 +++++++++++ experiments/pretrained_models/README.md | 7 +++++++ train_gfpgan_v1.yml | 14 +++++++++----- 4 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 experiments/pretrained_models/README.md diff --git a/README.md b/README.md index ea5fcfe..462fed3 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,17 @@ python inference_gfpgan_full.py --model_path experiments/pretrained_models/GFPGA We provide complete training codes for GFPGAN.
You could improve it according to your own needs. +1. Dataset preparation: [FFHQ](https://github.com/NVlabs/ffhq-dataset) + +1. Download pre-trained models and other data. Put them in the `experiments/pretrained_models` folder. + 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) + +1. Modify the configuration file `train_gfpgan_v1.yml` accordingly. + +1. Training + > python -m torch.distributed.launch --nproc_per_node=4 --master_port=22021 train.py -opt train_gfpgan_v1.yml --launcher pytorch ## :scroll: License and Acknowledgement diff --git a/README_CN.md b/README_CN.md index ea5fcfe..462fed3 100644 --- a/README_CN.md +++ b/README_CN.md @@ -81,6 +81,17 @@ python inference_gfpgan_full.py --model_path experiments/pretrained_models/GFPGA We provide complete training codes for GFPGAN.
You could improve it according to your own needs. +1. Dataset preparation: [FFHQ](https://github.com/NVlabs/ffhq-dataset) + +1. Download pre-trained models and other data. Put them in the `experiments/pretrained_models` folder. + 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) + +1. Modify the configuration file `train_gfpgan_v1.yml` accordingly. + +1. Training + > python -m torch.distributed.launch --nproc_per_node=4 --master_port=22021 train.py -opt train_gfpgan_v1.yml --launcher pytorch ## :scroll: License and Acknowledgement diff --git a/experiments/pretrained_models/README.md b/experiments/pretrained_models/README.md new file mode 100644 index 0000000..3401a5c --- /dev/null +++ b/experiments/pretrained_models/README.md @@ -0,0 +1,7 @@ +# Pre-trained Models and Other Data + +Download pre-trained models and other data. Put them in this folder. + +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) diff --git a/train_gfpgan_v1.yml b/train_gfpgan_v1.yml index 3c31ba6..010048f 100644 --- a/train_gfpgan_v1.yml +++ b/train_gfpgan_v1.yml @@ -9,9 +9,11 @@ datasets: train: name: FFHQ type: FFHQDegradationDataset - dataroot_gt: datasets/ffhq/ffhq_512.lmdb + # dataroot_gt: datasets/ffhq/ffhq_512.lmdb + dataroot_gt: datasets/ffhq/ffhq_512 io_backend: - type: lmdb + # type: lmdb + type: disk use_hflip: true mean: [0.5, 0.5, 0.5] @@ -44,10 +46,12 @@ datasets: prefetch_mode: ~ val: - name: validation1020_512 + # Please modify accordingly to use your own validation + # Or comment the val block if do not need validation during training + name: validation type: PairedImageDataset - dataroot_lq: datasets/faces/validation1020_512/input # TODO: modify before release - dataroot_gt: datasets/faces/validation1020_512/input + dataroot_lq: datasets/faces/validation/input + dataroot_gt: datasets/faces/validation/reference io_backend: type: disk mean: [0.5, 0.5, 0.5]