On-Device Speech-to-Text

概要

Speech-to-Text On Device を使用すると、組み込みデバイスでサーバー品質の音声テクノロジーを利用できます。これにより、ネットワークや Google のサーバーに接続することなく、デバイス上でストリーミング音声認識を完全に実行できます。

このソリューションは、双方向ストリーミング gRPC サーバーです。サーバーは Cloud Speech 双方向ストリーミング API と同様に、音声を使用し、リアルタイムでイベントを出力します。

以下の API は、完成したサンプルではありません。

service SpeechToText {
  rpc StreamingRecognize(stream StreamingRecognizeRequest)
      returns (stream StreamingRecognizeResponse) {}
}

message StreamingRecognizeRequest {
  oneof streaming_request {
    StreamingRecognitionConfig streaming_config = 1;
    bytes audio_content = 2;
  }
  // ...
}

message StreamingRecognizeResponse {
  enum SpeechEventType {
    // ...

    // This event indicates that the server has detected the beginning of human
    // voice activity in the stream. This event can be returned multiple times
    // if speech starts and stops repeatedly throughout the stream.
    START_OF_SPEECH = 2;

    // This event indicates that the server has detected the end of human voice
    // activity in the stream. This event can be returned multiple times if
    // speech starts and stops repeatedly throughout the stream.
    END_OF_SPEECH = 3;
  }
  // ...
  repeated StreamingRecognitionResult results = 2;
  // ...

  SpeechEventType speech_event_type = 4;
}

クイックスタートの例

以下に、On-Device サーバーの使用例を示します。

  1. 言語パック(LP)を選択して認識サーバーを起動します。

    言語パックは、モデルと構成を含むディレクトリです。Speech-to-Text サーバーは一度に 1 つの言語パックを処理します。

      ./speech_to_text_server --server_ip="0.0.0.0" --port=8000 \
         --language_pack=/../en_us
    
  2. コマンドライン クライアントで音声ファイル(WAV)を含むサーバーを試します

      ./speech_to_text_client --server_ip="0.0.0.0" --port=8000 \
        --audio=/../hello.wav
    

    コマンドライン クライアント オプションをご覧ください。

      ./speech_to_text_client --help