コンテンツへスキップ

音声アノテーション

Potatoで波形ベースの音声アノテーションを設定します。インタラクティブな再生コントロールを表示し、時間マーカーを設定して、radio、likert、textのスキーマと組み合わせます。

Potato 2.0は、Peaks.jsによる波形表示、セグメントラベリング、キーボードショートカットを備えた音声アノテーションに対応しています。

再生コントロールとラベルコントロールの上に表示された、3つのラベル付きセグメント(音声、音楽、音声)を持つオーディオ波形波形上に描いたセグメントに、ツールバーからラベルを付けます

ユースケース

  • 音声の書き起こしとレビュー
  • 話者ダイアライゼーション
  • 音楽分析
  • 音声イベント検出
  • 音声からの感情認識
  • コールセンター品質保証

音声サポートの有効化

音声タスクは、annotation_schemes の中の audio_annotation スキームです。スキームは、item_properties.text_key が指定するフィールドから音声のURLを読むため、メディア用の別のキーは必要ありません。

yaml
annotation_schemes:
  - annotation_type: audio_annotation
    name: audio_segments
    description: "Segment and label the audio"
    labels:
      - Speech
      - Music
      - Silence
      - Noise

動作モード

Potatoは3つの音声アノテーションモードをサポートしています。

ラベルモード

音声をセグメント化し、各セグメントにカテゴリラベルを割り当てます。

yaml
annotation_schemes:
  - annotation_type: audio_annotation
    name: speaker_diarization
    mode: label
    description: "Identify speakers in the audio"
    labels:
      - Speaker A
      - Speaker B
      - Overlap

質問モード

各セグメントは、単一のラベルではなく、専用の質問のセットを持ちます。アノテーターは領域をマークして選択し、Segment Detailsパネルで質問に答えます。このモードでは segment_schemes が必須で、各エントリは、セグメントごとに描画される通常のアノテーションスキームです。

yaml
annotation_schemes:
  - annotation_type: audio_annotation
    name: speech_quality
    mode: questions
    description: "Evaluate speech segments"
    segment_schemes:
      - annotation_type: radio
        name: speaker_type
        description: "Who is speaking?"
        labels: ["host", "guest", "unknown"]
      - annotation_type: likert
        name: clarity
        description: "How clear is this segment?"
        size: 5
        min_label: "Unintelligible"
        max_label: "Perfectly clear"

両方モード

ラベリングとセグメントごとの質問を組み合わせます。このモードでは、labels と segment_schemes の両方が必要です。

yaml
annotation_schemes:
  - annotation_type: audio_annotation
    name: full_analysis
    mode: both
    description: "Label and analyze audio segments"
    labels:
      - Speech
      - Music
      - Noise
    segment_schemes:
      - annotation_type: radio
        name: foreground
        description: "Is this the foreground audio?"
        labels: ["Yes", "No"]

回答は、アイテムではなくセグメントに付き、サブスキームの name をキーにします。セグメントの質問を前提に設計する前に、知っておくべき制限が2つあります。セグメントのフィールドは、セグメントを選択している間しか存在しないため、セグメント内ではキーバインドが割り当てられません。また、label_requirement はサブスキームでは強制されません。セグメントを必須にするには min_segments を使い、完全性は分析の段階で確認してください。

設定オプション

基本設定

yaml
annotation_schemes:
  - annotation_type: audio_annotation
    name: segments
    description: "Create audio segments"
    labels:
      - Label A
      - Label B
 
    # Optional constraints
    min_segments: 1
    max_segments: 50

キーボードショートカット

ラベルは、数字キー1-9で割り当てられます。

yaml
annotation_schemes:
  - annotation_type: audio_annotation
    name: speakers
    description: "Mark each speaker turn"
    labels:
      - Speaker A  # Press 1
      - Speaker B  # Press 2
      - Overlap    # Press 3

ラベルカラー

セグメントの色をカスタマイズします。

yaml
annotation_schemes:
  - annotation_type: audio_annotation
    name: segments
    description: "Segment the recording and label each region"
    labels:
      - name: Speech
        color: "#22C55E"
      - name: Music
        color: "#3B82F6"
      - name: Silence
        color: "#9CA3AF"

波形のパフォーマンス

長い音声ファイルで最適なパフォーマンスを得るには、BBCのaudiowaveformツールをインストールしてください。

bash
# macOS
brew install audiowaveform
 
# Ubuntu/Debian
sudo apt-get install audiowaveform
 
# Or build from source
# https://github.com/bbc/audiowaveform

