-
Notifications
You must be signed in to change notification settings - Fork 22
/
testscript.asv
84 lines (76 loc) · 1.85 KB
/
testscript.asv
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
function [ ] = testscript
load('test_local.mat');
color_feat={'colorhistrgb32',...
'colorhistrgb64',...
'colorhistrgb128',...
'colorhistrgb256',...
'colorhisthsv32',...
'colorhisthsv64',...
'colorhisthsv128',...
'colorhisthsv256',...
'csd32',...
'csd64',...
'csd128',...
'csd256',''};
texture_feat= {'','EHD','HTD','wave','tamura'};
clusters={test.cluster};
for i=1:numel(clusters)
temp_ind=find(strcmp(clusters,clusters{i}));
temp_ind(temp_ind==i)=[];
relevance{i}=temp_ind;
end
k=1;
for ii=1:numel(color_feat)
for jj=1:numel(texture_feat)
option=[color_feat{ii} texture_feat{jj} '_local'];
if ~isempty(option)
options{k}=option;
k=k+1;
end
end
end
for i=1:numel(options)
evalc(['data=cell2mat({test.' options{i} '}'')']);
Dist=squareform(pdist(data,'euclidean'));
[v,ind]=sort(Dist,2);
[precision{i},recall{i},F{i}]= compute_f(ind,relevance);
disp('Computing F-measure for
% h=figure('Visible','off');
% for k=1:10
% for id1=1:10
% for id2=1:10
% subplot(10,10,(id1-1)*10+id2);imshow(imread(test(ind(id1+(k-1)*10,id2)).filename));title(num2str(v(id1+(k-1)*10,id2)),'fontsize',5);
% end
% end
% print(h,['Results_' options{i} filesep num2str(k) '.jpg'],'-djpeg');
% k
% end
end
figure(10);
cc=hsv(4);
for i=1:4
hold on;
h=plot([1:40],F{i},'color',cc(i,:));
legend(h,num2str(i),'location','southeast');
end
title('F-measure ');
hold off;
figure(20);
cc=hsv(4);
for i=1:4
hold on;
h=plot([1:40],precision{i},'color',cc(i,:));
legend(h,num2str(i),'location','southeast');
end
title('Precision');
hold off;
figure(30);
cc=hsv(4);
for i=1:4
hold on;
h=plot([1:40],recall{i},'color',cc(i,:));
legend(h,num2str(i),'location','southeast');
end
title('Recall');
hold off;
end