Skip to content

Commit

Permalink
Support DF2K
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanxingql committed Oct 26, 2024
1 parent 7c20aad commit 2cc3c13
Show file tree
Hide file tree
Showing 10 changed files with 719 additions and 9 deletions.
54 changes: 54 additions & 0 deletions options/test/ESRGAN/DF2K_LMDB_G2_latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# general settings
name: test_ESRGAN_DF2K_LMDB_G2_latest
model_type: ESRGANModel
scale: 1
num_gpu: 1 # set num_gpu: 0 for cpu mode
manual_seed: 0
reproduce: True

# dataset settings
datasets:
test: # multiple test datasets are acceptable
name: DIV2K
type: PairedImageDataset
dataroot_gt: datasets/DIV2K/valid
dataroot_lq: datasets/DIV2K/valid_BPG_QP37
io_backend:
type: disk

# network structures
network_g:
type: RRDBNet
num_in_ch: 3
num_out_ch: 3
num_feat: 64
num_block: 23
num_grow_ch: 32
scale: 1 # default scale=4

# path
path:
pretrain_network_g: experiments/train_ESRGAN_DF2K_LMDB_G2/models/net_g_latest.pth
param_key_g: params_ema # load the ema model
strict_load_g: true

# validation settings
val:
save_img: false
suffix: ~ # add suffix to saved images, if None, use exp name

metrics:
psnr:
type: pyiqa
ssim:
type: pyiqa
lpips:
type: pyiqa
clipiqa+:
type: pyiqa
topiq_fr:
type: pyiqa
musiq:
type: pyiqa
wadiqam_fr:
type: pyiqa
54 changes: 54 additions & 0 deletions options/test/ESRGAN/RRDBNet_DF2K_LMDB_G2_latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# general settings
name: test_ESRGAN_RRDBNet_DF2K_LMDB_G2_latest
model_type: SRModel
scale: 1
num_gpu: 1 # set num_gpu: 0 for cpu mode
manual_seed: 0
reproduce: True

# dataset settings
datasets:
test: # multiple test datasets are acceptable
name: DIV2K
type: PairedImageDataset
dataroot_gt: datasets/DIV2K/valid
dataroot_lq: datasets/DIV2K/valid_BPG_QP37
io_backend:
type: disk

# network structures
network_g:
type: RRDBNet
num_in_ch: 3
num_out_ch: 3
num_feat: 64
num_block: 23
num_grow_ch: 32
scale: 1 # default scale=4

# path
path:
pretrain_network_g: experiments/train_ESRGAN_RRDBNet_DF2K_LMDB_G2/models/net_g_latest.pth
param_key_g: params_ema # load the ema model
strict_load_g: true

# validation settings
val:
save_img: false
suffix: ~ # add suffix to saved images, if None, use exp name

metrics:
psnr:
type: pyiqa
ssim:
type: pyiqa
lpips:
type: pyiqa
clipiqa+:
type: pyiqa
topiq_fr:
type: pyiqa
musiq:
type: pyiqa
wadiqam_fr:
type: pyiqa
54 changes: 54 additions & 0 deletions options/test/RealESRGAN/DF2K_LMDB_G2_latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# general settings
name: test_RealESRGAN_DF2K_LMDB_G2_latest
model_type: RealESRGANModel
scale: 1
num_gpu: 1 # set num_gpu: 0 for cpu mode
manual_seed: 0
reproduce: True

# dataset settings
datasets:
test: # multiple test datasets are acceptable
name: DIV2K
type: RealESRGANPairedDataset
dataroot_gt: datasets/DIV2K/valid
dataroot_lq: datasets/DIV2K/valid_BPG_QP37
io_backend:
type: disk

# network structures
network_g:
type: RRDBNet
num_in_ch: 3
num_out_ch: 3
num_feat: 64
num_block: 23
num_grow_ch: 32
scale: 1 # default scale=4

# path
path:
pretrain_network_g: experiments/train_RealESRGAN_DF2K_LMDB_G2/models/net_g_latest.pth
param_key_g: params_ema # load the ema model
strict_load_g: true

# validation settings
val:
save_img: False
suffix: ~ # add suffix to saved images, if None, use exp name

metrics:
psnr:
type: pyiqa
ssim:
type: pyiqa
lpips:
type: pyiqa
clipiqa+:
type: pyiqa
topiq_fr:
type: pyiqa
musiq:
type: pyiqa
wadiqam_fr:
type: pyiqa
54 changes: 54 additions & 0 deletions options/test/RealESRGAN/RealESRNet_DF2K_LMDB_G2_latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# general settings
name: test_RealESRGAN_RealESRNet_DF2K_LMDB_G2_latest
model_type: RealESRNetModel
scale: 1
num_gpu: 1 # set num_gpu: 0 for cpu mode
manual_seed: 0
reproduce: True

