语音识别基础篇(二) - pocketsphinx在windows下的编译和运行

如需转载请标明出处:http://blog.csdn.net/itas109 

QQ技术交流群:129518033

相关文章

语音识别基础篇(一) - CMU Sphinx简介

http://blog.csdn.net/itas109/article/details/78568591

1.编译环境

操作系统:windows 7 64Bit SP1

编译器:Viual Studio 2013

pocketsphinx版本:5prealpha

编译版本:Debug

下载地址:

CMU Sphinx - Browse /sphinxbase/5prealpha at SourceForge.net

CMU Sphinx - Browse /pocketsphinx/5prealpha at SourceForge.net

下载完成解压后目录如下图

2.编译sphinxbase

pocketsphinx依赖于sphinxbase,因此需要先编译sphinxbase。

使用VS2013打开sphinxbase.sln,直接点击生成解决方案即可

输出结果

3.编译pocketsphinx

使用VS2013打开pocketsphinx.sln,直接点击生成解决方案,结果报错了。。。

看错误估计是路径不对,然后右键pocketsphinx查看属性

经过查看果然路径有问题,将sphinxbase-master文件夹修改为sphinxbase文件夹,继续编译就通过了。

至此,pocketsphinx的编译工作结束了

4.运行

将sphinxbase.dll复制到pocketsphinx运行目录下,不然会报缺少DLL的错误。

如果有麦克风可以运行一下命令:

pocketsphinx_continuous.exe -inmic yes -hmm model\en-us\en-us -lm model\en-us\en-us.lm.bin -dict model\en-us\cmudict-en-us.dict

也可以直接读取文件:

pocketsphinx_continuous.exe -infile test\data\goforward.raw -hmm model\en-us\en-us -lm model\en-us\en-us.lm.bin  -dict model\en-us\cmudict-en-us.dict

这里我们使用文件来运行:

pocketsphinx_continuous.exe -infile D
:\ASR\pocketsphinx-master\test\data\cards\004.wav -hmm D:\ASR\pocketsphinx-maste
r\model\en-us\en-us -lm D:\ASR\pocketsphinx-master\model\en-us\en-us.lm.bin -dic
t D:\ASR\pocketsphinx-master\model\en-us\cmudict-en-us.dict


运行结果如下:

D:\ASR\pocketsphinx-master\bin\Debug\Win32>pocketsphinx_continuous.exe -infile D
:\ASR\pocketsphinx-master\test\data\cards\004.wav -hmm D:\ASR\pocketsphinx-maste
r\model\en-us\en-us -lm D:\ASR\pocketsphinx-master\model\en-us\en-us.lm.bin -dic
t D:\ASR\pocketsphinx-master\model\en-us\cmudict-en-us.dict
INFO: pocketsphinx.c(152): Parsed model-specific feature parameters from D:\ASR\
pocketsphinx-master\model\en-us\en-us/feat.params
Current configuration:
[NAME]                  [DEFLT]         [VALUE]
-agc                    none            none
-agcthresh              2.0             2.000000e+000
-allphone
-allphone_ci            yes             yes
-alpha                  0.97            9.700000e-001
-ascale                 20.0            2.000000e+001
-aw                     1               1
-backtrace              no              no
-beam                   1e-48           1.000000e-048
-bestpath               yes             yes
-bestpathlw             9.5             9.500000e+000
-ceplen                 13              13
-cmn                    live            batch
-cmninit                40,3,-1         41.00,-5.29,-0.12,5.09,2.48,-4.07,-1.37,
-1.78,-5.08,-2.05,-6.45,-1.42,1.17
-compallsen             no              no
-dict                                   D:\ASR\pocketsphinx-master\model\en-us\c
mudict-en-us.dict
-dictcase               no              no
-dither                 no              no
-doublebw               no              no
-ds                     1               1
-fdict
-feat                   1s_c_d_dd       1s_c_d_dd
-featparams
-fillprob               1e-8            1.000000e-008
-frate                  100             100
-fsg
-fsgusealtpron          yes             yes
-fsgusefiller           yes             yes
-fwdflat                yes             yes
-fwdflatbeam            1e-64           1.000000e-064
-fwdflatefwid           4               4
-fwdflatlw              8.5             8.500000e+000
-fwdflatsfwin           25              25
-fwdflatwbeam           7e-29           7.000000e-029
-fwdtree                yes             yes
-hmm                                    D:\ASR\pocketsphinx-master\model\en-us\e
n-us
-input_endian           little          little
-jsgf
-keyphrase
-kws
-kws_delay              10              10
-kws_plp                1e-1            1.000000e-001
-kws_threshold          1e-30           1.000000e-030
-latsize                5000            5000
-lda
-ldadim                 0               0
-lifter                 0               22
-lm                                     D:\ASR\pocketsphinx-master\model\en-us\e
n-us.lm.bin
-lmctl
-lmname
-logbase                1.0001          1.000100e+000
-logfn
-logspec                no              no
-lowerf                 133.33334       1.300000e+002
-lpbeam                 1e-40           1.000000e-040
-lponlybeam             7e-29           7.000000e-029
-lw                     6.5             6.500000e+000
-maxhmmpf               30000           30000
-maxwpf                 -1              -1
-mdef
-mean
-mfclogdir
-min_endfr              0               0
-mixw
-mixwfloor              0.0000001       1.000000e-007
-mllr
-mmap                   yes             yes
-ncep                   13              13
-nfft                   512             512
-nfilt                  40              25
-nwpen                  1.0             1.000000e+000
-pbeam                  1e-48           1.000000e-048
-pip                    1.0             1.000000e+000
-pl_beam                1e-10           1.000000e-010
-pl_pbeam               1e-10           1.000000e-010
-pl_pip                 1.0             1.000000e+000
-pl_weight              3.0             3.000000e+000
-pl_window              5               5
-rawlogdir
-remove_dc              no              no
-remove_noise           yes             yes
-remove_silence         yes             yes
-round_filters          yes             yes
-samprate               16000           1.600000e+004
-seed                   -1              -1
-sendump
-senlogdir
-senmgau
-silprob                0.005           5.000000e-003
-smoothspec             no              no
-svspec                                 0-12/13-25/26-38
-tmat
-tmatfloor              0.0001          1.000000e-004
-topn                   4               4
-topn_beam              0               0
-toprule
-transform              legacy          dct
-unit_area              yes             yes
-upperf                 6855.4976       6.800000e+003
-uw                     1.0             1.000000e+000
-vad_postspeech         50              50
-vad_prespeech          20              20
-vad_startspeech        10              10
-vad_threshold          3.0             3.000000e+000
-var
-varfloor               0.0001          1.000000e-004
-varnorm                no              no
-verbose                no              no
-warp_params
-warp_type              inverse_linear  inverse_linear
-wbeam                  7e-29           7.000000e-029
-wip                    0.65            6.500000e-001
-wlen                   0.025625        2.562500e-002

INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13,
CMN='batch', VARNORM='no', AGC='none'
INFO: acmod.c(162): Using subvector specification 0-12/13-25/26-38
INFO: mdef.c(518): Reading model definition: D:\ASR\pocketsphinx-master\model\en
-us\en-us/mdef
INFO: mdef.c(531): Found byte-order mark BMDF, assuming this is a binary mdef fi
le
INFO: bin_mdef.c(336): Reading binary model definition: D:\ASR\pocketsphinx-mast
er\model\en-us\en-us/mdef
INFO: bin_mdef.c(516): 42 CI-phone, 137053 CD-phone, 3 emitstate/phone, 126 CI-s
en, 5126 Sen, 29324 Sen-Seq
INFO: tmat.c(149): Reading HMM transition probability matrices: D:\ASR\pocketsph
inx-master\model\en-us\en-us/transition_matrices
INFO: acmod.c(113): Attempting to use PTM computation module
INFO: ms_gauden.c(127): Reading mixture gaussian parameter: D:\ASR\pocketsphinx-
master\model\en-us\en-us/means
INFO: ms_gauden.c(242): 42 codebook, 3 feature, size:
INFO: ms_gauden.c(244):  128x13
INFO: ms_gauden.c(244):  128x13
INFO: ms_gauden.c(244):  128x13
INFO: ms_gauden.c(127): Reading mixture gaussian parameter: D:\ASR\pocketsphinx-
master\model\en-us\en-us/variances
INFO: ms_gauden.c(242): 42 codebook, 3 feature, size:
INFO: ms_gauden.c(244):  128x13
INFO: ms_gauden.c(244):  128x13
INFO: ms_gauden.c(244):  128x13
INFO: ms_gauden.c(304): 222 variance values floored
INFO: ptm_mgau.c(475): Loading senones from dump file D:\ASR\pocketsphinx-master
\model\en-us\en-us/sendump
INFO: ptm_mgau.c(499): BEGIN FILE FORMAT DESCRIPTION
INFO: ptm_mgau.c(562): Rows: 128, Columns: 5126
INFO: ptm_mgau.c(594): Using memory-mapped I/O for senones
INFO: ptm_mgau.c(837): Maximum top-N: 4
INFO: phone_loop_search.c(114): State beam -225 Phone exit beam -225 Insertion p
enalty 0
INFO: dict.c(320): Allocating 138824 * 20 bytes (2711 KiB) for word entries
INFO: dict.c(333): Reading main dictionary: D:\ASR\pocketsphinx-master\model\en-
us\cmudict-en-us.dict
INFO: dict.c(213): Dictionary size 134723, allocated 1016 KiB for strings, 1679
KiB for phones
INFO: dict.c(336): 134723 words read
INFO: dict.c(358): Reading filler dictionary: D:\ASR\pocketsphinx-master\model\e
n-us\en-us/noisedict
INFO: dict.c(213): Dictionary size 134728, allocated 0 KiB for strings, 0 KiB fo
r phones
INFO: dict.c(361): 5 words read
INFO: dict2pid.c(396): Building PID tables for dictionary
INFO: dict2pid.c(406): Allocating 42^3 * 2 bytes (144 KiB) for word-initial trip
hones
INFO: dict2pid.c(132): Allocated 21336 bytes (20 KiB) for word-final triphones
INFO: dict2pid.c(196): Allocated 21336 bytes (20 KiB) for single-phone word trip
hones
INFO: ngram_model_trie.c(354): Trying to read LM in trie binary format
INFO: ngram_search_fwdtree.c(74): Initializing search tree
INFO: ngram_search_fwdtree.c(101): 791 unique initial diphones
INFO: ngram_search_fwdtree.c(186): Creating search channels
INFO: ngram_search_fwdtree.c(323): Max nonroot chan increased to 152609
INFO: ngram_search_fwdtree.c(333): Created 723 root, 152481 non-root channels, 5
3 single-phone words
INFO: ngram_search_fwdflat.c(157): fwdflat: min_ef_width = 4, max_sf_win = 25
INFO: continuous.c(307): pocketsphinx_continuous.exe COMPILED ON: Nov 20 2017, A
T: 20:33:32

