-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathevaluation.m
More file actions
executable file
·76 lines (44 loc) · 1.81 KB
/
Copy pathevaluation.m
File metadata and controls
executable file
·76 lines (44 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
%% This script evaluate the results using matlab
clear all; clc;
% parameters setting
result_folder = 'results';
% settings
lfreconslist = dir(fullfile(result_folder, 'SR', '*.mat'));
lflabellist = dir(fullfile(result_folder, 'HR', '*.mat'));
% lflabellist = dir(fullfile(['../Data/MAT/', dataset, '/*.mat']));
meanPSNRs = [];
meanSSIMs = [];
N = length(lfreconslist);
for i = 1:N
reconstruction = load(fullfile(result_folder, 'SR', lfreconslist(i).name));
reconstruction = squeeze(reconstruction.data);
reconstruction = permute(reconstruction, [3,4,1,2]);
groundtruth = load(fullfile(result_folder, 'HR', lflabellist(i).name));
groundtruth = squeeze(groundtruth.data); % [height, width, sview, tview]
groundtruth = permute(groundtruth, [3,4,1,2]);
s = size(reconstruction, 1);
t = size(reconstruction, 2);
PSNR = zeros(s,t);
SSIM = zeros(s,t);
for j = 1 : s
for k = 1 : t
gt_img = squeeze(groundtruth(j,k,:,:));
gt_img = im2double(gt_img);
recons_img = squeeze(reconstruction(j,k,:,:));
recons_img = im2double(recons_img);
tem_psnr = psnr(gt_img, recons_img);
tem_ssim = ssim(gt_img, recons_img);
PSNR(j,k) = tem_psnr;
SSIM(j,k) = tem_ssim;
end
end
meanPSNRs(end+1) = mean(PSNR(:));
meanSSIMs(end+1) = mean(SSIM(:));
%%% print to command window
fprintf('[%s]\n', lfreconslist(i).name(1:end-4));
fprintf('[PSNR] %0.8f\t', mean(PSNR(:)));
fprintf('[SSIM] %0.8f\n', mean(SSIM(:)));
fprintf('-----------------------------------------------\n');
end
fprintf('\nThe entire MEAN PSNR value for dataset is: %0.8f', mean(meanPSNRs));
fprintf('\nThe entire MEAN SSIM value for dataset is: %0.8f', mean(meanSSIMs));