Amazon Transcribeがオーディオチャンネルによる話者の識別に対応しました

2018.08.06

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

AWS が提供する自動音声認識サービス Amazon Transcribe がオーディオチャンネルによる話者の識別(Channel Identification)に対応しました。

  • コールセンターシステム(顧客とオペレーターの通話履歴を別チャンネルに録音)
  • ポッドキャスト(ホストとゲストを別チャンネルに録音)

などで話者を特定した文字起こしをしたい場合に有用です。

やってみた

チャンネル識別を有効にした文字起こしジョブの作成

管理コンソールからの操作

管理コンソールからジョブを作成する場合、 Channel identification を有効(Enabled)にします。

チャンネル識別(channel identification)話者ダイアライゼーション(speaker identification)は相互排他なため、片方を有効にすると、もう片方は無効化されます。

デフォルト

デフォルトでは channel identification・speaker identification ともに Disabled です

channel identification を有効

channel identification を Enabled にすると speaker identification は Enabled にできなくなります

speaker identification を有効

speaker identification を Enabled にすると channel identification は Enabled にできなくなります

AWS CLI からの操作

transcribe:StartTranscriptionJob API 呼び出し時に --settings ChannelIdentification=true オプションを渡します。

$ aws transcribe start-transcription-job \
  --transcription-job-name XXX \
  --media-format wav \
  --language-code en-US \
  --settings ChannelIdentification=true \
  --media MediaFileUri=https://s3.amazonaws.com/BUCKET/path/to/audio.wav
{
    "TranscriptionJob": {
        "Settings": {
            "ChannelIdentification": true
        },
        "LanguageCode": "en-US",
        "MediaFormat": "wav",
        "TranscriptionJobName": "XXX",
        "CreationTime": 1533470691.441,
        "TranscriptionJobStatus": "IN_PROGRESS",
        "Media": {
            "MediaFileUri": "https://s3.amazonaws.com/BUCKET/path/to/audio.wav"
        }
    }
}
$ aws transcribe get-transcription-job --transcription-job-name XXX
{
    "TranscriptionJob": {
        "TranscriptionJobStatus": "IN_PROGRESS",
        "CreationTime": 1533470691.441,
        "Transcript": {},
        "MediaSampleRateHertz": 44100,
        "LanguageCode": "en-US",
        "Settings": {
            "ChannelIdentification": true
        },
        "MediaFormat": "wav",
        "TranscriptionJobName": "XXX",
        "Media": {
            "MediaFileUri": "https://s3.amazonaws.com/BUCKET/path/to/audio.wav"
        }
    }
}

チャンネル識別(ChannelIdentification)と話者ダイアライゼーション(ShowSpeakerLabels)は相互排他なため、両方のフラグを有効にしてジョブを作成しようとすると、エラー BadRequestException が発生します。

$ aws transcribe start-transcription-job \
  --transcription-job-name 25b65f00-9f9b-4922-a3ac-423575e29307 \
  --media-format wav \
  --language-code en-US \
  --settings ShowSpeakerLabels=true,ChannelIdentification=true \
  --media MediaFileUri=https://s3.amazonaws.com/transcribe-6ff59c25d223/dual-channel.wav
...  
An error occurred (BadRequestException) when calling the StartTranscriptionJob operation: You can't use SplitChannelTranscription and ShowSpeakerLabels in the same request. Please use one of SplitChannelTranscription or ShowSpeakerLabels and try your request again.

ジョブ結果

Channel Identification ではチャンネルごとに文字起こしを行い、最後に各チャンネルの文字起こし結果を1スクリプトとして結合します。

Amazon Transcribe splits your audio file into multiple channels and transcribes the channels separately. After transcribing all channels, Amazon Transcribe also merges the transcriptions to create a single transcription. It returns all of the transcriptions in a single result file.

https://docs.aws.amazon.com/transcribe/latest/dg/how-it-works.html

独立した2種類の音声を用意し

  • それぞれを個別に文字起こしした結果
  • 左右別チャンネルのステレオ音声1本にして文字起こしした結果

を比較したところ、ごく一部の単語の解析に違いがありましたが、残りは完全に一致していました。

管理コンソール

管理コンソールのジョブ詳細画面には「Text」「Speaker identification」に並んで、「Channel identification」の新規タブが追加されています。

Channel Identification を有効にすると、このタブにチャンネル別の文字起こし結果が表示されます。

文字起こしファイル

Channel Identification を有効にすると resultschannel_labels のブロックが追加されます。

チャンネルのラベルはこのブロックにしか存在しません。

  • チャンネル別の文字起こし結果が欲しい場合
  • 対談記事のように話者を識別して発話順に文字起こししたい場合

はこの channel_labels 内のデータを加工します。

{
  "jobName": "XXX",
  "accountId": "123456789012",
  "results": {
    "transcripts": [
      // チャンネルを区別せず、utterance の start_time 順に語を並べたもの
      {
        "transcript": "Even in property management. Emergency line what's your emergency, please. ..."
      }
    ],
    "channel_labels": {
      // チャンネル別の文字起こし結果
      "channels": [
        {
          // チャンネル ch_0 の文字起こし結果
          "channel_label": "ch_0",
          "items": [
            {
              "start_time": "0.402",
              "end_time": "0.532",
              "alternatives": [
                {
                  "confidence": "0.7471",
                  "content": "Even"
                }
              ],
              "type": "pronunciation"
            },...
          ]
        },
        {
          // チャンネル ch_1 の文字起こし結果
          "channel_label": "ch_1",
          "items": [
            {
              "start_time": "1.619",
              "end_time": "1.819",
              "alternatives": [
                {
                  "confidence": "1.0000",
                  "content": "Good"
                }
              ],
              "type": "pronunciation"
            },
            ...
            {
              "start_time": "1.819",
              "end_time": "2.219",
              "alternatives": [
                {
                  "confidence": "1.0000",
                  "content": "morning"
                }
              ],
              "type": "pronunciation"
            }...
          ]
        }
      ],
      // チャンネルの数
      "number_of_channels": 2
    },
    "items": [
      // チャンネルを区別せず utterance の start_time 順に並べたもの
      {
        "start_time": "0.402",
        "end_time": "0.532",
        "alternatives": [
          {
            "confidence": "0.7471",
            "content": "Even"
          }
        ],
        "type": "pronunciation"
      },
      {
        "start_time": "0.532",
        "end_time": "0.652",
        "alternatives": [
          {
            "confidence": "0.7476",
            "content": "in"
          }
        ],
        "type": "pronunciation"
      },
      ...
    ]
  },
  "status": "COMPLETED"
}

制限事項

上限チャンネル数について

現時点で2チャンネルまで対応しています。

このチャンネルを超える音源に対してジョブ実行すると、エラーが発生します。

まとめ

Amazon Transcribe がオーディオチャンネルによる話者の識別に対応しました。

この機能を利用することで、チャンネル別オーディオファイルに分割→個別に文字起こし→統合というようなパイプラインの作成は不要になります。

話者ごとに別チャンネルで録音されていない音源に対して話者を識別したい場合は、従来から存在する話者ダイアライゼーション(speaker identity)方式の話者識別をご利用ください。

文字起こしサービスAmazon Transcribeが話者を識別するようになりました

参考