Skip to content

Commit

Permalink
Merge c504704 into 6736d14
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoXing1996 authored Feb 28, 2023
2 parents 6736d14 + c504704 commit 2b1bbdc
Show file tree
Hide file tree
Showing 348 changed files with 5,767 additions and 4,479 deletions.
1 change: 1 addition & 0 deletions .dev_scripts/test_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def create_test_job_batch(commands, model_info, args, port, script_name):
f'#SBATCH --ntasks=2\n'
f'#SBATCH --cpus-per-task=16\n\n'
f'export MASTER_PORT={port}\n'
f'export CUBLAS_WORKSPACE_CONFIG=:4096:8\n'
f'{runner} -u {script_name} {config} {checkpoint} '
f'--work-dir={work_dir} '
f'--out={result_file} '
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ coverage.xml
*.cover
.hypothesis/
.pytest_cache/
tests/data/out

# Translations
*.mo
Expand Down
2 changes: 1 addition & 1 deletion configs/_base_/datasets/basicvsr_test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
]

# config for test
test_cfg = dict(type='MultiTestLoop')
test_cfg = dict(type='EditTestLoop')
test_dataloader = [
reds_dataloader,
vimeo_90k_bd_dataloader,
Expand Down
15 changes: 12 additions & 3 deletions configs/_base_/datasets/cifar10_nopad.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cifar_pipeline = [
dict(type='Flip', keys=['img'], flip_ratio=0.5, direction='horizontal'),
dict(type='Flip', keys=['gt'], flip_ratio=0.5, direction='horizontal'),
dict(type='PackEditInputs')
]
cifar_dataset = dict(
Expand All @@ -9,6 +9,15 @@
test_mode=False,
pipeline=cifar_pipeline)

# test dataset do not use flip
cifar_pipeline_test = [dict(type='PackEditInputs')]
cifar_dataset_test = dict(
type='CIFAR10',
data_root='./data',
data_prefix='cifar10',
test_mode=False,
pipeline=cifar_pipeline_test)

train_dataloader = dict(
num_workers=2,
dataset=cifar_dataset,
Expand All @@ -18,13 +27,13 @@
val_dataloader = dict(
batch_size=32,
num_workers=2,
dataset=cifar_dataset,
dataset=cifar_dataset_test,
sampler=dict(type='DefaultSampler', shuffle=False),
persistent_workers=True)

test_dataloader = dict(
batch_size=32,
num_workers=2,
dataset=cifar_dataset,
dataset=cifar_dataset_test,
sampler=dict(type='DefaultSampler', shuffle=False),
persistent_workers=True)
1 change: 1 addition & 0 deletions configs/_base_/datasets/comp1k.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

test_dataloader = val_dataloader

# TODO: matting
val_evaluator = [
dict(type='SAD'),
dict(type='MattingMSE'),
Expand Down
13 changes: 8 additions & 5 deletions configs/_base_/datasets/ffhq_flip.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
dataset_type = 'BasicImageDataset'

train_pipeline = [
dict(type='LoadImageFromFile', key='img'),
dict(type='Flip', keys=['img'], direction='horizontal'),
dict(type='PackEditInputs', keys='img')
dict(type='LoadImageFromFile', key='gt'),
dict(type='Flip', keys=['gt'], direction='horizontal'),
dict(type='PackEditInputs', keys='gt')
]

val_pipeline = [
dict(type='LoadImageFromFile', key='img'),
dict(type='PackEditInputs', keys=['img'])
dict(type='LoadImageFromFile', key='gt'),
dict(type='PackEditInputs', keys=['gt'])
]

# `batch_size` and `data_root` need to be set.
Expand All @@ -19,6 +19,7 @@
sampler=dict(type='InfiniteSampler', shuffle=True),
dataset=dict(
type=dataset_type,
data_prefix=dict(gt=''),
data_root=None, # set by user
pipeline=train_pipeline))

Expand All @@ -27,6 +28,7 @@
num_workers=8,
dataset=dict(
type=dataset_type,
data_prefix=dict(gt=''),
data_root=None, # set by user
pipeline=val_pipeline),
sampler=dict(type='DefaultSampler', shuffle=False),
Expand All @@ -37,6 +39,7 @@
num_workers=8,
dataset=dict(
type=dataset_type,
data_prefix=dict(gt=''),
data_root=None, # set by user
pipeline=val_pipeline),
sampler=dict(type='DefaultSampler', shuffle=False),
Expand Down
5 changes: 3 additions & 2 deletions configs/_base_/datasets/grow_scale_imgs_ffhq_styleganv1.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
dataset_type = 'GrowScaleImgDataset'

pipeline = [
dict(type='LoadImageFromFile', key='img'),
dict(type='Flip', keys=['img'], direction='horizontal'),
dict(type='LoadImageFromFile', key='gt'),
dict(type='Flip', keys='gt', direction='horizontal'),
dict(type='PackEditInputs')
]

Expand Down Expand Up @@ -37,6 +37,7 @@
batch_size=64,
dataset=dict(
type='BasicImageDataset',
data_prefix=dict(gt=''),
pipeline=pipeline,
data_root='./data/ffhq/images'),
sampler=dict(type='DefaultSampler', shuffle=False))
Expand Down
14 changes: 7 additions & 7 deletions configs/_base_/datasets/imagenet_128.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
# different from mmcls, we adopt the setting used in BigGAN.
# We use `RandomCropLongEdge` in training and `CenterCropLongEdge` in testing.
train_pipeline = [
dict(type='LoadImageFromFile', key='img'),
dict(type='RandomCropLongEdge', keys=['img']),
dict(type='Resize', scale=(128, 128), keys=['img'], backend='pillow'),
dict(type='Flip', keys=['img'], flip_ratio=0.5, direction='horizontal'),
dict(type='LoadImageFromFile', key='gt'),
dict(type='RandomCropLongEdge', keys='gt'),
dict(type='Resize', scale=(128, 128), keys='gt', backend='pillow'),
dict(type='Flip', keys='gt', flip_ratio=0.5, direction='horizontal'),
dict(type='PackEditInputs')
]

test_pipeline = [
dict(type='LoadImageFromFile', key='img'),
dict(type='CenterCropLongEdge', keys=['img']),
dict(type='Resize', scale=(128, 128), backend='pillow'),
dict(type='LoadImageFromFile', key='gt'),
dict(type='CenterCropLongEdge', keys='gt'),
dict(type='Resize', scale=(128, 128), keys='gt', backend='pillow'),
dict(type='PackEditInputs')
]

Expand Down
14 changes: 7 additions & 7 deletions configs/_base_/datasets/imagenet_512.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
# different from mmcls, we adopt the setting used in BigGAN.
# We use `RandomCropLongEdge` in training and `CenterCropLongEdge` in testing.
train_pipeline = [
dict(type='LoadImageFromFile', key='img'),
dict(type='RandomCropLongEdge', keys=['img']),
dict(type='Resize', scale=(512, 512), keys=['img'], backend='pillow'),
dict(type='Flip', keys=['img'], flip_ratio=0.5, direction='horizontal'),
dict(type='LoadImageFromFile', key='gt'),
dict(type='RandomCropLongEdge', keys='gt'),
dict(type='Resize', scale=(512, 512), keys='gt', backend='pillow'),
dict(type='Flip', keys='gt', flip_ratio=0.5, direction='horizontal'),
dict(type='PackEditInputs')
]

test_pipeline = [
dict(type='LoadImageFromFile', key='img'),
dict(type='CenterCropLongEdge', keys=['img']),
dict(type='Resize', scale=(512, 512), backend='pillow'),
dict(type='LoadImageFromFile', key='gt'),
dict(type='CenterCropLongEdge', keys='gt'),
dict(type='Resize', scale=(512, 512), keys='gt', backend='pillow'),
dict(type='PackEditInputs')
]

Expand Down
14 changes: 7 additions & 7 deletions configs/_base_/datasets/imagenet_64.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
# different from mmcls, we adopt the setting used in BigGAN.
# We use `RandomCropLongEdge` in training and `CenterCropLongEdge` in testing.
train_pipeline = [
dict(type='LoadImageFromFile', key='img'),
dict(type='RandomCropLongEdge', keys=['img']),
dict(type='Resize', scale=(64, 64), keys=['img'], backend='pillow'),
dict(type='Flip', keys=['img'], flip_ratio=0.5, direction='horizontal'),
dict(type='LoadImageFromFile', key='gt'),
dict(type='RandomCropLongEdge', keys='gt'),
dict(type='Resize', scale=(64, 64), keys='gt', backend='pillow'),
dict(type='Flip', keys='gt', flip_ratio=0.5, direction='horizontal'),
dict(type='PackEditInputs')
]

test_pipeline = [
dict(type='LoadImageFromFile', key='img'),
dict(type='CenterCropLongEdge', keys=['img']),
dict(type='Resize', scale=(64, 64), backend='pillow'),
dict(type='LoadImageFromFile', key='gt'),
dict(type='CenterCropLongEdge', keys='gt'),
dict(type='Resize', scale=(64, 64), keys='gt', backend='pillow'),
dict(type='PackEditInputs')
]

Expand Down
3 changes: 1 addition & 2 deletions configs/_base_/datasets/liif_test_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# scale_test = 3
scale_test_list = [2, 3, 4, 6, 18, 30]

test_pipelines = [[
Expand Down Expand Up @@ -74,7 +73,7 @@
] for scale in scale_test_list]

# test config
test_cfg = dict(type='MultiTestLoop')
test_cfg = dict(type='EditTestLoop')
test_dataloader = [
*set5_dataloaders,
*set14_dataloaders,
Expand Down
7 changes: 5 additions & 2 deletions configs/_base_/datasets/lsun_stylegan.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
dataset_type = 'BasicImageDataset'

train_pipeline = [
dict(type='LoadImageFromFile', key='img'),
dict(type='LoadImageFromFile', key='gt'),
dict(type='PackEditInputs')
]

val_pipeline = [
dict(type='LoadImageFromFile', key='img'),
dict(type='LoadImageFromFile', key='gt'),
dict(type='PackEditInputs')
]

Expand All @@ -18,6 +18,7 @@
sampler=dict(type='InfiniteSampler', shuffle=True),
dataset=dict(
type=dataset_type,
data_prefix=dict(gt=''),
data_root=None, # set by user
pipeline=train_pipeline))

Expand All @@ -26,6 +27,7 @@
num_workers=8,
dataset=dict(
type=dataset_type,
data_prefix=dict(gt=''),
data_root=None, # set by user
pipeline=val_pipeline),
sampler=dict(type='DefaultSampler', shuffle=False),
Expand All @@ -36,6 +38,7 @@
num_workers=8,
dataset=dict(
type=dataset_type,
data_prefix=dict(gt=''),
data_root=None, # set by user
pipeline=val_pipeline),
sampler=dict(type='DefaultSampler', shuffle=False),
Expand Down
6 changes: 4 additions & 2 deletions configs/_base_/datasets/paired_imgs_256x256_crop.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
# }),
# dict(
# type='PackEditInputs',
# keys=[f'img_{domain_a}', f'img_{domain_b}'],)
# keys=[f'img_{domain_a}', f'img_{domain_b}'],
# data_keys=[f'img_{domain_a}', f'img_{domain_b}'])
]

