Kaldi是基于C++开发并遵守Apache License v2.0的一款语音识别工具包,是目前最流行的ASR工具之一,本文基于Ubuntu 18.04 LTS介绍了如何安装Kaldi。

首先按照官网提示,将Kaldi项目克隆至本地:

~$ git clone https://github.com/kaldi-asr/kaldi.git kaldi-trunk --origin golden

进入kaldi-trunk:

~$ cd kaldi-trunk
~/kaldi-trunk$

查看INSTALL:

~/kaldi-trunk$ cat INSTALL
This is the official Kaldi INSTALL. Look also at INSTALL.md for the git mirror installation.
[for native Windows install, see windows/INSTALL] (1)
go to tools/ and follow INSTALL instructions there. (2)
go to src/ and follow INSTALL instructions there.

所以先进入tools目录按提示安装,再进入src目录按提示安装。

进入tools目录查看INSTALL:

~/kaldi-trunk$ cd tools
~/kaldi-trunk/tools$ cat INSTALL
To check the prerequisites for Kaldi, first run extras/check_dependencies.sh and see if there are any system-level installations you need to do. Check the
output carefully. There are some things that will make your life a lot easier
if you fix them at this stage. If your system default C++ compiler is not
supported, you can do the check with another compiler by setting the CXX
environment variable, e.g. CXX=g++-4.8 extras/check_dependencies.sh Then run make which by default will install ATLAS headers, OpenFst, SCTK and sph2pipe.
OpenFst requires a relatively recent C++ compiler with C++11 support, e.g.
g++ >= 4.7, Apple clang >= 5.0 or LLVM clang >= 3.3. If your system default
compiler does not have adequate support for C++11, you can specify a C++11
compliant compiler as a command argument, e.g. make CXX=g++-4.8 If you have multiple CPUs and want to speed things up, you can do a parallel
build by supplying the "-j" option to make, e.g. to use 4 CPUs make -j 4 In extras/, there are also various scripts to install extra bits and pieces that
are used by individual example scripts. If an example script needs you to run
one of those scripts, it will tell you what to do.

所以首先需要进入extras目录运行脚本check_dependencies.sh来检查各种依赖是否安装。

进入extras并运行check_dependencies.sh:

~/kaldi-trunk/tools$ cd extras/
~/kaldi-trunk/tools/extras$ ./check_dependencies.sh
./check_dependencies.sh: all OK.

运行check_dependencies.sh后出现任何提示表明某些库未安装,都应按照提示解决,直到运行check_dependencies.sh后出现如上所示”./check_dependencies.sh: all OK.”。

然后进入上一级,进行编译:

~/kaldi-trunk/tools/extras$ cd ..
~/kaldi-trunk/tools$ make

如果是在虚拟机上,建议使用make而非make -j 4,否则很容易内存不够导致编译失败,之后在src目录下的编译也一样。

make完成后可能会提示irstlm未安装,此时不用管,先继续完成整个kaldi的安装再说。

进入src目录并查看INSTALL:

~/kaldi-trunk/tools$ cd ../src
~/kaldi-trunk/src$ cat INSTALL These instructions are valid for UNIX-like systems (these steps have
been run on various Linux distributions; Darwin; Cygwin). For native Windows
compilation, see ../windows/INSTALL. You must first have completed the installation steps in ../tools/INSTALL
(compiling OpenFst; getting ATLAS and CLAPACK headers). The installation instructions are ./configure --shared
make depend -j 8
make -j 8 Note that we added the "-j 8" to run in parallel because "make" takes a long
time. 8 jobs might be too many for a laptop or small desktop machine with not
many cores. For more information, see documentation at http://kaldi-asr.org/doc/
and click on "The build process (how Kaldi is compiled)".

运行configure且不要添加参数”– –shared”:

