This is an old revision of the document!


in Japanese: http://ja.nishimotz.com/project:dmcpp

DMCPP

dialog manager for galatea, using libjulius and opencv, written in C++.

Source file: http://github.com/nishimotz/dmcpp

An experiment which replaces the dialog manager (DM) creaded by galatea-generate by an application written in C++.

The DM application also handles speech recognition engine julius, with the same mannar of the Java based dialogstudio. opencv face detection is also integrated.

The project is tested with Ubuntu 9.04 and Ubuntu 10.04 (i386). In this project, the character encoding is UTF-8. Japanese speech engines are used, currently.

setup

Ubuntu official packages:

$ sudo aptitude install ruby
$ sudo aptitude install freeglut3
$ sudo aptitude install openjdk-6-jre
$ sudo aptitude install chasen
$ sudo aptitude install rhino
$ sudo aptitude install libreadline5
$ sudo aptitude install ttf-sazanami-gothic

sourceforge.jp packages:

packages by nishimotz:

Linux で認識できる USB カメラをつないでおく必要がある。

コンパイルと実行

git からレポジトリを複製する。

$ git clone git://github.com/nishimotz/dmcpp.git
$ cd dmcpp

または dmcpp のソースをダウンロードする。 github で右上の download source をクリックして tar を選ぶ。

nishimotz-dmcpp-ec191ea.tar.gz みたいな感じのファイルになる。(末尾の数字はバージョンによって異なる)

$ tar xvfz nishimotz-dmcpp-ec191ea.tar.gz
$ cd nishimotz-dmcpp-ec191ea

コンパイルして実行。

$ make
$ ./app/script/runner

make でエラーが出たらどこか失敗している。

マイクに「安田講堂」と喋ると「安田講堂ですね」という応答が得られるはず。

音声認識文法

gram.txt には「やすだこうどう 安田講堂」のように「読み」「表記」をスペース区切りで列挙。

make の中で gram の生成が行われるが、この処理は rakefile.rb に書かれており、 Java 版 Dialog Studio のクラスが呼び出されている。

dm.cpp

http://github.com/nishimotz/dmcpp/blob/master/dm.cpp

main() のスレッドで stdin を読んで処理する。

julius_worker と cv_worker と main の3つの関数が マルチスレッドで同時に動く。

構造体 thread_info_t を使ってスレッド間で変数を共有できるので、 これを使って顔検出と音声入力の状態の組み合わせから 対話状態を切り替えたり音声応答をしたりすることができるはず。

音声認識と応答

オウム返しタスク。 output_result() コールバックの中で標準出力に “to @AM-MCL set Speak = %sですね” という文字列を送っている。

INTERIM julius_progout は stderr に出力だけして、現在は使っていない。

julius_worker() は pthread で create & detach されている。

workorder_t, thread_info_t などはスレッド間の情報のやりとりに使う予定。

顔検出

opencv の顔検出を組み合わせてみた。

新たなworkerスレッド cv_worker() 関数にて顔検出のループを回している。

対話制御に反映させるのはこれから。

app

どうやって dialogstudio の対話マネージャを入れ替えているか。

app/skel/am.conf.txt

# module:DM     commands: <%= am_commands_dm %>
module:DM     commands: cd <%= File.join($runner_dir, '..') %>; ./dm

拡張子が txt になっているが ERB である。

$runner_dir は app/script/runner で代入されるグローバル変数。

project/dmcpp.1276688266.txt.gz · Last modified: 2010/06/16 11:37 (external edit)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0