audiowaveform をインストールすると、Potatoはサーバーで波形を事前計算します。インストールしていない場合は、ブラウザが波形を生成します。これは30分未満のファイルで機能します。

波形キャッシュ

サーバー側の波形は、キャッシュする価値があります。1時間の録音の波形を計算するには数秒かかり、アノテーターはページを読み込むたびにそのコストを払うためです。キャッシュは、トップレベルの audio_annotation ブロックで制御します。

yaml
audio_annotation:
  waveform_cache_dir: waveform_cache/     # Where pre-computed waveforms are stored
  waveform_look_ahead: 3                  # Pre-compute the next N instances
  waveform_cache_max_size: 50             # Maximum cached waveform files
  client_fallback_max_duration: 1800      # Longest file the browser will render, in seconds

Potatoがこのブロックを読むのは、タスクに audio_annotation スキームが実際にある場合だけです。

データ形式

シンプルな音声参照

json
[
  {"id": "1", "audio_path": "audio/recording_001.wav"},
  {"id": "2", "audio_path": "audio/recording_002.wav"}
]
yaml
data_files:
  - "data/audio_data.json"
 
item_properties:
  id_key: id
  text_key: audio_path   # The field holding the audio URL

書き起こし付き

json
[
  {
    "id": "1",
    "audio_path": "audio/call_001.wav",
    "transcript": "Hello, how can I help you today?"
  }
]

このような単純な文字列は、書き起こしを文脈として波形の横に表示します。書き起こしにタイミングが付いている場合(Whisper、クラウドASRのAPI、字幕ファイルなど)は、代わりにそのファイルを渡すと、Potatoは各ターンを、音声と同期した話者の吹き出しとして描画します。

json
[
  {
    "id": "1",
    "conversation": {"audio": "audio/call_001.wav",
                     "transcript": "audio/call_001.srt"}
  }
]

21種類のトランスクリプトと字幕の形式が、拡張子ではなく内容から判別されます。トランスクリプトの形式を参照してください。

出力形式

タイムラインの回答は、1つの値にまとめてシリアライズされます。そのため、スキームの labels の下のエントリは、_data キーを1つだけ持ち、その値はJSON文字列です。セグメントの時刻は start_time と end_time で、segment_schemes からのセグメントごとの回答は annotations の下に入ります。

json
{
  "instance_id": "audio_1",
  "user_id": "annotator1",
  "labels": {
    "speaker_turns": {
      "_data": "{\"segments\": [{\"id\": \"seg_1\", \"start_time\": 0.0, \"end_time\": 2.5, \"label\": \"Speaker A\", \"annotations\": {\"clarity\": \"4\"}}, {\"id\": \"seg_2\", \"start_time\": 2.5, \"end_time\": 5.2, \"label\": \"Speaker B\", \"annotations\": {}}]}"
    }
  },
  "spans": {},
  "links": {}
}

パースすると、その _data 文字列は次のようになります。

json
{
  "segments": [
    {
      "id": "seg_1",
      "start_time": 0.0,
      "end_time": 2.5,
      "label": "Speaker A",
      "annotations": {"clarity": "4"}
    },
    {
      "id": "seg_2",
      "start_time": 2.5,
      "end_time": 5.2,
      "label": "Speaker B",
      "annotations": {}
    }
  ]
}

動画アノテーションも、同じ方法でシリアライズされます。キーが1つだけの形のため、2人のアノテーターを比較するサブシステムは、server_utils/annotation_values.py のリーダーを通さない限り、_data と _data を比較することになります。

キーボードショートカット

Potatoは、効率的なアノテーションのためのキーボードショートカットを提供します。

ショートカットアクション
Space再生/一時停止
[現在位置にセグメント開始を設定
]現在位置にセグメント終了を設定
1-9現在のセグメントにラベルを割り当て
Delete現在のセグメントを削除
Left Arrow5秒戻る
Right Arrow5秒進む
Up Arrowズームイン
Down Arrowズームアウト
Home先頭に移動
End末尾に移動
+再生速度を上げる
-再生速度を下げる

設定例

話者ダイアライゼーション

yaml
annotation_task_name: "Speaker Diarization"
task_dir: "."
port: 8000
 
data_files:
  - "data/recordings.json"
 
item_properties:
  id_key: id
  text_key: audio_path
 
annotation_schemes:
  - annotation_type: audio_annotation
    name: speakers
    mode: label
    description: "Identify who is speaking"
    labels:
      - Speaker 1
      - Speaker 2
      - Speaker 3
      - Overlap
      - Silence
    min_segments: 1
 
# Diarization recordings run long, so precompute a few ahead of the annotator.
audio_annotation:
  waveform_cache_dir: waveform_cache/
  waveform_look_ahead: 5
 
