forked from open-mmlab/mmagic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
realesrgan_c64b23g32_4xb12-lr1e-4-400k_df2k-ost.py
78 lines (71 loc) · 1.98 KB
/
realesrgan_c64b23g32_4xb12-lr1e-4-400k_df2k-ost.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
_base_ = './realesrnet_c64b23g32_4xb12-lr2e-4-1000k_df2k-ost.py'
experiment_name = 'realesrgan_c64b23g32_4xb12-lr1e-4-400k_df2k-ost'
work_dir = f'./work_dirs/{experiment_name}'
save_dir = './work_dirs/'
# load_from = # path of pre-trained real-esrnet
scale = 4
# model settings
model = dict(
type='RealESRGAN',
generator=dict(
type='RRDBNet',
in_channels=3,
out_channels=3,
mid_channels=64,
num_blocks=23,
growth_channels=32,
upscale_factor=scale),
discriminator=dict(
type='UNetDiscriminatorWithSpectralNorm',
in_channels=3,
mid_channels=64,
skip_connection=True),
pixel_loss=dict(type='L1Loss', loss_weight=1.0, reduction='mean'),
perceptual_loss=dict(
type='PerceptualLoss',
layer_weights={
'2': 0.1,
'7': 0.1,
'16': 1.0,
'25': 1.0,
'34': 1.0,
},
vgg_type='vgg19',
perceptual_weight=1.0,
style_weight=0,
norm_img=False),
gan_loss=dict(
type='GANLoss',
gan_type='vanilla',
loss_weight=1e-1,
real_label_val=1.0,
fake_label_val=0),
is_use_sharpened_gt_in_pixel=True,
is_use_sharpened_gt_in_percep=True,
is_use_sharpened_gt_in_gan=False,
is_use_ema=True,
train_cfg=dict(start_iter=1000000),
test_cfg=dict(),
data_preprocessor=dict(
type='DataPreprocessor',
mean=[0., 0., 0.],
std=[255., 255., 255.],
))
train_cfg = dict(
_delete_=True,
type='IterBasedTrainLoop',
max_iters=400_000,
val_interval=5000)
# optimizer
optim_wrapper = dict(
_delete_=True,
constructor='MultiOptimWrapperConstructor',
generator=dict(
type='OptimWrapper',
optimizer=dict(type='Adam', lr=1e-4, betas=(0.9, 0.99))),
discriminator=dict(
type='OptimWrapper',
optimizer=dict(type='Adam', lr=1e-4, betas=(0.9, 0.99))),
)
# learning policy
param_scheduler = None