diff --git a/.DS_Store b/.DS_Store index 1f088fa..4bb725a 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/evaluation/.DS_Store b/evaluation/.DS_Store index 61fbeb9..c94338e 100755 Binary files a/evaluation/.DS_Store and b/evaluation/.DS_Store differ diff --git a/evaluation/test_RGB.m b/evaluation/test_RGB.m index 818f881..9693dd3 100755 --- a/evaluation/test_RGB.m +++ b/evaluation/test_RGB.m @@ -1,5 +1,5 @@ % Description: -% -testting RGB channels PSNR. +% -testting RGB channels PSNR and SSIM. % % Input: % - Validation/Results: some specific group images with limited endings. @@ -31,6 +31,7 @@ function test_RGB(folder) hr_dir = dir(fullfile(hr_path, '*.png')); count = length(hr_dir); PSNR = zeros(count, 1); +SSIM = zeros(count, 1); IFC = zeros(count, 1); ifc = 0; scale = 4; @@ -39,11 +40,15 @@ function test_RGB(folder) fprintf("Calculating %s\n", hr_dir(i).name); HR = imread(fullfile(hr_dir(i).folder, hr_dir(i).name)); Results = imread(fullfile(result_dir(i).folder, result_dir(i).name)); - [PSNR(i), IFC(i)] = evaluate_SR(HR, Results, scale, ifc); + [PSNR(i), SSIM(i), IFC(i)] = evaluate_SR(HR, Results, scale, ifc); end PSNR(count + 1) = mean(PSNR(:)); +SSIM(count + 1) = mean(SSIM(:)); fprintf("Average PSNR is %f\n", PSNR(count + 1)); +fprintf("Average SSIM is %f\n", SSIM(count + 1)); PSNR_path = fullfile(folder, 'Validation_4x', 'PSNR-GFN_4x_HR.txt'); +SSIM_path = fullfile(folder, 'Validation_4x', 'SSIM-GFN_4x_HR.txt'); save_matrix(PSNR, PSNR_path); +save_matrix(SSIM, SSIM_path); diff --git a/evaluation/test_bicubic.m b/evaluation/test_bicubic.m index 13cb738..8eca797 100755 --- a/evaluation/test_bicubic.m +++ b/evaluation/test_bicubic.m @@ -1,7 +1,7 @@ % ------------------------------------------------------------------------- % Description: % Use bicubic to upscale the input, and evaluate the results in terms -% of PSNR. +% of PSNR and SSIM. % % Input: % - Validation/LR_Blur : Blurry low-resolution input @@ -46,13 +46,17 @@ function test_bicubic(folder) LR_Blur = im2double(imread(fullfile(lr_blur_dir(i).folder, lr_blur_dir(i).name))); LR_Blur_Bic = imresize(LR_Blur, 4, 'bicubic'); imwrite(LR_Blur_Bic, fullfile(results_path, strcat(hr_dir(i).name(1:4), 'Bic.png')),'png'); - [PSNR(i), IFC(i)] = evaluate_SR(HR, LR_Blur_Bic, scale, ifc); + [PSNR(i),SSIM(i), IFC(i)] = evaluate_SR(HR, LR_Blur_Bic, scale, ifc); end PSNR(count + 1) = mean(PSNR(:)); +SSIM(count + 1) = mean(SSIM(:)); fprintf("Average PSNR is %f\n", PSNR(count + 1)); +fprintf("Average SSIM is %f\n", SSIM(count + 1)); PSNR_path = fullfile(folder, 'Validation_4x', 'PSNR-LRBlurBic_HR.txt'); +SSIM_path = fullfile(folder, 'Validation_4x', 'SSIM-LRBlurBic_HR.txt'); save_matrix(PSNR, PSNR_path); +save_matrix(SSIM, SSIM_path); diff --git a/evaluation/utils/evaluate_SR.m b/evaluation/utils/evaluate_SR.m index a0b58c3..fcd154d 100755 --- a/evaluation/utils/evaluate_SR.m +++ b/evaluation/utils/evaluate_SR.m @@ -1,7 +1,7 @@ -function [PSNR, IFC] = evaluate_SR(img_GT, img_HR, scale, compute_ifc) +function [PSNR, SSIM, IFC] = evaluate_SR(img_GT, img_HR, scale, compute_ifc) % ------------------------------------------------------------------------- % Description: -% Compute PSNR and IFC for SR +% Compute PSNR SSIM and IFC for SR % We convert RGB image to grayscale and crop boundaries for 'scale' % pixels % @@ -37,7 +37,7 @@ % evaluate PSNR = psnr(img_GT, img_HR); - %SSIM = ssim(img_GT, img_HR); + SSIM = ssim(img_GT, img_HR); %SSIM = 0; % comment IFC to speed up testing