output_annotation_dir: "output/"
export_annotation_format: jsonl
 
user_config:
  allow_all_users: true

書き起こしレビュー

yaml
annotation_task_name: "Transcription Quality Review"
task_dir: "."
port: 8000
 
data_files:
  - "data/transcripts.json"
 
item_properties:
  id_key: id
  text_key: audio_path
 
annotation_schemes:
  - annotation_type: audio_annotation
    name: errors
    mode: questions
    description: "Mark transcription errors"
    # Questions mode collects answers per marked region, so the error type and
    # the correction stay attached to the stretch of audio they describe.
    segment_schemes:
      - annotation_type: radio
        name: error_type
        description: "What kind of error is this?"
        labels: ["Substitution", "Deletion", "Insertion", "Speaker mix-up"]
      - annotation_type: text
        name: correction
        description: "What should the transcript say?"
 
  - annotation_type: radio
    name: overall_accuracy
    description: "Overall transcript accuracy"
    labels:
      - Accurate
      - Minor errors
      - Major errors
      - Unusable
 
output_annotation_dir: "output/"
export_annotation_format: jsonl

上の設定は、書き起こしを波形と照らして、セグメントごとにレビューします。書き起こしがASRパイプラインから出たもので、すでにタイミングを持っている場合は、speech_transcript スキームのほうが適しています。Whisper、Deepgram、AssemblyAI、SRT、WebVTTなどのタイミング付きの形式を直接読み込み、エラータグと修正ボックスを備えたセグメントカードをアノテーターに提供します。トランスクリプトの形式とWhisperのトランスクリプトにアノテーションするを参照してください。

コールセンターQA

yaml
annotation_task_name: "Call Center Quality Assurance"
task_dir: "."
port: 8000
 
data_files:
  - "data/calls.json"
 
item_properties:
  id_key: call_id
  text_key: recording_path
 
annotation_schemes:
  # Segment-level annotation
  - annotation_type: audio_annotation
    name: conversation
    mode: both
    description: "Segment the conversation"
    labels:
      - Agent
      - Customer
      - Hold
      - Silence
    # Who is speaking is a label; how the turn went is a question about it.
    segment_schemes:
      - annotation_type: radio
        name: tone
        description: "Tone of this turn"
        labels: ["Calm", "Neutral", "Escalated"]
 
  # Call-level assessment
  - annotation_type: likert
    name: professionalism
    description: "Agent professionalism"
    size: 5
    min_label: "Poor"
    max_label: "Excellent"
 
  - annotation_type: likert
    name: resolution
    description: "Issue resolution"
    size: 5
    min_label: "Unresolved"
    max_label: "Fully resolved"
 
  - annotation_type: multiselect
    name: issues
    description: "Select any issues observed"
    labels:
      - Long hold time
      - Agent interrupted
      - Incorrect information
      - Missing greeting
      - Unprofessional language
 
  - annotation_type: text
    name: notes
    description: "Additional observations"
    rows: 4
 
output_annotation_dir: "output/"
export_annotation_format: jsonl

サポートされる音声形式

  • WAV(最高品質のため推奨)
  • MP3
  • OGG
  • FLAC
  • M4A
  • WebM

パフォーマンスのヒント

  1. audiowaveformをインストールする - サーバー側の波形が、1時間に及ぶファイルを使える状態に保ちます
  2. キャッシュを有効にする - waveform_cache_dir を設定して、事前生成した波形を保存します
  3. 品質にはWAVを使用する - 圧縮形式は、アーティファクトを導入する可能性があります
  4. 音声を前処理する - レベルを正規化し、不要な無音をトリミングします
  5. ファイルサイズに注意する - 大きなファイルは読み込みを遅くします
  6. 先読みを使う - waveform_look_ahead を上げて、アノテーターが到達する前に次のインスタンスの準備ができているようにします

トラブルシューティング

波形が読み込まれない

  • 音声ファイルのパスが正しいか確認する
  • ファイル形式がサポートされているか確認する
  • 長いファイルにはaudiowaveformをインストールする
  • ブラウザコンソールでエラーを確認する

パフォーマンスが遅い

  • audiowaveformツールをインストールする
  • waveform_cache_dir で波形キャッシュを有効にする
  • 音声ファイルサイズを縮小する
  • waveform_look_ahead を上げて、後続のインスタンスを事前計算する

セグメントが保存されない

  • 出力ディレクトリが書き込み可能であることを確認する
  • アノテーション形式の設定を確認する
  • セグメントに開始時間と終了時間の両方があることを確認する