-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathnafnet_c64eb11128mb1db1111_8xb8-lr1e-3-400k_gopro.py
113 lines (99 loc) · 3.15 KB
/
nafnet_c64eb11128mb1db1111_8xb8-lr1e-3-400k_gopro.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
_base_ = '../_base_/default_runtime.py'
experiment_name = 'nafnet_c64eb11128mb1db1111_lr1e-3_400k_gopro'
work_dir = f'./work_dirs/{experiment_name}'
save_dir = './work_dirs/'
# model settings
model = dict(
type='BaseEditModel',
generator=dict(
type='NAFNetLocal',
img_channels=3,
mid_channels=64,
enc_blk_nums=[1, 1, 1, 28],
middle_blk_num=1,
dec_blk_nums=[1, 1, 1, 1],
),
pixel_loss=dict(type='PSNRLoss'),
train_cfg=dict(),
test_cfg=dict(),
data_preprocessor=dict(
type='DataPreprocessor',
mean=[0., 0., 0.],
std=[255., 255., 255.],
))
train_pipeline = [
dict(type='LoadImageFromFile', key='img'),
dict(type='LoadImageFromFile', key='gt'),
dict(type='SetValues', dictionary=dict(scale=1)),
dict(
type='Flip',
keys=['img', 'gt'],
flip_ratio=0.5,
direction='horizontal'),
dict(
type='Flip', keys=['img', 'gt'], flip_ratio=0.5, direction='vertical'),
dict(type='RandomTransposeHW', keys=['img', 'gt'], transpose_ratio=0.5),
dict(type='PairedRandomCrop', gt_patch_size=256),
dict(type='PackInputs')
]
val_pipeline = [
dict(type='LoadImageFromFile', key='img', channel_order='rgb'),
dict(type='LoadImageFromFile', key='gt', channel_order='rgb'),
dict(type='PackInputs')
]
# dataset settings
dataset_type = 'BasicImageDataset'
train_dataloader = dict(
num_workers=8,
batch_size=8, # gpus 4
persistent_workers=False,
sampler=dict(type='InfiniteSampler', shuffle=True),
dataset=dict(
type=dataset_type,
metainfo=dict(dataset_type='gopro', task_name='deblur'),
data_root='./data/gopro/train',
data_prefix=dict(gt='sharp', img='blur'),
pipeline=train_pipeline))
val_dataloader = dict(
num_workers=4,
persistent_workers=False,
drop_last=False,
sampler=dict(type='DefaultSampler', shuffle=False),
dataset=dict(
type=dataset_type,
metainfo=dict(dataset_type='gopro', task_name='deblur'),
data_root='./data/gopro/test',
data_prefix=dict(gt='sharp', img='blur'),
pipeline=val_pipeline))
test_dataloader = val_dataloader
val_evaluator = [
dict(type='MAE'),
dict(type='PSNR'),
dict(type='SSIM'),
]
test_evaluator = val_evaluator
train_cfg = dict(
type='IterBasedTrainLoop', max_iters=400_000, val_interval=20000)
val_cfg = dict(type='MultiValLoop')
test_cfg = dict(type='MultiTestLoop')
optim_wrapper = dict(
constructor='DefaultOptimWrapperConstructor',
type='OptimWrapper',
optimizer=dict(type='AdamW', lr=1e-3, weight_decay=1e-3, betas=(0.9, 0.9)))
# learning policy
param_scheduler = dict(
type='CosineAnnealingLR', by_epoch=False, T_max=400_000, eta_min=1e-7)
default_hooks = dict(
checkpoint=dict(
type='CheckpointHook',
interval=5000,
save_optimizer=True,
by_epoch=False,
out_dir=save_dir,
),
timer=dict(type='IterTimerHook'),
logger=dict(type='LoggerHook', interval=100),
param_scheduler=dict(type='ParamSchedulerHook'),
sampler_seed=dict(type='DistSamplerSeedHook'),
)
randomness = dict(seed=10, diff_rank_seed=True)