To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

The primary repository for this project is hosted at git://github.com/rmeddis/MAP.git .
This repository is a read-only copy which is updated automatically every hour.

Statistics Download as Zip
| Branch: | Revision:

root / userProgramsASRforDummies / Exp_Ray_1.m @ 38:c2204b18f4a2

History | View | Annotate | Download (5.52 KB)

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