# dataset settings
datasets:
test: # multiple test datasets are acceptable
name: DIV2K
type: RealESRGANPairedDataset
dataroot_gt: datasets/DIV2K/valid
dataroot_lq: datasets/DIV2K/valid_BPG_QP37
io_backend:
type: disk

# network structures
network_g:
type: RRDBNet
num_in_ch: 3
num_out_ch: 3
num_feat: 64
num_block: 23
num_grow_ch: 32
scale: 1 # default scale=4

# path
path:
pretrain_network_g: experiments/train_RealESRGAN_RealESRNet_DF2K_LMDB_G2/models/net_g_latest.pth
param_key_g: params_ema # load the ema model
strict_load_g: true

# validation settings
val:
save_img: False
suffix: ~ # add suffix to saved images, if None, use exp name

metrics:
psnr:
type: pyiqa
ssim:
type: pyiqa
lpips:
type: pyiqa
clipiqa+:
type: pyiqa
topiq_fr:
type: pyiqa
musiq:
type: pyiqa
wadiqam_fr:
type: pyiqa
129 changes: 129 additions & 0 deletions options/train/ESRGAN/DF2K_LMDB_G2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# general settings
name: train_ESRGAN_DF2K_LMDB_G2
model_type: ESRGANModel
scale: 1
num_gpu: 2 # set num_gpu: 0 for cpu mode
manual_seed: 0
reproduce: True

# dataset and data loader settings
datasets:
train:
name: DF2K
type: PairedImageDataset
# dataroot_gt: datasets/DIV2K/train
# dataroot_lq: datasets/DIV2K/train_BPG_QP37
# io_backend:
# type: disk
dataroot_gt: datasets/DF2K/train_size256_step128_thresh0.lmdb
dataroot_lq: datasets/DF2K/train_BPG_QP37_size256_step128_thresh0.lmdb
io_backend:
type: lmdb

gt_size: 256 # in accord with LMDB
use_hflip: true
use_rot: true

# data loader
num_worker_per_gpu: 24
batch_size_per_gpu: 24
dataset_enlarge_ratio: 1
prefetch_mode: ~

val:
name: DIV2K
type: PairedImageDataset
dataroot_gt: datasets/DIV2K/valid
dataroot_lq: datasets/DIV2K/valid_BPG_QP37
io_backend:
type: disk

# network structures
network_g:
type: RRDBNet
num_in_ch: 3
num_out_ch: 3
num_feat: 64
num_block: 23
num_grow_ch: 32
scale: 1 # default scale=4

network_d:
type: VGGStyleDiscriminator
num_in_ch: 3
num_feat: 64

# path
path:
pretrain_network_g: experiments/train_ESRGAN_RRDBNet_DF2K_LMDB_G2/models/net_g_latest.pth
strict_load_g: true
resume_state: ~

# training settings
train:
ema_decay: 0.999
optim_g:
type: Adam
lr: !!float 1e-4
weight_decay: 0
betas: [0.9, 0.99]
optim_d:
type: Adam
lr: !!float 1e-4
weight_decay: 0
betas: [0.9, 0.99]

scheduler:
type: MultiStepLR
milestones: [50000, 100000, 200000, 300000]
gamma: 0.5

total_iter: 400000
warmup_iter: -1 # no warm up

# losses
pixel_opt:
type: L1Loss
loss_weight: !!float 1e-2
reduction: mean
perceptual_opt:
type: PerceptualLoss
layer_weights:
'conv5_4': 1 # before relu
vgg_type: vgg19
use_input_norm: true
range_norm: false
perceptual_weight: 1.0
style_weight: 0
criterion: l1
gan_opt:
type: GANLoss
gan_type: vanilla
real_label_val: 1.0
fake_label_val: 0.0
loss_weight: !!float 5e-3

net_d_iters: 1
net_d_init_iters: 0

# validation settings
val:
val_freq: !!float 5e4
save_img: false

metrics:
psnr:
type: pyiqa
lpips:
type: pyiqa

# logging settings
logger:
print_freq: 100
save_checkpoint_freq: !!float 1e4
use_tb_logger: true

# dist training settings
dist_params:
backend: nccl
port: 29500
Loading

0 comments on commit 2cc3c13

Please sign in to comment.