test_pipeline = [
Expand Down Expand Up @@ -64,7 +65,8 @@
# }),
# dict(
# type='PackEditInputs',
# keys=[f'img_{domain_a}', f'img_{domain_b}'],)
# keys=[f'img_{domain_a}', f'img_{domain_b}'],
# data_keys=[f'img_{domain_a}', f'img_{domain_b}'])
]

# `batch_size` and `data_root` need to be set.
Expand Down
34 changes: 19 additions & 15 deletions configs/_base_/datasets/sisr_x2_test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
data_root=set5_data_root,
data_prefix=dict(img='LRbicx2', gt='GTmod12'),
pipeline=test_pipeline))
set5_evaluator = [
dict(type='PSNR', crop_border=2, prefix='Set5'),
dict(type='SSIM', crop_border=2, prefix='Set5'),
]
set5_evaluator = dict(
type='EditEvaluator',
metrics=[
dict(type='PSNR', crop_border=2, prefix='Set5'),
dict(type='SSIM', crop_border=2, prefix='Set5'),
])

set14_data_root = 'data/Set14'
set14_dataloader = dict(
Expand All @@ -44,10 +46,12 @@
data_root=set14_data_root,
data_prefix=dict(img='LRbicx2', gt='GTmod12'),
pipeline=test_pipeline))
set14_evaluator = [
dict(type='PSNR', crop_border=2, prefix='Set14'),
dict(type='SSIM', crop_border=2, prefix='Set14'),
]
set14_evaluator = dict(
type='EditEvaluator',
metrics=[
dict(type='PSNR', crop_border=2, prefix='Set14'),
dict(type='SSIM', crop_border=2, prefix='Set14'),
])

