ROS kinetic語音識別

1.安裝依賴html

1.1安裝ros-kinetic-audio-common
python

sudo apt-get install ros-kinetic-audio-common

1.2 安裝libasound2git

sudo apt-get install libasound2

1.3 安裝libgstreamer0.10github

sudo apt-get install gstreamer0.10-*

1.4安裝python-gst0.10測試

sudo apt-get install python-gst0.10

 2.安裝 libsphinxbase1
網站

下載地址:https://packages.debian.org/jessie/libsphinxbase1spa

 

sudo dpkg -i libsphinxbase1_0.8-6_amd64.deb

3. 安裝libpocketsphinx1.net

下載地址:https://packages.debian.org/jessie/libpocketsphinx1code

sudo dpkg -i libpocketsphinx1_0.8-5_amd64.deb 

4.安裝gstreamer0.10-pocketsphinxhtm

下載地址:https://packages.debian.org/jessie/gstreamer0.10-pocketsphinx

sudo dpkg -i gstreamer0.10-pocketsphinx_0.8-5_amd64.deb

5.安裝pocketsphinx

5.1進入工做空間,git源碼

cd ~/dev/catkin_ws/src
git clone https://github.com/mikeferguson/pocketsphinx

5.2下載英文語音包pocketsphinx-hmm-en-tidigits (0.8-5)

下載的網站:https://packages.debian.org/jessie/pocketsphinx-hmm-en-tidigits

sudo dpkg -i pocketsphinx-hmm-en-tidigits_0.8-5_all.deb

會加壓安裝到/usr/share/目錄以下所示

/usr/share/doc/pocketsphinx-hmm-en-tidigits/changelog.Debian.gz
/usr/share/doc/pocketsphinx-hmm-en-tidigits/changelog.gz
/usr/share/doc/pocketsphinx-hmm-en-tidigits/copyright
/usr/share/pocketsphinx/model/hmm/en/tidigits/feat.params
/usr/share/pocketsphinx/model/hmm/en/tidigits/mdef
/usr/share/pocketsphinx/model/hmm/en/tidigits/means
/usr/share/pocketsphinx/model/hmm/en/tidigits/sendump
/usr/share/pocketsphinx/model/hmm/en/tidigits/transition_matrices
/usr/share/pocketsphinx/model/hmm/en/tidigits/variances
/usr/share/pocketsphinx/model/lm/en/tidigits.DMP
/usr/share/pocketsphinx/model/lm/en/tidigits.dic
/usr/share/pocketsphinx/model/lm/en/tidigits.fsg

在包pocketsphinx下面建一個model目錄,存放語音模型文件

cd ~/dev/catkin_ws/src/pocketsphinx
mkdir model

將下載好的語音文件,解壓後,將其中的model文件下的全部文件拷貝到~/dev/catkin_ws/src/pocketsphinx/model下,也能夠不復制。

6 啓動pocketsphinx測試

直接運行pocketsphinx啓動腳本命令「roslaunch pocketsphinx robocup.launch」會出現以下錯誤,

爲此,首先我對recognizer.py的作了以下修改:

1)註釋掉self.asr.set_property('configured', True)

2)添加lm,dict,hmm支持英語識別(若是是其餘語言(如普通話)能夠改成別的路徑)

self.asr.set_property('lm', '/usr/share/pocketsphinx/model/lm/en/tidigits.DMP')
self.asr.set_property('dict', '/usr/share/pocketsphinx/model/lm/en/tidigits.dic')
self.asr.set_property('hmm', '/usr/share/pocketsphinx/model/hmm/en/tidigits')

這些安裝好以後,能夠開始測試pocketsphinx的語音識別功能了:

1.終端運行launch啓動文件:

roslaunch pocketsphinx robocup.launch

 

2.嘗試說一些簡單的語句,(若是使用英文庫,說一些數字;若是使用普通話庫講中文),查看識別結果

3.用rostopic echo進行查看識別的輸出,即ROS發佈的結果消息)

rostopic echo /recognizer/output

7.也能夠下載其餘包進行測試

中文普通話

pocketsphinx-hmm-zh-tdt https://packages.debian.org/jessie/pocketsphinx-hmm-zh-tdt

pocketsphinx-lm-zh-hans-gigatdt  https://packages.debian.org/jessie/pocketsphinx-lm-zh-hans-gigatdt

後期考慮在launch文件中設置參數,在recognizer.py加載參數的讀取

 參考:http://blog.csdn.net/x_r_su/article/details/53022746?locationNum=1&fps=1

 http://www.ncnynl.com/archives/201701/1220.html

相關文章
相關標籤/搜索