-
Notifications
You must be signed in to change notification settings - Fork 52
/
statistic_rain100L.m
77 lines (53 loc) · 2.18 KB
/
statistic_rain100L.m
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
clear all;
close all;
gt_path='../datasets/test/Rain100L/';
JORDER_path='../results/Rain100L/Rain100L_JORDER/';
PReNet = '../results/Rain100L/PReNet/';
PReNet_r = '../results/Rain100L/PReNet_r/';
PRN = '../results/Rain100L/PRN6/';
PRN_r = '../results/Rain100L/PRN_r/';
struct_model = {
struct('model_name','PReNet','path',PReNet),...
struct('model_name','PReNet_r','path',PReNet_r),...
struct('model_name','PRN','path',PRN),...
struct('model_name','PRN_r','path',PRN_r),...
};
nimgs=100;nrain=1;
nmodel = length(struct_model);
psnrs = zeros(nimgs,nmodel);
ssims = psnrs;
for nnn = 1:nmodel
tp=0;ts=0;te=0;
nstart = 0;
for iii=nstart+1:nstart+nimgs
for jjj=1:nrain
% fprintf('img=%d,kernel=%d\n',iii,jjj);
x_true=im2double(imread(fullfile(gt_path,sprintf('norain-%03d.png',iii))));%x_true
x_true = rgb2ycbcr(x_true);x_true=x_true(:,:,1);
%%
x = (im2double(imread(fullfile(struct_model{nnn}.path,sprintf('rain-%03d.png',iii)))));
x = rgb2ycbcr(x);x = x(:,:,1);
tp = mean(psnr(x,x_true));
ts = ssim(x*255,x_true*255);
psnrs(iii-nstart,nnn)=tp;
ssims(iii-nstart,nnn)=ts;
%
end
end
fprintf('%s: psnr=%6.4f, ssim=%6.4f\n',struct_model{nnn}.model_name,mean(psnrs(:,nnn)),mean(ssims(:,nnn)));
end
for iii=nstart+1:nstart+nimgs
for jjj=1:nrain
% fprintf('img=%d,kernel=%d\n',iii,jjj);
x_true=im2double(imread(fullfile(gt_path,sprintf('norain-%03d.png',iii))));%x_true
x_true = rgb2ycbcr(x_true);
x_true = x_true(:,:,1);
x = (im2double(imread(fullfile(JORDER_path,sprintf('Derained-Rain100L-rain-%03d.png',iii)))));
x = rgb2ycbcr(x);x = x(:,:,1);
tp = mean(psnr(x,x_true));
ts = ssim(x*255,x_true*255);
jorder_psnr(iii-nstart,jjj)=tp;jorder_ssim(iii-nstart,jjj)=ts;
% fprintf('pku: img=%d: psnr=%6.4f, ssim=%6.4f\n',iii,tp,ts);
end
end
fprintf('JORDER: psnr=%6.4f, ssim=%6.4f\n',mean(jorder_psnr(:)),mean(jorder_ssim(:)));