語音識別——kaldi安裝與編譯

1、安裝

下載源代碼:

git clone https://github.com/kaldi-asr/kaldi.git

各目錄功能:

./tools目錄下面全部都是Kaldi依賴的包。其中主要有:

  1. OpenFST:Weighted Finite State Transducer library,是一個用來構造有限狀態自動機的庫。我們知道隱馬爾科夫模型就可以看成是一個有限狀態自動機的。這是最終要的一個包,Kaldi的文檔裏面說:If you ever want to understand Kaldi deeply you will need to understand OpenFst.
  2. ATLAS:這是一個C++下的線性代數庫。做機器學習自然是需要很多矩陣運算的。
  3. IRSTLM:這是一個統計語言模型的工具包。
  4. sph2pipe:這是賓夕法尼亞大學linguistic data consortium(LDC)開發的一款處理SPHERE_formatted數字音頻文件的軟件,它可以將LDC的sph格式的文件轉換成其它格式。

./src目錄存放的是Kaldi的源代碼。

./egs存放的是Kaldi提供的一些例子。我們現在要做的就是編譯安裝Kaldi依賴的各種庫,然後編譯安裝Kaldi。
 

2、編譯

進入 tools/ 查看INSTALL 信息

執行:

 extras/check_dependencies.sh

查看包依賴,並按照提示安裝缺失的包

當出現:extras/check_dependencies.sh: all OK. 表示成功安裝


返回到tools目錄,查看cpu核心數目:

nproc --all  (我的爲12)

執行:

make -j 12

出現:All done OK. 表示成功安裝。


進入 src目錄 查看install 安裝說明,根據安裝說明執行以下步驟:

執行:

 ./configure --shared
 make depend -j 12
 make -j 12

出現SUCCESS表示安裝成功

3、常見錯誤

出現:

 
Could not find {libatlas,libsatlas}.so in any of the obvious places, will most likely try static:
Could not find libatlas.a in any of the generic-Linux places, but we'll try other stuff...

** Failed to configure ATLAS libraries ***
**  ERROR   **
** Configure cannot proceed automatically.
**  If you know that you have ATLAS installed somewhere on your machine, you
** may be able to proceed by replacing [somewhere] in kaldi.mk with a directory.
**  If you have sudo (root) access you could install the ATLAS package on your
** machine, e.g. 'sudo apt-get install libatlas-dev libatlas-base-dev' or
** 'sudo yum install atlas.x86_64' or 'sudo zypper install libatlas3-devel',
** or on cygwin, install atlas from the installer GUI; and then run ./configure
** again.
**
**  Otherwise (or if you prefer OpenBLAS for speed), you could go the OpenBLAS
** route: cd to ../tools, type 'extras/install_openblas.sh', cd back to here,
** and type './configure  --openblas-root=../tools/OpenBLAS/install'

執行:

sudo apt-get install libatlas-base-dev

4、測試

  • 進入egs目錄,用命令 cat README.txt 查看用例,egs下面包含如voxforge,vystadial_{cz,en},yesno和LDC用例
  • 這裏用yesno爲例
  • 進入egs/yesno目錄,用命令cat README.txt 查看yesno數據集介紹,是一個關於Yes/no識別的簡單的數據集
  • 進入egs/yesno/s5目錄,執行 ./run.sh 腳本
  • 出現%WER 0.00 [ 0 / 232, 0 ins, 0 del, 0 sub ] exp/mono0a/decode_test_yesno/wer_10_0.0時,恭喜你,Kaldi安裝成功!

參考:

https://blog.csdn.net/xie1xiao1jun/article/details/80667026

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章