下载kaldi包
git clone https://github.com/kaldi-asr/kaldi.git
然后安装依赖库进 cd tools
tools文件 运行 ./extras/check_dependencies.sh
根据它要求安装 各种库
再运行一次: ./extras/check_dependencies.sh
然后就有 ./extras/check_dependencies.sh: all OK.
然后编译这些tools make -j 8
下面进入src编译相关的GMM/NNET等的库
cd src
然后输入
./configure --shared
make depend -j 8
make -j 8
特别慢,等着就行了。
最后看到
echo Done
Done
就成功了。
模型下载地址:http://kaldi-asr.org/models/0002_cvte_chain_model.tar.gz
解压放到kaldi-trunk/egs
下即可
在线识别命令(cd src/online2bin/
):
./online2-wav-nnet3-latgen-faster --do-endpointing=false --online=false --feature-type=fbank --fbank-config=../../egs/cvte/s5/conf/fbank.conf --max-active=7000 --beam=15.0 --lattice-beam=6.0 --acoustic-scale=1.0 --word-symbol-table=../../egs/cvte/s5/exp/chain/tdnn/graph/words.txt ../../egs/cvte/s5/exp/chain/tdnn/final.mdl ../../egs/cvte/s5/exp/chain/tdnn/graph/HCLG.fst 'ark:echo utter1 utter1|' 'scp:echo utter1 ../../egs/cvte/s5/data/wav/00030/2017_03_07_16.57.22_1175.wav|' ark:/dev/null
打开终端,链接steps和untils:
ln -s ~/kaldi/egs/wsj/s5/steps ~/kaldi/egs/cvte/s5/steps
ln -s ~/kaldi/egs/wsj/s5/utils ~/kaldi/egs/cvte/s5/utils
最后运行run.sh即可
如果出现错误:
utils/lang/check_phones_compatible.sh: Error! Both of the two phones-symbol tables are absent.
Please check your command
忽略这个问题,注释掉utils/lang/check_phones_compatible.sh
中if语句中的exit 1
即:
# check if the files exist or not
if [ ! -f $table_first ]; then
if [ ! -f $table_second ]; then
echo "$0: Error! Both of the two phones-symbol tables are absent."
echo "Please check your command"
#exit 1;
else
# The phones-symbol-table1 is absent. The model directory maybe created by old script.
# For back compatibility, this script exits silently with status 0.
exit 0;
fi
elif [ ! -f $table_second ]; then
# The phones-symbol-table2 is absent. The model directory maybe created by old script.
# For back compatibility, this script exits silently with status 0.
exit 0;
fi
继续运行会出现找不到score.sh
,建立软连接即可
ln -s /home/cmcross/projects/kaldi/egs/hkust/s5/local /home/cmcross/projects/kaldi/egs/cvte/s5/local
运行成果,结果在/home/cmcross/projects/kaldi/egs/cvte/s5/exp/chain/tdnn/decode_test/scoring_kaldi
文件夹下可找到
1、overcommit_memory的问题
LOG (online2-wav-nnet3-latgen-faster[5.5.88~1-8e30f]:RemoveOrphanNodes():nnet-nnet.cc:948) Removed 1 orphan nodes.
LOG (online2-wav-nnet3-latgen-faster[5.5.88~1-8e30f]:RemoveOrphanComponents():nnet-nnet.cc:847) Removing 2 orphan components.
LOG (online2-wav-nnet3-latgen-faster[5.5.88~1-8e30f]:Collapse():nnet-utils.cc:1378) Added 1 components, removed 2
LOG (online2-wav-nnet3-latgen-faster[5.5.88~1-8e30f]:CompileLooped():nnet-compile-looped.cc:345) Spent 0.00703406 seconds in looped compilation.
WARNING (online2-wav-nnet3-latgen-faster[5.5.88~1-8e30f]:Open():kaldi-io.cc:470) Failed opening pipe for reading, command is: echo utter1 utter1, errno is Cannot allocate memory
WARNING (online2-wav-nnet3-latgen-faster[5.5.88~1-8e30f]:Open():util/kaldi-table-inl.h:513) Failed to open stream 'echo utter1 utter1|'
ERROR (online2-wav-nnet3-latgen-faster[5.5.88~1-8e30f]:SequentialTableReader():util/kaldi-table-inl.h:860) Error constructing TableReader: rspecifier is ark:echo utter1 utter1|
[ Stack-Trace: ]
kaldi::MessageLogger::HandleMessage(kaldi::LogMessageEnvelope const&, char const*)
kaldi::FatalMessageLogger::~FatalMessageLogger()
kaldi::SequentialTableReader::SequentialTableReader(std::__cxx11::basic_string, std::allocator > const&)
main
__libc_start_main
_start
解决方法:
sysctl vm.overcommit_memory=1
sysctl -p