-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGMM_baseline.m
116 lines (61 loc) · 3.04 KB
/
GMM_baseline.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
%Name - Umang Patel (ujp2001)
% This is a function that calculates the GMM baseline.
%Input - Cell structure contianing audio features
%Output - GMM baeline scores
%load('features.mat');
num_gauss=16; % <------- One can change the number og Gaussians Here
trainingindex=80; %<---- Vary the proportion to be extracted from each folder
endindex=100;
difference=endindex-trainingindex;
garraym=cell(difference,1,1);
garrayf=cell(difference,1,1);
mcounter=0;
fcounter=0;
for i=1:length(totalfeat)
i
temp= totalfeat{i,2};
if(i==1)
for j=(trainingindex+1):endindex
option=statset('MaxIter',500,'Display','iter') ;
gi=gmdistribution.fit(temp{j,2},num_gauss,'Start',struct('mu',g_ubm.mu,'Sigma',g_ubm.Sigma,'PComponents',g_ubm.PComponents),'CovType','diagonal','Regularize',0.1,'OPTIONS',option);
garraym{mod(j,trainingindex)}=gi;
end
end
if(i==4)
for j=(trainingindex+1):endindex
option=statset('MaxIter',500,'Display','iter');
gi=gmdistribution.fit(temp{j,2},num_gauss,'Start',struct('mu',g_ubm.mu,'Sigma',g_ubm.Sigma,'PComponents',g_ubm.PComponents),'CovType','diagonal','Regularize',0.1,'OPTIONS',option);
garrayf{mod(j,trainingindex)}=gi;
end
end
if(i==2 || i==3)
for j=(trainingindex+1):endindex
postarray=[];
for gg=1:length(garraym)
[post,NLOGL]=posterior(garraym{gg},temp{j,2});
postarray=[postarray, NLOGL];
end
[max1,maxindex]=min(postarray);
%j
%maxindex
if (maxindex==mod(j,trainingindex))
mcounter=mcounter+1;
end
end
end
if(i==5 || i==6)
for j=(trainingindex+1):endindex
postarray=[];
for gg=1:length(garrayf)
[post,NLOGL]=posterior(garrayf{gg},temp{j,2});
postarray=[postarray, NLOGL];
end
[max1,maxindex]=min(postarray);
if (maxindex==mod(j,trainingindex))
fcounter=fcounter+1;
end
end
end
end
fprintf('\n Male speaker GMM accuracy %d \n',(mcounter/(2*difference))*100);
fprintf('\n Female speaker GMM accuracy %d \n',(fcounter/(2*difference))*100);