Zum Inhalt springen

Audio-Annotation

Wellenformbasierte Audio-Annotation in Potato konfigurieren. Interaktive Wiedergabesteuerung anzeigen, Zeitmarken setzen und mit Radio-, Likert- oder Textschemata kombinieren.

Potato 2.0 unterstützt Audio-Annotation mit Wellenformvisualisierung auf Basis von Peaks.js, Segment-Beschriftung und Tastaturkürzeln.

Audio-Wellenform mit drei beschrifteten Segmenten (Sprache, Musik, Sprache) über den Wiedergabe- und Label-BedienelementenIn der Wellenform gezeichnete Segmente, die in der Werkzeugleiste beschriftet werden

Anwendungsfälle

  • Sprachtranskription und -überprüfung
  • Sprecherdiarisierung
  • Musikanalyse
  • Audioereigniserkennung
  • Emotionserkennung in Sprache
  • Qualitätssicherung im Call-Center

Audio-Unterstützung aktivieren

Eine Audioaufgabe ist ein Schema audio_annotation in annotation_schemes. Das Schema liest die Audio-URL aus dem Feld, das item_properties.text_key benennt. Ein separater Medienschlüssel ist daher nicht nötig:

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

Betriebsmodi

Potato unterstützt drei Modi der Audio-Annotation:

Label-Modus

Audio segmentieren und jedem Segment ein Kategorielabel zuweisen:

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

Fragen-Modus

Jedes Segment erhält statt eines einzelnen Labels einen eigenen Fragensatz. Der Annotator markiert eine Region, wählt sie aus und beantwortet die Fragen im Bereich Segment Details. In diesem Modus ist segment_schemes erforderlich, und jeder Eintrag ist ein gewöhnliches Annotationsschema, das pro Segment gerendert wird:

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"

Kombinierter Modus

Labeln und Fragen pro Segment werden kombiniert. Dieser Modus verlangt labels und segment_schemes gemeinsam:

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"]

Die Antworten werden am Segment gespeichert und nicht am Item, und zwar unter dem name des Teilschemas. Zwei Einschränkungen sollten Sie kennen, bevor Sie um Segmentfragen herum planen. Innerhalb eines Segments sind keine Tastenbelegungen gebunden, weil die Felder eines Segments nur existieren, solange es ausgewählt ist, und label_requirement wird bei einem Teilschema nicht erzwungen. Verwenden Sie min_segments, um Segmente zu verlangen, und prüfen Sie die Vollständigkeit in der Auswertung.

Konfigurationsoptionen

Grundeinrichtung

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

Tastaturkürzel

Labels können mit den Zifferntasten 1-9 zugewiesen werden:

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

Label-Farben

Segmentfarben anpassen:

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"

Wellenformleistung

Für optimale Leistung bei langen Audiodateien installieren Sie das Tool audiowaveform der BBC:

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

Ist audiowaveform installiert, berechnet Potato Wellenformen vorab auf dem Server. Ohne das Tool erzeugt der Browser sie, was bei Dateien unter 30 Minuten funktioniert.

Wellenform-Caching

Wellenformen auf dem Server lohnen sich im Cache, weil die Berechnung für eine einstündige Aufnahme Sekunden kostet und Annotatoren diese Kosten bei jedem Seitenaufruf tragen. Der audio_annotation-Block auf oberster Ebene steuert den Cache:

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 liest den Block nur, wenn die Aufgabe tatsächlich ein Schema audio_annotation enthält.

Datenformat

Einfache Audio-Referenz

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

Mit Transkripten

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

Ein flacher String wie dieser zeigt das Transkript als Kontext neben der Wellenform. Wenn Ihr Transkript Zeitangaben enthält, etwa von Whisper, einer Cloud-ASR-API oder einer Untertiteldatei, übergeben Sie stattdessen die Datei selbst. Potato rendert die Turns dann als Sprechblasen, die mit dem Audio synchronisiert sind:

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

