mirror of
https://github.com/TencentARC/GFPGAN.git
synced 2025-05-28 13:10:10 -07:00
141 lines
2.6 KiB
YAML
141 lines
2.6 KiB
YAML
num_gpu: 1
|
|
manual_seed: 0
|
|
is_train: True
|
|
dist: False
|
|
|
|
# network structures
|
|
network_g:
|
|
type: GFPGANv1
|
|
out_size: 512
|
|
num_style_feat: 512
|
|
channel_multiplier: 1
|
|
resample_kernel: [1, 3, 3, 1]
|
|
decoder_load_path: ~
|
|
fix_decoder: true
|
|
num_mlp: 8
|
|
lr_mlp: 0.01
|
|
input_is_latent: true
|
|
different_w: true
|
|
narrow: 0.5
|
|
sft_half: true
|
|
|
|
network_d:
|
|
type: StyleGAN2Discriminator
|
|
out_size: 512
|
|
channel_multiplier: 1
|
|
resample_kernel: [1, 3, 3, 1]
|
|
|
|
network_d_left_eye:
|
|
type: FacialComponentDiscriminator
|
|
|
|
network_d_right_eye:
|
|
type: FacialComponentDiscriminator
|
|
|
|
network_d_mouth:
|
|
type: FacialComponentDiscriminator
|
|
|
|
network_identity:
|
|
type: ResNetArcFace
|
|
block: IRBlock
|
|
layers: [2, 2, 2, 2]
|
|
use_se: False
|
|
|
|
# path
|
|
path:
|
|
pretrain_network_g: ~
|
|
param_key_g: params_ema
|
|
strict_load_g: ~
|
|
pretrain_network_d: ~
|
|
pretrain_network_d_left_eye: ~
|
|
pretrain_network_d_right_eye: ~
|
|
pretrain_network_d_mouth: ~
|
|
pretrain_network_identity: ~
|
|
# resume
|
|
resume_state: ~
|
|
ignore_resume_networks: ['network_identity']
|
|
|
|
# training settings
|
|
train:
|
|
optim_g:
|
|
type: Adam
|
|
lr: !!float 2e-3
|
|
optim_d:
|
|
type: Adam
|
|
lr: !!float 2e-3
|
|
optim_component:
|
|
type: Adam
|
|
lr: !!float 2e-3
|
|
|
|
scheduler:
|
|
type: MultiStepLR
|
|
milestones: [600000, 700000]
|
|
gamma: 0.5
|
|
|
|
total_iter: 800000
|
|
warmup_iter: -1 # no warm up
|
|
|
|
# losses
|
|
# pixel loss
|
|
pixel_opt:
|
|
type: L1Loss
|
|
loss_weight: !!float 1e-1
|
|
reduction: mean
|
|
# L1 loss used in pyramid loss, component style loss and identity loss
|
|
L1_opt:
|
|
type: L1Loss
|
|
loss_weight: 1
|
|
reduction: mean
|
|
|
|
# image pyramid loss
|
|
pyramid_loss_weight: 1
|
|
remove_pyramid_loss: 50000
|
|
# perceptual loss (content and style losses)
|
|
perceptual_opt:
|
|
type: PerceptualLoss
|
|
layer_weights:
|
|
# before relu
|
|
'conv1_2': 0.1
|
|
'conv2_2': 0.1
|
|
'conv3_4': 1
|
|
'conv4_4': 1
|
|
'conv5_4': 1
|
|
vgg_type: vgg19
|
|
use_input_norm: true
|
|
perceptual_weight: !!float 1
|
|
style_weight: 50
|
|
range_norm: true
|
|
criterion: l1
|
|
# gan loss
|
|
gan_opt:
|
|
type: GANLoss
|
|
gan_type: wgan_softplus
|
|
loss_weight: !!float 1e-1
|
|
# r1 regularization for discriminator
|
|
r1_reg_weight: 10
|
|
# facial component loss
|
|
gan_component_opt:
|
|
type: GANLoss
|
|
gan_type: vanilla
|
|
real_label_val: 1.0
|
|
fake_label_val: 0.0
|
|
loss_weight: !!float 1
|
|
comp_style_weight: 200
|
|
# identity loss
|
|
identity_weight: 10
|
|
|
|
net_d_iters: 1
|
|
net_d_init_iters: 0
|
|
net_d_reg_every: 1
|
|
|
|
# validation settings
|
|
val:
|
|
val_freq: !!float 5e3
|
|
save_img: True
|
|
use_pbar: True
|
|
|
|
metrics:
|
|
psnr: # metric name
|
|
type: calculate_psnr
|
|
crop_border: 0
|
|
test_y_channel: false
|