Shortcuts

liif_test_config 源代码

# Copyright (c) OpenMMLab. All rights reserved.
from mmengine.dataset import DefaultSampler

from mmagic.datasets import BasicImageDataset
from mmagic.datasets.transforms import (GenerateCoordinateAndCell,
                                        LoadImageFromFile, PackInputs,
                                        RandomDownSampling)
from mmagic.engine.runner import MultiTestLoop
from mmagic.evaluation import PSNR, SSIM

[文档]scale_test_list = [2, 3, 4, 6, 18, 30]
[文档]test_pipelines = [[ dict( type=LoadImageFromFile, key='gt', color_type='color', channel_order='rgb', imdecode_backend='cv2'), dict(type=RandomDownSampling, scale_min=scale_test, scale_max=scale_test), dict(type=GenerateCoordinateAndCell, scale=scale_test, reshape_gt=False), dict(type=PackInputs) ] for scale_test in scale_test_list]
# test config for Set5
[文档]set5_dataloaders = [ dict( num_workers=4, persistent_workers=False, drop_last=False, sampler=dict(type=DefaultSampler, shuffle=False), dataset=dict( type=BasicImageDataset, metainfo=dict(dataset_type='set5', task_name='sisr'), data_root='data/Set5', data_prefix=dict(img='LRbicx4', gt='GTmod12'), pipeline=test_pipeline)) for test_pipeline in test_pipelines
]
[文档]set5_evaluators = [[ dict(type=PSNR, crop_border=scale, prefix=f'Set5x{scale}'), dict(type=SSIM, crop_border=scale, prefix=f'Set5x{scale}'), ] for scale in scale_test_list]
# test config for Set14
[文档]set14_dataloaders = [ dict( num_workers=4, persistent_workers=False, drop_last=False, sampler=dict(type=DefaultSampler, shuffle=False), dataset=dict( type=BasicImageDataset, metainfo=dict(dataset_type='set14', task_name='sisr'), data_root='data/Set14', data_prefix=dict(img='LRbicx4', gt='GTmod12'), pipeline=test_pipeline)) for test_pipeline in test_pipelines
]
[文档]set14_evaluators = [[ dict(type=PSNR, crop_border=scale, prefix=f'Set14x{scale}'), dict(type=SSIM, crop_border=scale, prefix=f'Set14x{scale}'), ] for scale in scale_test_list]
# test config for DIV2K
[文档]div2k_dataloaders = [ dict( num_workers=4, persistent_workers=False, drop_last=False, sampler=dict(type=DefaultSampler, shuffle=False), dataset=dict( type=BasicImageDataset, ann_file='meta_info_DIV2K100sub_GT.txt', metainfo=dict(dataset_type='div2k', task_name='sisr'), data_root='data/DIV2K', data_prefix=dict( img='DIV2K_train_LR_bicubic/X4_sub', gt='DIV2K_train_HR_sub'), pipeline=test_pipeline)) for test_pipeline in test_pipelines
]
[文档]div2k_evaluators = [[ dict(type=PSNR, crop_border=scale, prefix=f'DIV2Kx{scale}'), dict(type=SSIM, crop_border=scale, prefix=f'DIV2Kx{scale}'), ] for scale in scale_test_list]
# test config
[文档]test_cfg = dict(type=MultiTestLoop)
[文档]test_dataloader = [ *set5_dataloaders, *set14_dataloaders, *div2k_dataloaders,
]
[文档]test_evaluator = [ *set5_evaluators, *set14_evaluators, *div2k_evaluators,
]
Read the Docs v: latest
Versions
latest
stable
0.x
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.