-
Notifications
You must be signed in to change notification settings - Fork 45
/
demo_dataset_correlation.m
executable file
·96 lines (71 loc) · 2.58 KB
/
demo_dataset_correlation.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
% -------------------------------------------------------------------------
% Description:
% Demo script to show the scatter plot of BT scores between datasets
% This script reproduces the results of Figure 6 in our paper.
%
% Citation:
% A Comparative Study for Single Image Blind Deblurring
% Wei-Sheng Lai, Jia-Bin Huang, Zhe Hu, Narendra Ahuja, and Ming-Hsuan Yang
% IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016
%
% Contact:
% Wei-Sheng Lai
% wlai24@ucmerced.edu
% University of California, Merced
% -------------------------------------------------------------------------
%% input datasets
x_dataset = 'uniform'; y_dataset = 'real';
% x_dataset = 'nonuniform'; y_dataset = 'real';
% x_dataset = 'uniform'; y_dataset = 'nonuniform';
%% Load list
list_filename = fullfile('list', 'method.txt');
method = load_list(list_filename);
num_method = length(method);
%% X-dataset
% load votes
vote_filename = fullfile('votes', sprintf('votes_%s_balance_all.csv', x_dataset));
M = csvread(vote_filename, 1, 0); % offset the first row to skip header
% convert M to winning matrix
C = construct_winning_matrix(M, num_method);
% compute BT scores
score = BT_EM_exp(C);
% avoid Nan and Inf when compute mean
s = score;
s = s(s == s); % remove NaN
s = s(s ~= Inf); % remove Inf
% normalize to zero mean
x_score = score - mean(s);
%% Y-dataset
% load votes
vote_filename = fullfile('votes', sprintf('votes_%s_balance_all.csv', y_dataset));
M = csvread(vote_filename, 1, 0); % offset the first row to skip header
% convert M to winning matrix
C = construct_winning_matrix(M, num_method);
% compute BT scores
score = BT_EM_exp(C);
% avoid Nan and Inf when compute mean
s = score;
s = s(s == s); % remove NaN
s = s(s ~= Inf); % remove Inf
% normalize to zero mean
y_score = score - mean(s);
%% plot
[color, marker, line_style] = color_spec;
figure;hold on;
for i = 1:length(method)
plot(x_score(i), y_score(i), marker{i}, 'MarkerFaceColor', color{i}, ...
'MarkerEdgeColor', color{i}*0.5, 'MarkerSize', 15);
end
% legend(method{1}, method{2}, method{3}, method{4}, method{5}, ...
% method{6}, method{7}, method{8}, method{9}, method{10}, ...
% method{11}, method{12}, method{13}, method{14});
t = -2:0.1:2;
plot(t, t, '--k');
xlabel(x_dataset);
ylabel(y_dataset);
h = gca;
h.FontName = 'Times New Roman';
h.FontSize = 24;
hold off;
% saveas(h, output_filename);
% fprintf('Save %s\n', output_filename);