-
Notifications
You must be signed in to change notification settings - Fork 0
/
recallAndPrecision30.m
67 lines (63 loc) · 1.6 KB
/
recallAndPrecision30.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
%Precision _Recall _ for _images
load('C:\Users\JAI\Desktop\c.mat');
matrix30=zeros(2800,5);
% 4th and 5th col for precision and recall
path='E:\molu\database\';
m=1;
for folder_number=1:112
for image_num=1:25
matrix30(m,1)=folder_number;
matrix30(m,2)=image_num;
m=m+1;
end
end
for i=1:2800
category_number=c{i,1};
Fq=c{i,3};
%This loop is to calculate dissimailarity measure for images before the
%query image
if i~=1
n=i-1;
for g=1:n
Fdb=c{g,3};
k1=0;
for i1=1:768
temp=abs(Fdb(i1)-Fq(i1));
temp1=temp/(1+Fq(i1)+Fdb(i1));
k1=k1+temp1;
end
%saving the Fdb value in the matrix's 3rd column
matrix30(g,3)=k1;
end
end
%This loop is to calculate dissimailarity measure for images after the
%query image
if i~=2800
m=i+1;
for j=m:2800
Fdb=c{j,3};
k1=0;
for i1=1:768
temp=abs(Fdb(i1)-Fq(i1));
temp1=temp/(1+Fq(i1)+Fdb(i1));
k1=k1+temp1;
end
%saving the Fdb value in the matrix's 3rd column
matrix30(j,3)=k1;
end
end
% now sort the matrix on the basis of dissimilarity
m1=sortrows(matrix30,3);
% retrieving the top 10
relevant_retrieved=0;
for j1=1:30
if m1(j1,1)==category_number;
relevant_retrieved=relevant_retrieved+1;
end
end
Precision=relevant_retrieved/30;
Recall=relevant_retrieved/25;
matrix30(i,4)=Precision;
matrix30(i,5)=Recall;
end
%final output is matrix