-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add checkpoints * [Feature] Add LIIF-RDN * Add checkpoints * Update * Fix Co-authored-by: liyinshuo <[email protected]>
- Loading branch information
Showing
7 changed files
with
303 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
158 changes: 158 additions & 0 deletions
158
configs/restorers/liif/liif_rdn_norm_x2-4_c64b16_g1_1000k_div2k.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
exp_name = 'liif_rdn_norm_x2-4_c64b16_g1_1000k_div2k' | ||
scale_min, scale_max = 1, 4 | ||
|
||
# model settings | ||
model = dict( | ||
type='LIIF', | ||
generator=dict( | ||
type='LIIFRDN', | ||
encoder=dict( | ||
type='RDN', | ||
in_channels=3, | ||
out_channels=3, | ||
mid_channels=64, | ||
num_blocks=16, | ||
upscale_factor=4, | ||
num_layers=8, | ||
channel_growth=64), | ||
imnet=dict( | ||
type='MLPRefiner', | ||
in_dim=64, | ||
out_dim=3, | ||
hidden_list=[256, 256, 256, 256]), | ||
local_ensemble=True, | ||
feat_unfold=True, | ||
cell_decode=True, | ||
eval_bsize=30000), | ||
rgb_mean=(0.5, 0.5, 0.5), | ||
rgb_std=(0.5, 0.5, 0.5), | ||
pixel_loss=dict(type='L1Loss', loss_weight=1.0, reduction='mean')) | ||
# model training and testing settings | ||
train_cfg = None | ||
test_cfg = dict(metrics=['PSNR', 'SSIM'], crop_border=scale_max) | ||
|
||
# dataset settings | ||
scale_min, scale_max = 1, 4 | ||
# dataset settings | ||
train_dataset_type = 'SRFolderGTDataset' | ||
val_dataset_type = 'SRFolderGTDataset' | ||
test_dataset_type = 'SRFolderDataset' | ||
train_pipeline = [ | ||
dict( | ||
type='LoadImageFromFile', | ||
io_backend='disk', | ||
key='gt', | ||
flag='color', | ||
channel_order='rgb'), | ||
dict( | ||
type='RandomDownSampling', | ||
scale_min=scale_min, | ||
scale_max=scale_max, | ||
patch_size=48), | ||
dict(type='RescaleToZeroOne', keys=['lq', 'gt']), | ||
dict( | ||
type='Flip', keys=['lq', 'gt'], flip_ratio=0.5, | ||
direction='horizontal'), | ||
dict(type='Flip', keys=['lq', 'gt'], flip_ratio=0.5, direction='vertical'), | ||
dict(type='RandomTransposeHW', keys=['lq', 'gt'], transpose_ratio=0.5), | ||
dict(type='ImageToTensor', keys=['lq', 'gt']), | ||
dict(type='GenerateCoordinateAndCell', sample_quantity=2304), | ||
dict( | ||
type='Collect', | ||
keys=['lq', 'gt', 'coord', 'cell'], | ||
meta_keys=['gt_path']) | ||
] | ||
valid_pipeline = [ | ||
dict( | ||
type='LoadImageFromFile', | ||
io_backend='disk', | ||
key='gt', | ||
flag='color', | ||
channel_order='rgb'), | ||
dict(type='RandomDownSampling', scale_min=scale_max, scale_max=scale_max), | ||
dict(type='RescaleToZeroOne', keys=['lq', 'gt']), | ||
dict(type='ImageToTensor', keys=['lq', 'gt']), | ||
dict(type='GenerateCoordinateAndCell'), | ||
dict( | ||
type='Collect', | ||
keys=['lq', 'gt', 'coord', 'cell'], | ||
meta_keys=['gt_path']) | ||
] | ||
test_pipeline = [ | ||
dict( | ||
type='LoadImageFromFile', | ||
io_backend='disk', | ||
key='gt', | ||
flag='color', | ||
channel_order='rgb'), | ||
dict( | ||
type='LoadImageFromFile', | ||
io_backend='disk', | ||
key='lq', | ||
flag='color', | ||
channel_order='rgb'), | ||
dict(type='RescaleToZeroOne', keys=['lq', 'gt']), | ||
dict(type='ImageToTensor', keys=['lq', 'gt']), | ||
dict(type='GenerateCoordinateAndCell', scale=scale_max), | ||
dict( | ||
type='Collect', | ||
keys=['lq', 'gt', 'coord', 'cell'], | ||
meta_keys=['gt_path']) | ||
] | ||
|
||
data = dict( | ||
workers_per_gpu=8, | ||
train_dataloader=dict(samples_per_gpu=16, drop_last=True), | ||
val_dataloader=dict(samples_per_gpu=1), | ||
test_dataloader=dict(samples_per_gpu=1), | ||
train=dict( | ||
type='RepeatDataset', | ||
times=20, | ||
dataset=dict( | ||
type=train_dataset_type, | ||
gt_folder='data/DIV2K/DIV2K_train_HR', | ||
pipeline=train_pipeline, | ||
scale=scale_max)), | ||
val=dict( | ||
type=val_dataset_type, | ||
gt_folder='data/val_set5/Set5', | ||
pipeline=valid_pipeline, | ||
scale=scale_max), | ||
test=dict( | ||
type=test_dataset_type, | ||
lq_folder=f'data/val_set5/Set5_bicLRx{scale_max:d}', | ||
gt_folder='data/val_set5/Set5', | ||
pipeline=test_pipeline, | ||
scale=scale_max, | ||
filename_tmpl='{}')) | ||
|
||
# optimizer | ||
optimizers = dict(type='Adam', lr=1.e-4) | ||
|
||
# learning policy | ||
iter_per_epoch = 1000 | ||
total_iters = 1000 * iter_per_epoch | ||
lr_config = dict( | ||
policy='Step', | ||
by_epoch=False, | ||
step=[200000, 400000, 600000, 800000], | ||
gamma=0.5) | ||
|
||
checkpoint_config = dict(interval=3000, save_optimizer=True, by_epoch=False) | ||
evaluation = dict(interval=3000, save_image=True, gpu_collect=True) | ||
log_config = dict( | ||
interval=100, | ||
hooks=[ | ||
dict(type='TextLoggerHook', by_epoch=False), | ||
dict(type='TensorboardLoggerHook') | ||
]) | ||
visual_config = None | ||
|
||
# runtime settings | ||
dist_params = dict(backend='nccl') | ||
log_level = 'INFO' | ||
work_dir = f'./work_dirs/{exp_name}' | ||
load_from = None | ||
resume_from = None | ||
workflow = [('train', 1)] | ||
find_unused_parameters = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters