Siriusは、主にミシガン大学のClarity labチームが開発している、オープンソースの知的パーソナルアシスタント(IPA)サービスです。音声による質問に対する回答およびアップロードされた画像のマッチング結果を自然言語で返します。音声認識、画像認識、自然言語処理、質問応答システムといった技術を組み合わせて実装しています。
SiriusはGithubにて開発中ですが、2015/4/19時点のソースを取得してビルドしましたので手順を公開します。
サーバの準備
Siriusは潤沢なリソースを必要とします。試した範囲では、メモリは8GB程度、ディスクは40GB以上を必要とします。こうした潤沢なリソースを用意できない場合はクラウド上にサーバを用意しましょう。今回はSoftLayer上に以下のような環境を構築しました。
- CPU: 1コア
- メモリ: 8GB
- ディスク: 100GB
- OS: Ubuntu 14.04 64bit
$ sl vs create --hourly --datacenter=dal09 --cpu=1 --memory=8192 --os=UBUNTU_14_64 --disk=100 --key=yourkey --hostname=yourhost --domain=yourdomain.com
ビルド
Siriusをgit cloneしてビルドします。ここの手順はほぼ公式サイト通りです。
$ apt-get update; apt-get upgrade
$ apt-get install git software-properties-common # git and apt tools
$ git clone https://github.com/jhauswald/sirius.git
$ cd sirius/sirius-application
$ ./get-dependencies.sh # 必要なソフトウェアのapt-get
$ ./get-kaldi.sh # 音声認識ソフトウェアKaldiのビルド
$ ./get-opencv.sh # 画像処理ライブラリOpenCVのビルド
$ ./compile-sirius-servers.sh # Sirius本体のビルド
$ export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH} # すでに設定されていれば不要
$ mkdir ~/log # サーバプロセスログ用のディレクトリを作成
ここまでログにエラーが確認できなければOKです。ビルドに要する時間は合計で約1時間程度です。(今回はDallasにあるSoftLayerインスタンス上でビルドしているため通信にほとんど時間がかかっていません)
音声認識(ASR)
まず、音声認識サーバをバックグランドで起動します。
$ cd ~/sirius/sirius-application/run-scripts
$ ./start-asr-server.sh > ~/log/asr.log 2>~/log/asr-error.log < /dev/null &
テスト用の音声ファイルを投げてみます。
$ ./sirius-asr-test.sh ../inputs/questions/what.is.the.population.of.france.wav
認識結果が返ってきました。
Your audio file is:
../inputs/questions/what.is.the.population.of.france.wav
Sending request to server localhost:8081/ ...
what is the population of france
***********************************************
質問応答(QA)
次に、質問応答システムをテストします。
質問応答システムを使う前に、wikipediaベースの知識データベースをダウンロードする必要があります。このアーカイブは11GB程度のサイズになっていますので、通信環境や回線に注意しましょう。
$ wget http://web.eecs.umich.edu/~jahausw/download/wiki_indri_index.tar.gz
$ tar xzvf wiki_indri_index.tar.gz -C ~/sirius/sirius-application/question-answer/
サーバをバックグランド起動します。
$ cd ~/sirius/sirius-application/run-scripts
$ ./start-qa-server.sh > ~/log/qa.log 2>~/log/qa-error.log < /dev/null &
質問を投げてみます。
$ ./sirius-qa-test.sh "what is the speed of light"
1コア8GBメモリでは、30〜40秒で以下のように回答が返ってきました。
(1) Your query text is:
what is the speed of light
(2) Sending request to server...
299,792,458 meters per second
***********************************************
音声による質問応答(ASR+QA)
上記ASRとQAのサーバを起動した状態で、音声による質問応答のテストを行うこともできます。(音声認識サーバに投げて返ってきた結果をそのまま質問応答サーバに投げる、という単純な実装です)
$ ./sirius-asr-qa-test.sh ../inputs/questions/what.is.the.population.of.france.wav
以下のような結果が返ってきました。
Your voice search (text) is:
../inputs/questions/what.is.the.population.of.france.wav
Sending request to ASR server...
Sending request to QA server...
2013, 66,394,000
***********************************************
画像マッチング(IMM)
最後に、画像マッチングです。画像マッチングを使用するまえに、サンプルとして格納されているランドマーク画像のデータベースを構成します。
$ cd ~/sirius/sirius-application/image-matching
$ ./make-db.py landmarks matching/landmarks/db/
ここで、画像マッチングサーバをバックグランド起動します。
$ cd ~/sirius/sirius-application/run-scripts
$ ./start-imm-server.sh > ~/log/imm.log 2>~/log/imm-error.log < /dev/null &
画像を投げてマッチングを行います。
$ ./sirius-imm-test.sh ../image-matching/matching/landmarks/query/query.jpg
回答が返ってきました。
(1) Your image file is:
../image-matching/matching/landmarks/query/query.jpg
Image data: tower pisa