Speech Recognizer Mini-Course

From SpeechWiki

Jump to: navigation, search

Mini Course Video

Part of the HTK Lecture video is currently available.

As of 4:21 p.m. 01/13/2006, part 1 of lecture 1 can be obtained at


I will post the rest of the lecture videos during this weekend.


Dynamic Stop Herest

Here's a perl routine that runs HERest until likelihood improvement falls below some threshold:


herest("HERest -T 1 -A -D -S $modelDir/timitPLP.scp -I $modelDir/timitCMUPLP.mlf -t 250.0 150.0 1000.0 $modelDir/CMUphonebet.txt","$modelDir/timitMonophonesHRest.hdf", "$modelDir/timitMonophonesHERest1.hdf", .01);


#assumes $modelDir/tmp dir exists, assumes that $in and $out are files
#run until improvment is less than eps
#1 The HERest command.  It must not have the -H and the -M flags - those are added by herest().
#2 The name of the 'In' MMF-file -what normally goes after the -H flag
#3 The name of the final 'Out' MMF-file -what normally goes after the -M flag
#4 The improvement likelihood (not log-likelihood) threshold 
sub herest{
	(my $cmd, my $in, my $out, my $eps) = @_;
	(my $lastAvgProb, my $nextAvgProb, my $itCounter) = (-1,-1,0);
	#run it once
	my @cmdList = split(/ /, $cmd);
	my $hmmList = pop @cmdList;
	push @cmdList, ("-H", $in, "-M ", "$modelDir/tmp", $hmmList, " | grep '^[^ ].*' | tee $modelDir/herest.log");
	ecsystem(join(' ',@cmdList));
	my $getProbCmd = "cat $modelDir/herest.log  | grep Reestimation | " . 'sed \'s/.*frame = \(.*\)$/\1/\'';
	$nextAvgProb = `$getProbCmd`;

	#run it a few more times
	my $iterCmd = join(' ',@cmdList);
	while ($nextAvgProb-$lastAvgProb > $eps){
		$lastAvgProb = $nextAvgProb;
		$nextAvgProb = `$getProbCmd`;
	print "   herest iterated $itCounter times, eps = ".($nextAvgProb-$lastAvgProb)."\n";
	ecsystem("mv -v $modelDir/tmp/* $out");

See also

Personal tools