Skip to content

Commit

Permalink
defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
mattclifford1 committed Jul 3, 2024
1 parent 97cc904 commit a08f876
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions IQM_Vis/examples/dists.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,26 @@ def correct(img, meta_dict, greycale=True):
def run():
# metrics functions must return a single value
metric = {'DISTS': IQM_Vis.IQMs.DISTS(),
'MAE': IQM_Vis.IQMs.MAE(),
'LPIPS': IQM_Vis.IQMs.LPIPS(),
'1-SSIM': IQM_Vis.IQMs.SSIM(),
'1-MS_SSIM': IQM_Vis.IQMs.MS_SSIM(),
'NLPD': IQM_Vis.IQMs.NLPD(),
# 'LPIPS': IQM_Vis.IQMs.LPIPS(),
'MAE': IQM_Vis.IQMs.MAE(),
# '1-MS_SSIM': IQM_Vis.IQMs.MS_SSIM(),
# 'NLPD': IQM_Vis.IQMs.NLPD(),
}

# metrics images return a numpy image - dont include any for this example
metric_images = {}

# make dataset list of images
files = sorted(glob.glob('/home/matt/datasets/Textures/*'))

data = IQM_Vis.dataset_holder(files,
metric,
metric_images,
load_and_calibrate_image,
image_loader=load_and_calibrate_image,
image_pre_processing=lambda x: x, # no resize at start up
image_post_processing=IQM_Vis.utils.image_utils.crop_centre
image_post_processing=lambda x: IQM_Vis.utils.image_utils.crop_centre(
x, scale_factor=1.5, keep_size=False)
)

# define the transformations
Expand All @@ -115,16 +117,9 @@ def run():
# 'blur':{'min':1, 'max':41, 'normalise':'odd', 'function':IQM_Vis.transforms.blur}, # only odd ints
# 'threshold':{'min':-40, 'max':40, 'function':IQM_Vis.transforms.binary_threshold},
}
# define any parameters that the metrics need (names shared across both metrics and metric_images)
ssim_params = {'sigma': {'min':0.25, 'max':5.25, 'init_value': 1.5}, # for the guassian kernel
# 'kernel_size': {'min':1, 'max':41, 'normalise':'odd', 'init_value': 11}, # ignored if guassian kernel used
'k1': {'min':0.01, 'max':0.21, 'init_value': 0.01},
'k2': {'min':0.01, 'max':0.21, 'init_value': 0.03}}

# use the API to create the UI
IQM_Vis.make_UI(data,
transformations,
metric_params=ssim_params)
IQM_Vis.make_UI(data, transformations)


if __name__ == '__main__':
Expand Down

0 comments on commit a08f876

Please sign in to comment.