Shortcuts

sisr_x2_test_config 源代码

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

from mmagic.datasets import BasicImageDataset
from mmagic.datasets.transforms import LoadImageFromFile, PackInputs
from mmagic.engine.runner import MultiTestLoop
from mmagic.evaluation import PSNR, SSIM, Evaluator

[文档]test_pipeline = [ dict( type=LoadImageFromFile, key='img', color_type='color', channel_order='rgb', imdecode_backend='cv2'), dict( type=LoadImageFromFile, key='gt', color_type='color', channel_order='rgb', imdecode_backend='cv2'), dict(type=PackInputs)
] # test config for Set5
[文档]set5_data_root = 'data/Set5'
[文档]set5_dataloader = 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=set5_data_root, data_prefix=dict(img='LRbicx2', gt='GTmod12'), pipeline=test_pipeline))
[文档]set5_evaluator = dict( type=Evaluator, 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( 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=set14_data_root, data_prefix=dict(img='LRbicx2', gt='GTmod12'), pipeline=test_pipeline))
[文档]set14_evaluator = dict( type=Evaluator, 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'
[文档]div2k_dataloader = dict( num_workers=4, persistent_workers=False, drop_last=False, sampler=dict(type=DefaultSampler, shuffle=False), dataset=dict( type=BasicImageDataset, # ann_file='meta_info_DIV2K800sub_GT.txt', ann_file='meta_info_DIV2K100sub_GT.txt', metainfo=dict(dataset_type='div2k', task_name='sisr'), data_root=div2k_data_root, data_prefix=dict( img='DIV2K_train_LR_bicubic/X2_sub', gt='DIV2K_train_HR_sub'), pipeline=test_pipeline))
[文档]div2k_evaluator = dict( type=Evaluator, 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_dataloader = [ set5_dataloader, set14_dataloader, div2k_dataloader,
]
[文档]test_evaluator = [ set5_evaluator, set14_evaluator, div2k_evaluator,
]
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.