# test config for DIV2K
div2k_data_root = 'data/DIV2K'
Expand All @@ -62,18 +66,18 @@
ann_file='meta_info_DIV2K100sub_GT.txt',
metainfo=dict(dataset_type='div2k', task_name='sisr'),
data_root=div2k_data_root,
# TODO: what this"
data_prefix=dict(
img='DIV2K_train_LR_bicubic/X2_sub', gt='DIV2K_train_HR_sub'),
# filename_tmpl=dict(img='{}_x2', gt='{}'),
pipeline=test_pipeline))
div2k_evaluator = [
dict(type='PSNR', crop_border=2, prefix='DIV2K'),
dict(type='SSIM', crop_border=2, prefix='DIV2K'),
]
div2k_evaluator = dict(
type='EditEvaluator',
metrics=[
dict(type='PSNR', crop_border=2, prefix='DIV2K'),
dict(type='SSIM', crop_border=2, prefix='DIV2K'),
])

# test config
test_cfg = dict(type='MultiTestLoop')
test_cfg = dict(type='EditTestLoop')
test_dataloader = [
set5_dataloader,
set14_dataloader,
Expand Down
32 changes: 19 additions & 13 deletions configs/_base_/datasets/sisr_x3_test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
data_root=set5_data_root,
data_prefix=dict(img='LRbicx3', gt='GTmod12'),
pipeline=test_pipeline))
set5_evaluator = [
dict(type='PSNR', crop_border=3, prefix='Set5'),
dict(type='SSIM', crop_border=3, prefix='Set5'),
]
set5_evaluator = dict(
type='EditEvaluator',
metrics=[
dict(type='PSNR', crop_border=3, prefix='Set5'),
dict(type='SSIM', crop_border=3, prefix='Set5'),
])

