comparison userProgramsASRforDummies/Exp_Tutorial_2.m @ 38:c2204b18f4a2 tip

End nov big change
author Ray Meddis <rmeddis@essex.ac.uk>
date Mon, 28 Nov 2011 13:34:28 +0000
parents
children
comparison
equal deleted inserted replaced
37:771a643d5c29 38:c2204b18f4a2
1 function Exp_Tutorial_2(isMasterNode)
2
3 % This tutorial recycles a HMM
4
5 %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 % Set up the basic experiment parameters
7 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8 expName = 'Tutorial';
9 dataFolderPrefix = 'recycle_featR';
10 if isunix
11 expFolderPrefix = '/scratch/nrclark/exps/';
12 else
13 expFolderPrefix = 'D:\Exps';
14 end
15
16 % expFolderPrefix = pwd;
17 expFolder = fullfile(expFolderPrefix,expName);
18 hmmFolder = fullfile(expFolder,'hmm');
19
20 %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21 % Sort out the training (LEARNING) condition
22 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23 learnFolder = fullfile(expFolder,'featL');
24
25 xL = cJob('L', learnFolder);
26
27 xL.participant = 'Normal';
28 xL.MAPparamChanges= {'DRNLParams.rateToAttenuationFactorProb=0;', 'OMEParams.rateToAttenuationFactorProb=0;' };
29
30 xL.noiseLevToUse = -200;
31 xL.speechLevToUse = 60;
32
33 xL.MAPopHSR = 1;
34 xL.MAPopMSR = 0;
35 xL.MAPopLSR = 0;
36
37
38 xL.numCoeff = 14;
39 xL.removeEnergyStatic = 0;
40
41 %%%%% Group of params that will influence simulation run time %%%%%%%
42 xL.numWavs = 12; %MAX=8440
43 testWavs = 6; %MAX = 358
44 nzLevel = [-200 40:10:70];
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46
47 xL.noisePreDur = 1;
48 xL.noisePostDur = 0.1;
49 xL.truncateDur = xL.noisePreDur-0.1;
50 xL.noiseName = 'pink_demo';
51
52
53 % if isMasterNode && ~isdir(xL.opFolder)
54 % mkdir(xL.opFolder);
55 % xL = xL.assignFiles;
56 % xL.storeSelf;
57 % end
58
59 %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
60 % Sort out the testing (RECOGNITION) conditions
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62 recConditions = numel(nzLevel);
63
64 tmpIdx=0;
65 for nn = 0*recConditions+1:1*recConditions
66 tmpIdx=tmpIdx+1;
67 xR{nn} = xL; %simply copy the "Learn" object and change it a bit below
68 recFolder = fullfile(expFolder,[dataFolderPrefix num2str(nn)]);
69 xR{nn}.opFolder = recFolder;
70
71 %These are the interesting differences between training and testing
72 xR{nn}.numWavs = testWavs; %MAX = 358
73 xR{nn}.noiseLevToUse = nzLevel(tmpIdx);
74 xR{nn}.MAPparamChanges= {'DRNLParams.a=400;'};
75
76
77 %Now just to wrap it up ready for processing
78 if isMasterNode && ~isdir(xR{nn}.opFolder)
79 mkdir(xR{nn}.opFolder);
80 xR{nn} = xR{nn}.assignWavPaths('R');
81 xR{nn} = xR{nn}.assignFiles;
82 xR{nn}.storeSelf;
83 end
84 end
85
86 tmpIdx=0;
87 for nn = 1*recConditions+1:2*recConditions
88 tmpIdx=tmpIdx+1;
89 xR{nn} = xL; %simply copy the "Learn" object and change it a bit below
90 recFolder = fullfile(expFolder,[dataFolderPrefix num2str(nn)]);
91 xR{nn}.opFolder = recFolder;
92
93 %These are the interesting differences between training and testing
94 xR{nn}.numWavs = testWavs; %MAX = 358
95 xR{nn}.noiseLevToUse = nzLevel(tmpIdx);
96 xR{nn}.MAPparamChanges= {'DRNLParams.a=400;'};
97
98 xR{nn}.mainGain = [27.2013; 26.0797; 26.0939; 26.7997; 26.0520];
99 xR{nn}.TCdBO = [37; 37; 37; 37; 37]; %Compression thresholds (in dB OUTPUT from 2nd filt)
100 xR{nn}.TMdBO = [20; 20; 20; 20; 20]; %MOC thresholds (in dB OUTPUT from 2nd filt)
101 xR{nn}.ARthresholddB = 85; % dB SPL (input signal level) =>200 to disable
102 xR{nn}.MOCtau = 1;
103 xR{nn}.useAid = 1;
104
105 %Now just to wrap it up ready for processing
106 if isMasterNode && ~isdir(xR{nn}.opFolder)
107 mkdir(xR{nn}.opFolder);
108 xR{nn} = xR{nn}.assignWavPaths('R');
109 xR{nn} = xR{nn}.assignFiles;
110 xR{nn}.storeSelf;
111 end
112 end
113
114
115
116 %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
117 % ** Generate features **
118 % This is the time consuming, processing intensive portion of the program.
119 % Nodes that are not the master node are only interested in the opFolder
120 % member of the jobjects.
121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
122 % worker(xL.opFolder);
123 maxConds = nn;
124 if ~isMasterNode %dont bother wasting master node effort on generating testing features (for now)
125 for nn = 1:maxConds
126 worker(xR{nn}.opFolder);
127 end
128 end
129
130 %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
131 % Train and test the recogniser - a job for the master node only
132 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
133 if isMasterNode
134 % while(~all(xL.todoStatus==2))
135 % disp('Waiting on straggler nodes to complete their jobs before HMM is trained . . .')
136 % pause(30); %Wait for 30 seconds before looking again
137 % xL.lockJobList;
138 % xL = xL.loadSelf; %Reload incase changed
139 % xL.unlockJobList;
140 % end
141 y = cHMM(hmmFolder);
142 y.numCoeff = 14*3;
143 % y.createSCP(xL.opFolder)
144 % y.createMLF(xL.opFolder)
145 % y.train(xL.opFolder) %This node can be busy training, even if other jobs are being processed for testing
146
147 % ALLOW MASTER NODE TO MUCK IN WITH GENERATING TESTING FEATURES ONCE
148 % HMM HAS BEEN TRAINED
149 for nn = 1:maxConds
150 worker(xR{nn}.opFolder);
151 end
152
153 xR{end}.lockJobList;
154 xR{end} = xR{end}.loadSelf; %Reload changes
155 xR{end}.unlockJobList;
156 while(~all(xR{end}.todoStatus==2))
157 disp('Waiting on straggler nodes to complete their jobs before HMM is tested . . .')
158 pause(30); %Wait for 30 seconds before looking again
159 xR{end}.lockJobList;
160 xR{end} = xR{end}.loadSelf; %Reload incase changed
161 xR{end}.unlockJobList;
162 end
163
164 for nn = 1:maxConds
165 y.createSCP(xR{nn}.opFolder);
166 y.test(xR{nn}.opFolder);
167 end
168
169 %Show all of the scores in the command window at the end
170 for nn = 1:maxConds
171 y.score(xR{nn}.opFolder);
172 end
173 end