GFPGAN
1# general settings
2name: train_GFPGANv1_512_simple
3model_type: GFPGANModel
4num_gpu: auto # officially, we use 4 GPUs
5manual_seed: 0
6
7# dataset and data loader settings
8datasets:
9train:
10name: FFHQ
11type: FFHQDegradationDataset
12# dataroot_gt: datasets/ffhq/ffhq_512.lmdb
13dataroot_gt: datasets/ffhq/ffhq_512
14io_backend:
15# type: lmdb
16type: disk
17
18use_hflip: true
19mean: [0.5, 0.5, 0.5]
20std: [0.5, 0.5, 0.5]
21out_size: 512
22
23blur_kernel_size: 41
24kernel_list: ['iso', 'aniso']
25kernel_prob: [0.5, 0.5]
26blur_sigma: [0.1, 10]
27downsample_range: [0.8, 8]
28noise_range: [0, 20]
29jpeg_range: [60, 100]
30
31# color jitter and gray
32color_jitter_prob: 0.3
33color_jitter_shift: 20
34color_jitter_pt_prob: 0.3
35gray_prob: 0.01
36
37# If you do not want colorization, please set
38# color_jitter_prob: ~
39# color_jitter_pt_prob: ~
40# gray_prob: 0.01
41# gt_gray: True
42
43# data loader
44use_shuffle: true
45num_worker_per_gpu: 6
46batch_size_per_gpu: 3
47dataset_enlarge_ratio: 1
48prefetch_mode: ~
49
50val:
51# Please modify accordingly to use your own validation
52# Or comment the val block if do not need validation during training
53name: validation
54type: PairedImageDataset
55dataroot_lq: datasets/faces/validation/input
56dataroot_gt: datasets/faces/validation/reference
57io_backend:
58type: disk
59mean: [0.5, 0.5, 0.5]
60std: [0.5, 0.5, 0.5]
61scale: 1
62
63# network structures
64network_g:
65type: GFPGANv1
66out_size: 512
67num_style_feat: 512
68channel_multiplier: 1
69resample_kernel: [1, 3, 3, 1]
70decoder_load_path: experiments/pretrained_models/StyleGAN2_512_Cmul1_FFHQ_B12G4_scratch_800k.pth
71fix_decoder: true
72num_mlp: 8
73lr_mlp: 0.01
74input_is_latent: true
75different_w: true
76narrow: 1
77sft_half: true
78
79network_d:
80type: StyleGAN2Discriminator
81out_size: 512
82channel_multiplier: 1
83resample_kernel: [1, 3, 3, 1]
84
85
86# path
87path:
88pretrain_network_g: ~
89param_key_g: params_ema
90strict_load_g: ~
91pretrain_network_d: ~
92resume_state: ~
93
94# training settings
95train:
96optim_g:
97type: Adam
98lr: !!float 2e-3
99optim_d:
100type: Adam
101lr: !!float 2e-3
102optim_component:
103type: Adam
104lr: !!float 2e-3
105
106scheduler:
107type: MultiStepLR
108milestones: [600000, 700000]
109gamma: 0.5
110
111total_iter: 800000
112warmup_iter: -1 # no warm up
113
114# losses
115# pixel loss
116pixel_opt:
117type: L1Loss
118loss_weight: !!float 1e-1
119reduction: mean
120# L1 loss used in pyramid loss, component style loss and identity loss
121L1_opt:
122type: L1Loss
123loss_weight: 1
124reduction: mean
125
126# image pyramid loss
127pyramid_loss_weight: 1
128remove_pyramid_loss: 50000
129# perceptual loss (content and style losses)
130perceptual_opt:
131type: PerceptualLoss
132layer_weights:
133# before relu
134'conv1_2': 0.1
135'conv2_2': 0.1
136'conv3_4': 1
137'conv4_4': 1
138'conv5_4': 1
139vgg_type: vgg19
140use_input_norm: true
141perceptual_weight: !!float 1
142style_weight: 50
143range_norm: true
144criterion: l1
145# gan loss
146gan_opt:
147type: GANLoss
148gan_type: wgan_softplus
149loss_weight: !!float 1e-1
150# r1 regularization for discriminator
151r1_reg_weight: 10
152
153net_d_iters: 1
154net_d_init_iters: 0
155net_d_reg_every: 16
156
157# validation settings
158val:
159val_freq: !!float 5e3
160save_img: true
161
162metrics:
163psnr: # metric name
164type: calculate_psnr
165crop_border: 0
166test_y_channel: false
167
168# logging settings
169logger:
170print_freq: 100
171save_checkpoint_freq: !!float 5e3
172use_tb_logger: true
173wandb:
174project: ~
175resume_id: ~
176
177# dist training settings
178dist_params:
179backend: nccl
180port: 29500
181
182find_unused_parameters: true
183