set14_data_root = 'data/Set14'
set14_dataloader = dict(
Expand All @@ -44,10 +46,12 @@
data_root=set14_data_root,
data_prefix=dict(img='LRbicx3', gt='GTmod12'),
pipeline=test_pipeline))
set14_evaluator = [
dict(type='PSNR', crop_border=3, prefix='Set14'),
dict(type='SSIM', crop_border=3, prefix='Set14'),
]
set14_evaluator = dict(
type='EditEvaluator',
metrics=[
dict(type='PSNR', crop_border=3, prefix='Set14'),
dict(type='SSIM', crop_border=3, prefix='Set14'),
])

# test config for DIV2K
div2k_data_root = 'data/DIV2K'
Expand All @@ -64,13 +68,15 @@
data_prefix=dict(
img='DIV2K_train_LR_bicubic/X3_sub', gt='DIV2K_train_HR_sub'),
pipeline=test_pipeline))
div2k_evaluator = [
dict(type='PSNR', crop_border=3, prefix='DIV2K'),
dict(type='SSIM', crop_border=3, prefix='DIV2K'),
]
div2k_evaluator = dict(
type='EditEvaluator',
metrics=[
dict(type='PSNR', crop_border=3, prefix='DIV2K'),
dict(type='SSIM', crop_border=3, prefix='DIV2K'),
])

# test config
test_cfg = dict(type='MultiTestLoop')
test_cfg = dict(type='EditTestLoop')
test_dataloader = [
set5_dataloader,
set14_dataloader,
Expand Down
Loading

0 comments on commit 2b1bbdc

Please sign in to comment.