Spectra456/passive-active-sv-testing-protocl

0

stars

2

commits

Python

primary language

Aug 10, 2025

updated

README

Passive–Active Speaker Verification: Testing Protocols

A lightweight toolkit for running passive and active speaker‑verification (SV) experiments and evaluating them with standard metrics (EER, minDCF). Utilities are included for signal‑quality features (SNR/C50) and basic VAD to help you control test conditions.


Why this exists

Reproducible SV evaluation depends on how you probe the system:

  • Passive testing: score pre‑recorded trials with no interaction.
  • Active testing: interactively collect or select trials (e.g., prompt for targeted phrases, re‑tries under different SNRs) before scoring.

This repo provides both flows so you can compare protocols under the same codebase and metrics.


Features

  • 🔁 Two protocols: passive.py and active.py pipelines.
  • 🎯 Verification utilities: scoring helpers in verification.py.
  • 📉 Metrics: Equal Error Rate (EER) via compute_EER.py, minimum DCF via compute_min_dcf.py.
  • 🔊 Signal helpers: SNR/C50 computation + simple VAD in snr_c50_vad.py.

Installation

This is a plain‑Python repo. Create an environment and install common audio/ML deps:

python -m venv .venv && source .venv/bin/activate   # or .venv\Scripts\activate on Windows
pip install numpy scipy scikit-learn librosa soundfile tqdm matplotlib

Tip: run python <script>.py -h to see the exact CLI flags each script supports.


Data layout (example)

You can use any SV dataset with enrollment and test utterances (e.g., VoxCeleb, in‑house data). A minimal structure:

data/
  enroll/
    spk1/ utt1.wav, utt2.wav ...
    spk2/ ...
  test/
    spk1/ xxxxx.wav
    spk3/ ...

Prepare a trials file mapping enrollment ↔ test pairs if your protocol requires it (format up to your script arguments).


Quickstart

1) Passive protocol

python passive.py \
  --enroll-dir data/enroll \
  --test-dir data/test \
  --trials trials.tsv \
  --out runs/passive/scores.tsv

2) Active protocol

Collect/curate trials interactively or by rule before scoring.

python active.py \
  --enroll-dir data/enroll \
  --test-dir data/test \
  --strategy prompt \
  --out runs/active/scores.tsv

Evaluate

Compute EER:

python compute_EER.py --scores runs/passive/scores.tsv --out runs/passive/eer.txt

Compute minDCF (set target prior & costs as needed):

python compute_min_dcf.py \
  --scores runs/passive/scores.tsv \
  --p-target 0.01 --c-miss 1 --c-fa 1 \
  --out runs/passive/min_dcf.txt

Signal quality & VAD (optional)

Estimate SNR / C50 and run a simple VAD to filter frames:

python snr_c50_vad.py --in data/test --out features/test_quality.json

Reproducibility

  • Set seeds (if the scripts expose --seed).
  • Fix sample rate (e.g., 16 kHz) and channel layout (mono).
  • Log exact CLI invocations to runs/<...>/args.json.

Results (template)

ProtocolEER (%)minDCF@p=0.01Notes
Passivebaseline
Activeprompt‑then‑retry

Contributors

Spectra456

2 commits

Spectra456/passive-active-sv-testing-protocl

0

stars

2

commits

Python

primary language

Aug 10, 2025

updated

README

Passive–Active Speaker Verification: Testing Protocols

A lightweight toolkit for running passive and active speaker‑verification (SV) experiments and evaluating them with standard metrics (EER, minDCF). Utilities are included for signal‑quality features (SNR/C50) and basic VAD to help you control test conditions.


Why this exists

Reproducible SV evaluation depends on how you probe the system:

  • Passive testing: score pre‑recorded trials with no interaction.
  • Active testing: interactively collect or select trials (e.g., prompt for targeted phrases, re‑tries under different SNRs) before scoring.

This repo provides both flows so you can compare protocols under the same codebase and metrics.


Features

  • 🔁 Two protocols: passive.py and active.py pipelines.
  • 🎯 Verification utilities: scoring helpers in verification.py.
  • 📉 Metrics: Equal Error Rate (EER) via compute_EER.py, minimum DCF via compute_min_dcf.py.
  • 🔊 Signal helpers: SNR/C50 computation + simple VAD in snr_c50_vad.py.

Installation

This is a plain‑Python repo. Create an environment and install common audio/ML deps:

python -m venv .venv && source .venv/bin/activate   # or .venv\Scripts\activate on Windows
pip install numpy scipy scikit-learn librosa soundfile tqdm matplotlib

Tip: run python <script>.py -h to see the exact CLI flags each script supports.


Data layout (example)

You can use any SV dataset with enrollment and test utterances (e.g., VoxCeleb, in‑house data). A minimal structure:

data/
  enroll/
    spk1/ utt1.wav, utt2.wav ...
    spk2/ ...
  test/
    spk1/ xxxxx.wav
    spk3/ ...

Prepare a trials file mapping enrollment ↔ test pairs if your protocol requires it (format up to your script arguments).


Quickstart

1) Passive protocol

python passive.py \
  --enroll-dir data/enroll \
  --test-dir data/test \
  --trials trials.tsv \
  --out runs/passive/scores.tsv

2) Active protocol

Collect/curate trials interactively or by rule before scoring.

python active.py \
  --enroll-dir data/enroll \
  --test-dir data/test \
  --strategy prompt \
  --out runs/active/scores.tsv

Evaluate

Compute EER:

python compute_EER.py --scores runs/passive/scores.tsv --out runs/passive/eer.txt

Compute minDCF (set target prior & costs as needed):

python compute_min_dcf.py \
  --scores runs/passive/scores.tsv \
  --p-target 0.01 --c-miss 1 --c-fa 1 \
  --out runs/passive/min_dcf.txt

Signal quality & VAD (optional)

Estimate SNR / C50 and run a simple VAD to filter frames:

python snr_c50_vad.py --in data/test --out features/test_quality.json

Reproducibility

  • Set seeds (if the scripts expose --seed).
  • Fix sample rate (e.g., 16 kHz) and channel layout (mono).
  • Log exact CLI invocations to runs/<...>/args.json.

Results (template)

ProtocolEER (%)minDCF@p=0.01Notes
Passivebaseline
Activeprompt‑then‑retry

Contributors

Spectra456

2 commits

Languages

Python

100.0%