Windows下HTK3.4.1的安装配置详解

1、下载HTK源码并解压。传送门:http://htk.eng.cam.ac.uk/download.shtml(HTK source code )

ps:后面的2、4、5三步可以参阅htk\README文件

2、HTK的编译需要Microsoft Visual Studio,确保本机装有VS并且环境变量path里面包含vcvars32.bat的路径。(例如我的路径是D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin)

  测试添加成功方法:cmd
  >vcvars32
  显示:Setting environment for using Microsoft Visual Studio 2010 x86 tools.

  tip:如果你的环境变量里面添加的是类似D:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools的路径,用vsvars32命令也行。

3、修改HTKLib\htkHTKLibhtk_htklib_nt.mkf,将HGraf.null.obj改为HGraf_WIN32.obj、HGraf.null.olv改为HGraf_WIN32.olv。

  ps:为什么要修改?如果不修改此处,以后在Windows中调用HTK中的HSLab命令时会出错,显示:

  ERROR [+6870]  MakeXGraf: Not compiled with X11 support: use HGraf.X.c
 FATAL ERROR - Terminating program HSLab

  修正这个错误只需要修改上述两个地方即可。有的文章说还要删除HTKTools\Makefile.in中的“-lX11” ,我没有删除也可修正。

4、编译HTK。(你可以参阅README文件,或者其他前辈写的教程,或者使用我写的批处理)

View Code
@echo off
cls
title HTK Installation
color 0A
set /p choice= 是否开始编译HTK?[y^|n]: 
if /i "%choice%"=="y" goto install
:end
echo 按任意键结束... & pause > nul 
exit

:install
mkdir bin.win32
call VCVARS32 bin.win32
call cd HTKLib
call nmake /f htk_htklib_nt.mkf all
call cd..
call cd HTKTools
call nmake /f htk_htktools_nt.mkf all
call cd..
call cd HLMLib
call nmake /f htk_hlmlib_nt.mkf all
call cd..
call cd HLMTools
call nmake /f htk_hlmtools_nt.mkf all
call cd..
echo.
goto end

  在htk目录内新建文件,命名为install.bat,将上述代码粘贴进去,保存,双击运行即可。
  该步骤会生成文件夹htk\bin.win32,并且将编译好的文件放在其内,这些.exe就是htk命令了。文件夹内应该包含如下文件:Cluster.exe HBuild.exe HCompV.exe HCopy.exe HDMan.exe HERest.exe HHEd.exe HInit.exe HLEd.exe HList.exe HLMCopy.exe HLRescore.exe HLStats.exe HMMIRest.exe HParse.exe HQuant.exe HRest.exe HResults.exe HSGen.exe HSLab.exe HSmooth.exe HVite.exe LAdapt.exe LBuild.exe LFoF.exe LGCopy.exe LGList.exe LGPrep.exe LLink.exe LMerge.exe LNewMap.exe LNorm.exe LPlex.exe LSubset.exe

5、设置HTK环境变量。将刚才新生成的目录bin.win32添加到环境变量path内即可。(例如我的是:D:\program\htk\bin.win32)

  测试添加成功方法:cmd
  >HInit
  显示:

USAGE: HInit [options] hmmFile trainFiles...

 Option                                       Default

 -e f    Set convergence factor epsilon       1.0E-4
 -i N    Set max iterations to N              20
 -l s    Set segment label to s               none
 -m N    Set min segments needed              3
 -n      Update hmm (suppress uniform seg)    off
 -o fn   Store new hmm def in fn (name only)  outDir/srcfn
 -u mvwt Update m)eans v)ars w)ghts t)rans    mvwt
 -v f    Set minimum variance to f            1.0E-2
 -w f    set mix wt/disc prob floor to f      0.0
 -A      Print command line arguments         off
 -B      Save HMMs/transforms as binary       off
 -C cf   Set config file to cf                default
 -D      Display configuration variables      off
 -F fmt  Set source data format to fmt        as config
 -G fmt  Set source label format to fmt       as config
 -H mmf  Load HMM macro file mmf
 -I mlf  Load master label file mlf
 -L dir  Set input label (or net) dir         current
 -M dir  Dir to write HMM macro files         current
 -S f    Set script file to f                 none
 -T N    Set trace flags to N                 0
 -V      Print version information            off
 -X ext  Set input label (or net) file ext    lab

 

posted @ 2012-05-04 17:00  FreedomShe  阅读(4190)  评论(2编辑  收藏  举报