~/kaldi-trunk/src$ ./configure
Configuring ...
Backing up kaldi.mk to kaldi.mk.bak ...
Checking compiler g++ ...
Checking OpenFst library in /home/zillyrex/kaldi-trunk/tools/openfst ...
Doing OS specific configurations ...
On Linux: Checking for linear algebra header files ...
Using ATLAS as the linear algebra library.
Atlas found in /usr/lib/x86_64-linux-gnu
Validating presence of ATLAS libs in /usr/lib/x86_64-linux-gnu
Using library /usr/lib/x86_64-linux-gnu/liblapack.so as ATLAS's CLAPACK library.
CUDA will not be used! If you have already installed cuda drivers
and cuda toolkit, try using --cudatk-dir=... option. Note: this is
only relevant for neural net experiments
Info: configuring Kaldi not to link with Speex (don't worry, it's only needed if you
intend to use 'compress-uncompress-speex', which is very unlikely)
Successfully configured for Linux [dynamic libraries] with ATLASLIBS =/usr/lib/x86_64-linux-gnu/liblapack.so /usr/lib/x86_64-linux-gnu/libcblas.so /usr/lib/x86_64-linux-gnu/libatlas.so /usr/lib/x86_64-linux-gnu/libf77blas.so
SUCCESS
To compile: make clean -j; make depend -j; make -j
... or e.g. -j 10, instead of -j, to use a specified number of CPUs

务必仔细阅读运行configure后显示的提示,它可能和上文所示的内容有所区别,其中提醒了你有哪些东西没安装好,并给出了指导,遵循那些执导完成相关依赖的安装,直到运行configure后出现如上文所示的提示,提示的最后显示”SUCCESS To compile: ……”,此时才能进行后面的步骤,否则长时间的make后会报错。

执行最后的步骤,编译kaldi的源码:

~/kaldi-trunk/src$ make depend
...
...
~/kaldi-trunk/src$ make
...
...
...
Done

make的时间较长,大约半个小时到一个小时,如果编译过程中未出现红色的error,最后出现”Done”,表明编译成功。

最后运行一个例程来检验安装是否成功,运行egs/yesno/s5目录下的run.sh:

~/kaldi-trunk/src$ cd ../egs/yesno/s5/
~/kaldi-trunk/egs/yesno/s5$ ./run.sh
Preparing train and test data
Dictionary preparation succeeded
utils/prepare_lang.sh --position-dependent-phones false data/local/dict <SIL> data/local/lang data/lang
Checking data/local/dict/silence_phones.txt ...
--> reading data/local/dict/silence_phones.txt
--> text seems to be UTF-8 or ASCII, checking whitespaces
--> text contains only allowed whitespaces
--> data/local/dict/silence_phones.txt is OK
...
...
...
local/score.sh: scoring with word insertion penalty=0.0,0.5,1.0
%WER 0.00 [ 0 / 232, 0 ins, 0 del, 0 sub ] exp/mono0a/decode_test_yesno/wer_10_0.0

出现如上结果,表明kaldi安装成功。