INFO: cmn_live.c(120): Update from < 41.00 -5.29 -0.12  5.09  2.48 -4.07 -1.37 -
1.78 -5.08 -2.05 -6.45 -1.42  1.17 >
INFO: cmn_live.c(138): Update to   < 64.76 -3.10 -9.74  0.89 -10.79 -0.03 -8.38
-4.40 -7.83  7.06 -2.24  5.81 -2.96 >
INFO: ngram_search_fwdtree.c(1550):     4674 words recognized (30/fr)
INFO: ngram_search_fwdtree.c(1552):   494454 senones evaluated (3190/fr)
INFO: ngram_search_fwdtree.c(1556):  3563622 channels searched (22991/fr), 86478
 1st, 209626 last
INFO: ngram_search_fwdtree.c(1559):     9899 words for which last channels evalu
ated (63/fr)
INFO: ngram_search_fwdtree.c(1561):   460667 candidate words for entering last p
hone (2972/fr)
INFO: ngram_search_fwdtree.c(1564): fwdtree 3.87 CPU 2.496 xRT
INFO: ngram_search_fwdtree.c(1567): fwdtree 3.87 wall 2.495 xRT
INFO: ngram_search_fwdflat.c(302): Utterance vocabulary contains 176 words
INFO: ngram_search_fwdflat.c(948):     2436 words recognized (16/fr)
INFO: ngram_search_fwdflat.c(950):   189379 senones evaluated (1222/fr)
INFO: ngram_search_fwdflat.c(952):   291055 channels searched (1877/fr)
INFO: ngram_search_fwdflat.c(954):    14721 words searched (94/fr)
INFO: ngram_search_fwdflat.c(957):    11844 word transitions (76/fr)
INFO: ngram_search_fwdflat.c(960): fwdflat 0.33 CPU 0.211 xRT
INFO: ngram_search_fwdflat.c(963): fwdflat 0.32 wall 0.209 xRT
INFO: ngram_search.c(1250): lattice start node <s>.0 end node </s>.125
INFO: ngram_search.c(1276): Eliminated 1 nodes before end node
INFO: ngram_search.c(1381): Lattice has 511 nodes, 1221 links
INFO: ps_lattice.c(1374): Bestpath score: -4996
INFO: ps_lattice.c(1378): Normalizer P(O) = alpha(</s>:125:153) = -402730
INFO: ps_lattice.c(1435): Joint P(O,S) = -415426 P(S|O) = -12696
INFO: ngram_search.c(872): bestpath 0.02 CPU 0.010 xRT
INFO: ngram_search.c(875): bestpath 0.01 wall 0.008 xRT
five five
INFO: ngram_search_fwdtree.c(429): TOTAL fwdtree 3.87 CPU 2.512 xRT
INFO: ngram_search_fwdtree.c(432): TOTAL fwdtree 3.87 wall 2.511 xRT
INFO: ngram_search_fwdflat.c(176): TOTAL fwdflat 0.33 CPU 0.213 xRT
INFO: ngram_search_fwdflat.c(179): TOTAL fwdflat 0.32 wall 0.210 xRT
INFO: ngram_search.c(303): TOTAL bestpath 0.02 CPU 0.010 xRT
INFO: ngram_search.c(306): TOTAL bestpath 0.01 wall 0.008 xRT


我们在倒数7行看到了five five。这就是识别结果。

在下一篇里面我们将介绍一下中文语音识别。

Reference:

Building an application with PocketSphinx – CMUSphinx Open Source Speech Recognition

觉得文章对你有帮助,可以用微信扫描二维码捐赠给博主,谢谢!


 

 如需转载请标明出处:http://blog.csdn.net/itas109 

QQ技术交流群:12951803

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

itas109

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值