| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
package Nightly_test; |
|---|
| 25 |
use strict; |
|---|
| 26 |
use File::Spec; |
|---|
| 27 |
use POSIX qw(strftime); |
|---|
| 28 |
|
|---|
| 29 |
my %parms; |
|---|
| 30 |
$parms{"debug"} = 1; |
|---|
| 31 |
$parms{"VoxForgeHome"} = "/home/kmaclean/workspace/VoxForge"; |
|---|
| 32 |
|
|---|
| 33 |
$parms{"AudioDirectory"} = $parms{"VoxForgeHome"}."/Audio"; |
|---|
| 34 |
$parms{"LexiconDirectory"} = $parms{"VoxForgeHome"}."/Lexicon"; |
|---|
| 35 |
$parms{"QSdir"} = $parms{"VoxForgeHome"}."/QuickStart"; |
|---|
| 36 |
$parms{"ScriptsDirectory"} = $parms{"VoxForgeHome"}."/Scripts"; |
|---|
| 37 |
$parms{"AudioScripts_dir"} = $parms{"ScriptsDirectory"}."/Audio_scripts"; |
|---|
| 38 |
$parms{"Repository_dir"} = $parms{"AudioScripts_dir"}."/Repository"; |
|---|
| 39 |
$parms{"UserSubmission_dir"} = $parms{"AudioScripts_dir"}."/UserSubmission"; |
|---|
| 40 |
$parms{"HTK_dir"} = $parms{"ScriptsDirectory"}."/HTK/AMCreate_scripts"; |
|---|
| 41 |
$parms{"MirroringScripts_dir"} = $parms{"ScriptsDirectory"}."/Mirroring_scripts"; |
|---|
| 42 |
$parms{"Testing_scripts_dir"} = $parms{"ScriptsDirectory"}."/Testing_scripts"; |
|---|
| 43 |
my $year = strftime "%Y", localtime; |
|---|
| 44 |
my $mon = strftime "%m", localtime; |
|---|
| 45 |
my $mday = strftime "%d", localtime; |
|---|
| 46 |
|
|---|
| 47 |
$parms{"mirror_dir"} = "/data/svn-mirror-copy"; |
|---|
| 48 |
$parms{"Nightly_dir"} = $parms{"mirror_dir"} . "/Nightly_Builds"; |
|---|
| 49 |
$parms{"Nightly_dirname"} = $parms{"Nightly_dir"}."/AcousticModel-$year-$mon-$mday"; |
|---|
| 50 |
$parms{"16kHz_16bit_NightlyAM"} = $parms{"Nightly_dirname"}."/HTK/16kHz_16bit/MFCC_O_D"; |
|---|
| 51 |
$parms{"8kHz_16bit_NightlyAM"} = $parms{"Nightly_dirname"}."/HTK/8kHz_16bit/MFCC_O_D"; |
|---|
| 52 |
$parms{"Tags"} = $parms{"mirror_dir"} . "/Tags"; |
|---|
| 53 |
$parms{"Releases"} = $parms{"Tags"}."/Releases"; |
|---|
| 54 |
$parms{"CurrentBuild_dir"} = $parms{"Releases"}."/0_1_1-build726"; |
|---|
| 55 |
$parms{"16kHz_16bit_CurrentAM"} = $parms{"CurrentBuild_dir"}."/AcousticModels/HTK/16kHz-16bit/MFCC_O_D"; |
|---|
| 56 |
$parms{"8kHz_16bit_CurrentAM"} = $parms{"CurrentBuild_dir"}."/AcousticModels/HTK/8kHz-16bit/MFCC_O_D"; |
|---|
| 57 |
$parms{"HTKBin"} = "/usr/local/HTK"; |
|---|
| 58 |
|
|---|
| 59 |
my $command; |
|---|
| 60 |
|
|---|
| 61 |
my $debug = 0; |
|---|
| 62 |
my $HTKbin = $parms{"HTKBin"}; |
|---|
| 63 |
|
|---|
| 64 |
my $Testing_scripts_dir = $parms{"Testing_scripts_dir"}; |
|---|
| 65 |
my $LexiconDirectory = $parms{"LexiconDirectory"} ; |
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
$command = ("perl $HTKbin/prompts2mlf testref.mlf testprompts"); print "$command\n" if $debug; system($command); |
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
open(OUTPUT, ">TestResults") or die ("cannot write to TestResults file"); |
|---|
| 79 |
print OUTPUT "Disclaimer: this is a *sanity test* only, and is *not* to be regarded as a valid test of the VoxForge Acoustic Models! |
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
; |
|---|
| 86 |
processNightly(); |
|---|
| 87 |
processCurrent(); |
|---|
| 88 |
close(OUTPUT); |
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
sub processNightly { |
|---|
| 99 |
my $Nightly_dirname = $parms{"Nightly_dirname"}; |
|---|
| 100 |
print OUTPUT "Testing Acoustic Models created in: $Nightly_dirname\n\n"; |
|---|
| 101 |
HTK_16kHz_16bit($parms{"16kHz_16bit_NightlyAM"}); |
|---|
| 102 |
Julian_16kHz_16bit($parms{"16kHz_16bit_NightlyAM"}); |
|---|
| 103 |
HTK_8kHz_16bit($parms{"8kHz_16bit_NightlyAM"}); |
|---|
| 104 |
Julian_8kHz_16bit($parms{"8kHz_16bit_NightlyAM"}); |
|---|
| 105 |
PrintNotes(); |
|---|
| 106 |
} |
|---|
| 107 |
|
|---|
| 108 |
sub processCurrent { |
|---|
| 109 |
my $CurrentBuild_dir = $parms{"CurrentBuild_dir"}; |
|---|
| 110 |
print OUTPUT "\n\n\n================================================================================================================\n"; |
|---|
| 111 |
print OUTPUT "For comparison purposes, see below for the same Tests on the most current release of the VoxForge Acoustic Models: |
|---|
| 112 |
($CurrentBuild_dir)\n"; |
|---|
| 113 |
print OUTPUT "================================================================================================================\n"; |
|---|
| 114 |
HTK_16kHz_16bit($parms{"16kHz_16bit_CurrentAM"}); |
|---|
| 115 |
Julian_16kHz_16bit($parms{"16kHz_16bit_CurrentAM"}); |
|---|
| 116 |
HTK_8kHz_16bit($parms{"8kHz_16bit_CurrentAM"}); |
|---|
| 117 |
Julian_8kHz_16bit($parms{"8kHz_16bit_CurrentAM"}); |
|---|
| 118 |
PrintNotes(); |
|---|
| 119 |
} |
|---|
| 120 |
|
|---|
| 121 |
sub HTK_16kHz_16bit { |
|---|
| 122 |
my ($AM_Dir) = @_; |
|---|
| 123 |
my $wordinspen = "0.0"; |
|---|
| 124 |
my $gramscfact = "1.0"; |
|---|
| 125 |
system("rm -f recout.mlf"); |
|---|
| 126 |
$command = ("$HTKbin/HVite -A -D -T 1 -H $AM_Dir/macros -H $AM_Dir/hmmdefs -C $Testing_scripts_dir/wav_config -S $Testing_scripts_dir/wavlst16kHz_16bit -l '*' -i recout.mlf -w $Testing_scripts_dir/wdnet -p $wordinspen -s $gramscfact $LexiconDirectory/VoxForge/VoxForgeDict $AM_Dir/tiedlist 1>/dev/null 2>/dev/null"); system($command); |
|---|
| 127 |
my $HTK_TestResults = `$HTKbin/HResults -I testref.mlf $AM_Dir/tiedlist recout.mlf`; |
|---|
| 128 |
$HTK_TestResults =~ s/ HTK//; |
|---|
| 129 |
print OUTPUT ("HTK 16kHz_16bit\n"); |
|---|
| 130 |
print OUTPUT ("---------------\n"); |
|---|
| 131 |
print OUTPUT ("\tword insertion penalty: $wordinspen\n"); |
|---|
| 132 |
print OUTPUT ("\tgrammar scale factor: $gramscfact\n"); |
|---|
| 133 |
print OUTPUT "$HTK_TestResults\n"; |
|---|
| 134 |
} |
|---|
| 135 |
|
|---|
| 136 |
sub Julian_16kHz_16bit { |
|---|
| 137 |
my ($AM_Dir) = @_; |
|---|
| 138 |
my $penalty1="0.5"; |
|---|
| 139 |
my $penalty2="100.0"; |
|---|
| 140 |
my $iwsppenalty = "-55.0"; |
|---|
| 141 |
system("rm -f julianProcessed"); |
|---|
| 142 |
$command = ("julian -penalty1 $penalty1 -penalty2 $penalty2 -iwsppenalty $iwsppenalty -input rawfile -filelist wavlst16kHz_16bit -h $AM_Dir/hmmdefs -hlist $AM_Dir/tiedlist -smpFreq 16000 -C julian.jconf > julianOutput 2>/dev/null"); print "$command\n" if $debug; system($command) ; |
|---|
| 143 |
$command = ("perl ./ProcessJulianOutput.pl julianOutput julianProcessed"); print "$command\n" if $debug; system($command) ; |
|---|
| 144 |
my $Julian_TestResults = `$HTKbin/HResults -I testref.mlf $AM_Dir/tiedlist julianProcessed` ; |
|---|
| 145 |
$Julian_TestResults =~ s/ HTK//; |
|---|
| 146 |
print OUTPUT ("Julian 16kHz_16bit\n"); |
|---|
| 147 |
print OUTPUT ("------------------\n"); |
|---|
| 148 |
print OUTPUT ("\tword insertion penalty\n"); |
|---|
| 149 |
print OUTPUT ("\t first pass (-penalty1):$penalty1\n"); |
|---|
| 150 |
print OUTPUT ("\t second pass (-penalty2):$penalty2\n"); |
|---|
| 151 |
print OUTPUT ("\ttransition penalty:$iwsppenalty (for short-term inter-word pauses between words (-iwsppenalty))\n"); |
|---|
| 152 |
print OUTPUT "$Julian_TestResults\n"; |
|---|
| 153 |
} |
|---|
| 154 |
|
|---|
| 155 |
sub HTK_8kHz_16bit { |
|---|
| 156 |
my ($AM_Dir) = @_; |
|---|
| 157 |
my $wordinspen = "10.0"; |
|---|
| 158 |
my $gramscfact = "5.0"; |
|---|
| 159 |
system("rm -f recout.mlf"); |
|---|
| 160 |
$command = ("$HTKbin/HVite -A -D -T 1 -H $AM_Dir/macros -H $AM_Dir/hmmdefs -C $Testing_scripts_dir/wav_config -S $Testing_scripts_dir/wavlst8kHz_16bit -l '*' -i recout.mlf -w $Testing_scripts_dir/wdnet -p $wordinspen -s $gramscfact $LexiconDirectory/VoxForge/VoxForgeDict $AM_Dir/tiedlist 1>/dev/null 2>/dev/null"); system($command); |
|---|
| 161 |
my $HTK_TestResults = `$HTKbin/HResults -I testref.mlf $AM_Dir/tiedlist recout.mlf`; |
|---|
| 162 |
$HTK_TestResults =~ s/ HTK//; |
|---|
| 163 |
print OUTPUT ("HTK 8kHz_16bit\n"); |
|---|
| 164 |
print OUTPUT ("---------------\n"); |
|---|
| 165 |
print OUTPUT ("\tword insertion penalty: $wordinspen\n"); |
|---|
| 166 |
print OUTPUT ("\tgrammar scale factor: $gramscfact\n"); |
|---|
| 167 |
print OUTPUT "$HTK_TestResults\n"; |
|---|
| 168 |
} |
|---|
| 169 |
|
|---|
| 170 |
sub Julian_8kHz_16bit { |
|---|
| 171 |
my ($AM_Dir) = @_; |
|---|
| 172 |
my $penalty1="50.0"; |
|---|
| 173 |
my $penalty2="100.0"; |
|---|
| 174 |
my $iwsppenalty = "-55.0"; |
|---|
| 175 |
system("rm -f julianProcessed"); |
|---|
| 176 |
$command = ("julian -penalty1 $penalty1 -penalty2 $penalty2 -iwsppenalty $iwsppenalty -input rawfile -filelist wavlst8kHz_16bit -h $AM_Dir/hmmdefs -hlist $AM_Dir/tiedlist -smpFreq 8000 -C julian.jconf > julianOutput 2>/dev/null"); print "$command\n" if $debug; system($command) ; |
|---|
| 177 |
$command = ("perl ./ProcessJulianOutput.pl julianOutput julianProcessed"); print "$command\n" if $debug; system($command) ; |
|---|
| 178 |
my $Julian_TestResults = `$HTKbin/HResults -I testref.mlf $AM_Dir/tiedlist julianProcessed` ; |
|---|
| 179 |
$Julian_TestResults =~ s/ HTK//; |
|---|
| 180 |
print OUTPUT ("Julian 8kHz_16bit\n"); |
|---|
| 181 |
print OUTPUT ("------------------\n"); |
|---|
| 182 |
print OUTPUT ("\tword insertion penalty\n"); |
|---|
| 183 |
print OUTPUT ("\t first pass (-penalty1):$penalty1\n"); |
|---|
| 184 |
print OUTPUT ("\t second pass (-penalty2):$penalty2\n"); |
|---|
| 185 |
print OUTPUT ("\ttransition penalty::$iwsppenalty (for short-term inter-word pauses between words (-iwsppenalty))\n"); |
|---|
| 186 |
print OUTPUT "$Julian_TestResults\n"; |
|---|
| 187 |
} |
|---|
| 188 |
|
|---|
| 189 |
sub PrintNotes { |
|---|
| 190 |
print OUTPUT "Notes: |
|---|
| 191 |
|
|---|
| 192 |
* the line starting with SENT gives the percentage of sentences that were recognized correctly, out of N sentences in total. |
|---|
| 193 |
* the line starting with WORD gives the percentage of words that were recognized correctly, out of N words in total |
|---|
| 194 |
However, since HTK or Julius erroneously 'added' words that are not in the audio file (i.e. insertion errors) they usually get a lower percentage accuracy rating. |
|---|
| 195 |
* Count definitions: |
|---|
| 196 |
o D - Deletion Error |
|---|
| 197 |
o S - Substitution Error |
|---|
| 198 |
o I - Insertion Error\n"; |
|---|
| 199 |
} |
|---|
| 200 |
|
|---|
| 201 |
1; |
|---|