21 Transkript- und Untertitelformate werden am Inhalt erkannt und nicht an der Dateiendung. Siehe Transkriptformate.

Ausgabeformat

Eine Timeline-Antwort wird als Ganzes in einen einzigen Wert serialisiert. Der Eintrag des Schemas unter labels enthält daher genau einen Schlüssel _data, dessen Wert ein JSON-String ist. Die Segmentzeiten heißen start_time und end_time, und die Antworten pro Segment aus segment_schemes stehen unter 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": {}
}

Geparst ist dieser _data-String:

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": {}
    }
  ]
}

Die Video-Annotation wird auf dieselbe Weise serialisiert. Wegen dieser Form mit einem einzigen Schlüssel sieht ein Subsystem, das zwei Annotatoren vergleicht, _data gegen _data, es sei denn, es greift über den Reader in server_utils/annotation_values.py zu.

Tastaturkürzel

Potato bietet Tastaturkürzel für effizientes Annotieren:

KürzelAktion
SpaceWiedergabe/Pause
[Segmentstart an der aktuellen Position setzen
]Segmentende an der aktuellen Position setzen
1-9Dem aktuellen Segment ein Label zuweisen
DeleteAktuelles Segment entfernen
Left Arrow5 Sekunden zurückspringen
Right Arrow5 Sekunden vorspringen
Up ArrowHineinzoomen
Down ArrowHerauszoomen
HomeZum Anfang springen
EndZum Ende springen
+Wiedergabegeschwindigkeit erhöhen
-Wiedergabegeschwindigkeit verringern

Beispielkonfigurationen

Sprecherdiarisierung

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

Transkriptionsüberprüfung

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

Die obige Konfiguration prüft ein Transkript Segment für Segment gegen die Wellenform. Stammt das Transkript aus einer ASR-Pipeline und enthält bereits Zeitangaben, passt das Schema speech_transcript besser. Es liest Whisper, Deepgram, AssemblyAI, SRT, WebVTT und andere Formate mit Zeitangaben direkt und gibt Annotatoren Segmentkarten mit Fehlertags und einem Korrekturfeld. Siehe Transkriptformate und Whisper-Transkripte annotieren.

Call-Center-Qualitätssicherung

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

Unterstützte Audioformate

  • WAV (empfohlen für beste Qualität)
  • MP3
  • OGG
  • FLAC
  • M4A
  • WebM

Leistungstipps

  1. Audiowaveform installieren - Wellenformen auf dem Server halten stundenlange Dateien nutzbar
  2. Caching aktivieren - waveform_cache_dir setzen, um vorab erzeugte Wellenformen zu speichern
  3. WAV für Qualität nutzen - Komprimierte Formate können Artefakte erzeugen
  4. Audio vorverarbeiten - Pegel normalisieren, unnötige Stille entfernen
  5. Dateigrößen beachten - Große Dateien verlangsamen das Laden
  6. Vorausberechnen - waveform_look_ahead erhöhen, damit die nächsten Instanzen bereit sind, bevor der Annotator sie erreicht

Fehlerbehebung

Wellenform lädt nicht

  • Prüfen, ob der Audio-Dateipfad stimmt
  • Sicherstellen, dass das Dateiformat unterstützt wird
  • Audiowaveform für lange Dateien installieren
  • Browser-Konsole auf Fehler prüfen

Langsame Leistung

  • Das Tool audiowaveform installieren
  • Wellenform-Caching mit waveform_cache_dir aktivieren
  • Audiodateigrößen reduzieren
  • waveform_look_ahead erhöhen, um kommende Instanzen vorab zu berechnen

Segmente werden nicht gespeichert

  • Sicherstellen, dass das Ausgabeverzeichnis beschreibbar ist
  • Konfiguration des Annotationsformats prüfen
  • Sicherstellen, dass das Segment sowohl Start- als auch Endzeit hat