Kaldi安装的更多相关文章

  1. Kaldi 安装

    以后要重点搞caldi了,虽然集群上有,但还是本地安装一下吧. 参考   Kaldi 学习手记(一):Kaldi 的编译安装   在 ubuntu 下安装 kaldi 基本步骤 两个文章基本差不多 1 ...

  2. 虚拟机Ubuntu系统下kaldi安装与编译简介

    kaldi官网:http://www.kaldi-asr.org/doc/index.html 在http://github.com/kaldi-asr/kaldi中直接下载kaldi的zip包,没有 ...

  3. Ubuntu下kaldi安装

    该文章为博主原创,如若转载请注明出处:https://www.cnblogs.com/fengleixue/p/9482202.html 因公司业务需要需使用kaldi语音识别工具,现将kaldi环境 ...

  4. 安装python各类工具包、IDE以及著名开源模块如kaldi等的简单总结

    在学习一门语言或者使用一个著名的开源工具时,搭建环境是非常重要的一步,在环境搭建的过程中往往要踩很多坑.昨天一不小心把电脑操作系统整坏了,搞了个通宵算是搞定了,把win10系统重装回win7,但之前搭 ...

  5. 音频工具kaldi部署及模型制作调研学习

    语音识别简介 语音识别(speech recognition)技术,也被称为自动语音识别(英语:Automatic Speech Recognition, ASR).计算机语音识别(英语:Comput ...

  6. kaildi讲解

    转载声明:本文为转载文章 作者:ferb2015 原文地址:https://blog.csdn.net/eqiang8848/article/details/81543599 kaldi是一个开源的语 ...

  7. 在ubuntu下安装kaldi基本步骤

    注:最近在学习kaldi语音识别工具,在安装过程中遇到了许多问题,在此记录,以备后需. 在一开始,我看了这篇博客(http://blog.topspeedsnail.com/archives/1001 ...

  8. kaldi简介及安装

    操作系统 : Ubuntu18.04_x64 gcc版本 :7.4.0 简介 Kaldi诞生于2009年的JohnsHopkins University,刚开始项目重点是子空间高斯模型(SGMM)建模 ...

  9. Kaldi学习手记(一):Kaldi的编译安装

    下载 安装git sudo apt-get install git 下载Kaldi git clone https://github.com/kaldi-asr/kaldi.git kaldi-tru ...

随机推荐

  1. Linux安全加固(二)禁止普通用户su到root/设置SSH终端接入白名单/修改history条数

    一.禁止普通用户su到root管理员.设置可以su到root的白名单 1.首先看一下正常情况 2.可以看到普通用户使用su root命令,输入密码即可登录到root用户 3.下面开始配置禁止所有普通用 ...

  2. Aquameta 基于postgresql的web 开发平台

    Aquameta 是一个完全基于pg 开发的web平台 ,目前还在开发中. 当前支持的功能 meta 写入系统信息到pg bundle 基于pg 类似git 的文件系统 filesystem 双向文件 ...

  3. YY天气使用

    前言: 需要使用http获取天气数据,本节说明调用YY天气的http接口获取天气数据 注册: http://www.yytianqi.com/ 登录注册的邮箱验证 验证完成以后: 获取的数据信息: { ...

  4. Linux下g++编译thread出错的的解决方法

    错误如下图所示: 因为thread是C++11新加入的特性,所以我们在用g++编译的时候不能直接用,需要在g++后面加上 -std=c++0x -pthread 如果是gcc编译多线程的话则应该要用 ...

  5. 第04组alpha冲刺(2/4)

    队名:斗地组 组长博客:地址 作业博客:Alpha冲刺(2/4) 各组员情况 林涛(组长) 过去两天完成了哪些任务: 1.收集各个组员的进度 2.写博客 展示GitHub当日代码/文档签入记录: 接下 ...

  6. sharding-jdbc使用笔记

    核心概念: 1.逻辑表:水平拆分的数据库(表)的相同逻辑和数据结构表的总称.例,根据主键尾数拆分为10张表,分别是t_order_0到t_order_9,他们的逻辑表名为t_order 2.真实表:在 ...

  7. UDF——定制窗口

    获取实例句柄的代码来自:https://blog.csdn.net/xie1xiao1jun/article/details/22180815 在Fluent当中我们可以使用scheme来为Fluen ...

  8. 使用electron开发桌面级小程序自动部署系统

    那一天我二十一岁,在我一生的黄金时代,我有好多奢望.我想爱,想吃,还想在一瞬间变成天上半明半暗的云,后来我才知道,生活就是个缓慢受锤的过程,人一天天老下去,奢望也一天天消逝,最后变得像挨了锤的牛一样. ...

  9. cloudstack 安装 install for ubuntu

    准备工作环境信息 修改dns配置 设置阿里源root@sh-saas-cs-manager-online-01:~# mv /etc/apt/sources.list /etc/apt/sources ...

  10. 第1001次安kali

    第1001次安kali 由于VMware跟win10有仇等原因,最终投入了VirtualBox的怀抱 主要参考这个博客Kali Linux安装教程--VirtualBox 参考Kali安装教程(Vir ...