Diarization v2: Fenster-Clustering mit gelernter Schwelle + Live-Namensmarker

#74 (22 Teilnehmer) ergab automatisch 44 Sprecher, dieselbe Stimme mehrfach.
Ursache gemessen: ein Zentroid pro sherpa-Cluster aus max. 3 Schnitten, fester
Kosinus auf rohen Embeddings (Kreuz-Turn-Kosinus ~0,4 = keine Trennschaerfe).

v2: sherpa liefert nur Turn-Grenzen, Identitaet aus 3-s-Fenster-Embeddings,
Mittelwert-Zentrierung, Average-Linkage-AHC, Weak-Fold, Schwelle pro Aufnahme
per 2-Gauss-EM gelernt. Validiert: #74 44->20, #70 ->4, #68 ->2.

Live-Namensmarker: Namen waehrend der Aufnahme tippen; Zeitstempel benennt
spaeter den Cluster und dient als must-/cannot-link-Zwangsbedingung.
This commit is contained in:
Claude
2026-07-27 17:00:45 +02:00
parent 432c4b14dd
commit 48fa6b4f9e
17 changed files with 1357 additions and 67 deletions
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
# Lab: dump RAW sherpa diarization turns for a recording, at maximum temporal
# granularity (min-duration-off=0 -> no adjacent-same-label merging, small
# cluster threshold -> fine labels). We only reuse the TURN BOUNDARIES; the
# labels get thrown away and re-clustered offline by cluster-lab.js.
# Usage: lab-dump-segs.sh <wav> <out.txt> [cluster-threshold]
DIR=/opt/sherpa/sherpa-onnx-v1.13.3-linux-aarch64-shared-cpu
BIN=$DIR/bin/sherpa-onnx-offline-speaker-diarization
SEG=/opt/sherpa/sherpa-onnx-pyannote-segmentation-3-0/model.onnx
EMB=${EMB:-/opt/sherpa/nemo_titanet_small.onnx}
WAV="$1"; OUT="$2"; THR="${3:-0.2}"
/opt/callrec/aime-cpucap.sh 1608000
export LD_LIBRARY_PATH=$DIR/lib
echo "start $(date -Is)" > "$OUT.log"
taskset -c 4-7 "$BIN" \
--segmentation.pyannote-model=$SEG --segmentation.num-threads=4 \
--embedding.model=$EMB --embedding.num-threads=4 \
--clustering.cluster-threshold=$THR \
--min-duration-on=0.2 --min-duration-off=0.0 \
"$WAV" > "$OUT" 2>> "$OUT.log"
echo "end $(date -Is) rc=$?" >> "$OUT.log"
/opt/callrec/aime-cpucap.sh 2256000
grep -c 'speaker_' "$OUT" >> "$OUT.log"