In the first step in HMM training we define a prototype model. The parameters of this model are not important, its purpose is to define the model topology.
Create a file called 'proto' in your working directory which is as follows
~o Vecsize 39 MFCC_0_D_A
~h "proto"
BeginHMM
Numstates 5
State 2
Mean 39
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Variance 39
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
State 3
Mean 39
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Variance 39
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
State 4
Mean 39
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Variance 39
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
TransP 5
0.0 1.0 0.0 0.0 0.0
0.0 0.6 0.4 0.0 0.0
0.0 0.0 0.6 0.4 0.0
0.0 0.0 0.0 0.7 0.3
0.0 0.0 0.0 0.0 0.0
EndHMM
(some tags are not visible. add "<> " tag wherever any word is written)
Now, Create a file called 'config' in your working directory with the following containts
# Coding parameters
TARGETKIND = MFCC_0_D_A
TARGETRATE = 100000.0
SAVECOMPRESSED = T
SAVEWITHCRC = T
WINDOWSIZE = 250000.0
USEHAMMING = T
PREEMCOEF = 0.97
NUMCHANS = 26
CEPLIFTER = 22
NUMCEPS = 12
ENORMALISE = F
(note that this configuration is different from wav_config)
We need to locate all our feature vector files with a script file called train.scp.
mfcc/S0001.mfc
mfcc/S0004.mfc
mfcc/S0005.mfc
mfcc/S0008.mfc
The next step is to create a new folder call hmm0. Then create a new version of proto in the hmm0
folder - using the HTK HCompV tool as follows:
HCompV -A -D -T 1 -C config -f 0.01 -m -S train.scp -M hmm0 proto
This creates two files in the hmm0 folder:
proto
vFloors
Flat Start Monophones
Create hmmdefs
1. Create a new file called hmmdefs in your hmm0 folder:
o Copy the monophones0 file to your hmm0 folder;
o rename the monophones0 file to hmmdefs
2. For each phone in hmmdefs:
put the phone in double quotes;
add '~h ' before the phone (note the space after the '~h'); and
copy from line 5 onwards (i.e. starting from "
and paste it after each phone.
Leave one blank line at the end of your file. This creates the hmmdefs file, which contains "flat start"
monophones.
Create macros File
The final step in this section is to create the macros file. A new file called macros should be created
and stored in hmm0 folder:
create a new file called macros in hmm0;
copy vFloors to macros
copy the first 3 lines of proto (from ~o to
Re-estimate Monophones
Next, create 9 new folders named consecutively in your working folder: hmm1 to hmm9. The Flat Start Monophones are re-estimated using the HERest tool.
The purpose of this is to load all the models in the hmm0 folder (these are contained in the hmmdefs file), and re-estimate them using the MFCC files listed in the train.scp script, and create a new model set in hmm1.
Execute the HERest command from your working directory:
cmd> HERest -C config -I phones0.mlf -t 250.0 150.0 1000.0 -S train.scp -H
hmm0/macros -H hmm0/hmmdefs -M hmm1 monophones0
This process is repeated 2 more times, creating new model sets in hmm2 and hmm3
cmd> HERest -C config -I phones0.mlf -t 250.0 150.0 1000.0 -S train.scp -H
hmm1/macros -H hmm1/hmmdefs -M hmm2 monophones0
cmd> HERest -C config -I phones0.mlf -t 250.0 150.0 1000.0 -S train.scp -H
hmm2/macros -H hmm2/hmmdefs -M hmm3 monophones0
No comments:
Post a Comment