Kaldi语音识别库linux环境下的安装和编译
Kaldi语音识别库可以说是,HTK数据库的整理加强版,将HTK比较零碎的各种各样的指令和功能进行整理,使用更加的方便,同时也加入了深度神经网络的分类器(DNN),本身由原来做HTK开发的人员制作而成。
kaldi官方网站请见:http://kaldi.sourceforge.net/index.html
安装以及编译:
第一步:下载kaldi工具包
kaldi 有两个版本,kaldi-1和kaldi—trunk,前者是稳定版,后者是新版。我安装的是新版。
下面开始安装:
1 |
sudo apt-get install subversion |
2 |
svn update |
3 |
svn co https://kaldi.svn.sourceforge.net/svnroot/kaldi/trunk kaldi-trunk |
4 |
cd kaldi-trunk |
5 |
cd tools |
6 |
cat INSTALL |
7 |
make -j 4 |
注:
1.当电脑有不止一个cpu时,假设有四个,可以输入:make -j 4 以节省时间。
2.make指令是为了安装8个软件,其中,(sph2pipe, openfst, ATLAS)这3个是必须的。
第二步:配置
1 |
cd ../src |
2 |
./configure |
注:通常这个时候会报错,那是因为没有安装openfst或者ATLAS。
安装openfst:
1.安装g++
1 |
sudo apt-get install g++ |
2.解压
1 |
tar -xovzf openfst-1.3.2.tar.gz |
2 |
for dir in openfst-1.3.2/{src/,}include/fst; do |
3 |
( [ -d $dir ] && cd $dir && patch -p0 -N <../../../../openfst.patch ) |
4 |
done |
5 |
rm openfst 2>/dev/null # Remove any existing link |
6 |
ln -s openfst-1.3.2 openfst |
7 |
cd openfst-1.3.2 |
以下选择正确的配置指令:
若是linux或darwin,
1 |
./configure --prefix=`pwd` --enable-static --disable-shared |
若是64位系统,
1 |
./configure --host=x86_64-linux --prefix=`pwd` --enable-static --disable-shared |
若是虚拟机,
1 |
./configure --prefix=`pwd` CXX=g++-4.exe CC=gcc-4.exe --enable-static --disable-shared |
3.安装
1 |
sudo make install |
安装ATLAS:
注:安装ATLAS前,要保证关掉cpu throttling。绝大部分操作系统默认开启power management中的cpu throttling以保护cpu。绝大部分电脑可以在BIOS中关掉cpu throttling(通常在power management中或cpu frequency 选项中。)绝大部分操作系统也能关掉cpu throttling,在fedora中,输入/usr/bin/cpufreq-selector -g performance可以关掉cpu throttling。本机器是ubuntu 12.04 cpu frequency scaling governor的路径是(/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)。此处建议使用:https://wiki.archlinux.org/index.php/CPU_Frequency_Scaling_(简体中文)中的修改软件,修改后是临时的,重启之后恢复默认设置,这样不会对基础设置造成影响。
具体操作:
1 |
sudo apt-get install cpufrequtils |
2 |
sudo cpufreq-set -c 1 -g performance |
3 |
sudo cpufreq-set -c 2 -g performance |
4 |
sudo cpufreq-set -c 3 -g performance |
5 |
sudo cpufreq-set -c 4 -g performance |
6 |
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor |
7 |
cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor |
8 |
cat /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor |
9 |
cat /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor |
查看里面的选项ondemand是否均改为performance。
除了更改cpu throttling,还要安装gfortran,否则会出错:
1 |
sudo apt-get install gfortran |
最后,在tools目录下输入:
1 |
./install_atlas.sh |
完成ATLAS的安装。
第三步:配置安装:
1 |
../src |
2 |
./configure |
3 |
make depend |
4 |
make -j 4 |
更多推荐



所有评论(0)