Darlig/3d-speaker

0

stars

311

commits

Python

primary language

Aug 13, 2026

updated

README



license

3D-Speaker is an open-source toolkit for single- and multi-modal speaker verification, speaker recognition, and speaker diarization. All pretrained models are accessible on ModelScope. Furthermore, we present a large-scale speech corpus also called 3D-Speaker-Dataset to facilitate the research of speech representation disentanglement.

GitHub Repo stars Please support our community by starring it 感谢大家支持

Benchmark

The EER results on VoxCeleb, CNCeleb and 3D-Speaker datasets for fully-supervised speaker verification.

ModelParamsVoxCeleb1-OCNCeleb3D-Speaker
Res2Net4.03 M1.56%7.96%8.03%
ResNet346.34 M1.05%6.92%7.29%
ECAPA-TDNN20.8 M0.86%8.01%8.87%
ERes2Net-base6.61 M0.84%6.69%7.21%
CAM++7.2 M0.65%6.78%7.75%
ERes2NetV217.8M0.61%6.14%6.52%
ERes2Net-large22.46 M0.52%6.17%6.34%

The DER results on public and internal multi-speaker datasets for speaker diarization.

Test3D-Speakerpyannote.audioDiariZen_WavLM
Aishell-410.30%12.2%11.7%
Alimeeting19.73%24.4%17.6%
AMI_SDM21.76%22.4%15.4%
VoxConverse11.75%11.3%28.39%
Meeting-CN_ZH-118.91%22.37%32.66%
Meeting-CN_ZH-212.78%17.86%18%

Quickstart

Install 3D-Speaker

git clone https://github.com/modelscope/3D-Speaker.git && cd 3D-Speaker
conda create -n 3D-Speaker python=3.8
conda activate 3D-Speaker
pip install -r requirements.txt

Running experiments

# Speaker verification: ERes2NetV2 on 3D-Speaker dataset
cd egs/3dspeaker/sv-eres2netv2/
bash run.sh
# Speaker verification: CAM++ on 3D-Speaker dataset
cd egs/3dspeaker/sv-cam++/
bash run.sh
# Speaker verification: ECAPA-TDNN on 3D-Speaker dataset
cd egs/3dspeaker/sv-ecapa/
bash run.sh
# Self-supervised speaker verification: SDPN on VoxCeleb dataset
cd egs/voxceleb/sv-sdpn/
bash run.sh
# Audio and multimodal Speaker diarization:
cd egs/3dspeaker/speaker-diarization/
bash run_audio.sh
bash run_video.sh
# Language identification
cd egs/3dspeaker/language-idenitfication
bash run.sh

Inference using pretrained models from Modelscope

All pretrained models are released on Modelscope.

# Install modelscope
pip install modelscope
# ERes2Net trained on 200k labeled speakers
model_id=iic/speech_eres2net_sv_zh-cn_16k-common
# ERes2NetV2 trained on 200k labeled speakers
model_id=iic/speech_eres2netv2_sv_zh-cn_16k-common
# CAM++ trained on 200k labeled speakers
model_id=iic/speech_campplus_sv_zh-cn_16k-common
# Run CAM++ or ERes2Net inference
python speakerlab/bin/infer_sv.py --model_id $model_id
# Run batch inference
python speakerlab/bin/infer_sv_batch.py --model_id $model_id --wavs $wav_list

# SDPN trained on VoxCeleb
model_id=iic/speech_sdpn_ecapa_tdnn_sv_en_voxceleb_16k
# Run SDPN inference
python speakerlab/bin/infer_sv_ssl.py --model_id $model_id

# Run diarization inference
python speakerlab/bin/infer_diarization.py --wav [wav_list OR wav_path] --out_dir $out_dir
# Enable overlap detection
python speakerlab/bin/infer_diarization.py --wav [wav_list OR wav_path] --out_dir $out_dir --include_overlap --hf_access_token $hf_access_token

DiariZen segmentation frontends

The unified environment keeps the original 3D-Speaker VAD, CAM++ speaker embeddings, spectral clustering, and local-speaker alignment. Only the SincNet/BiLSTM segmentation frontend is replaceable:

BackendRoleModel
pyannote-3.0Original overlap baselinepyannote/segmentation-3.0
diarizen-large-s80-v2Scheme 1WavLM-Large/Conformer, up to 4 speakers per frame
diarizen-base-s80Scheme 2WavLM-Base/Conformer, up to 2 speakers per frame

Create and activate the isolated environment:

conda env create -f environment.yaml
conda activate 3dspeaker-diarizen

Run either DiariZen scheme (the models are public and do not require the gated pyannote token):

# Scheme 1: higher-capacity Large-s80-v2
python speakerlab/bin/infer_diarization.py \
  --wav input.wav --out_dir output \
  --segmentation_backend diarizen-large-s80-v2

# Scheme 2: faster Base-s80
python speakerlab/bin/infer_diarization.py \
  --wav input.wav --out_dir output \
  --segmentation_backend diarizen-base-s80

Use --model_cache_dir to share the ModelScope and Hugging Face cache. --segmentation_batch_size and --segmentation_step override the official defaults when memory or latency tuning is needed. The legacy --include_overlap flag still selects pyannote-3.0 and must not be combined with --segmentation_backend.

Streaming diarization

An independent stateful pipeline reuses the same CAM++ and pyannote segmentation-3.0 models while keeping the offline API and CLI unchanged. The default mode uses a 10 s model window, advances every 1 s, and emits immutable results with a 2 s fixed-lag aggregation policy:

python speakerlab/bin/infer_diarization_streaming.py \
  --wav input_16k_mono.wav \
  --out_dir streaming_output \
  --hf_access_token "$HF_TOKEN"

The command simulates incoming audio with 100 ms chunks, prints each newly committed segment as a JSON line, and writes merged RTTM (or JSON) plus timing, RTF, configuration, and speaker-count metadata. It waits for the first 10 s window before producing output. Input must be mono 16 kHz, and numeric speaker IDs are stable only within one streaming session. See the streaming diarization guide for the Python API, lifecycle, thresholds, and latency semantics.

This integration does not use DiariZen's WeSpeaker embeddings, VBx clustering, or complete pipeline. DiariZen pretrained weights are licensed CC BY-NC 4.0 and are intended for non-commercial research use.

Review diarization results in a browser

After batch inference, start the read-only subjective review tool:

python speakerlab/bin/serve_diarization_web.py

It automatically indexes inference_outputs, streams the original WAV files without modifying them, and supports waveform navigation, custom interval playback, continuous playback of one predicted speaker, and same-lane prediction/GT comparison with global speaker matching. See the diarization web viewer guide for intranet access and moved-path configuration.

Overview of Content

What‘s new :fire:

Contact

If you have any comment or question about 3D-Speaker, please contact us by

  • email: {yfchen97, wanghuii}@mail.ustc.edu.cn, {dengchong.d, zsq174630, shuli.cly}@alibaba-inc.com

License

3D-Speaker is released under the Apache License 2.0.

Acknowledge

3D-Speaker contains third-party components and code modified from some open-source repos, including:
Speechbrain, Wespeaker, D-TDNN, DINO, Vicreg, TalkNet-ASD , Ultra-Light-Fast-Generic-Face-Detector-1MB, pyannote.audio

Citations

If you find this repository useful, please consider giving a star :star: and citation :t-rex::

@article{chen20243d,
  title={3D-Speaker-Toolkit: An Open Source Toolkit for Multi-modal Speaker Verification and Diarization},
  author={Chen, Yafeng and Zheng, Siqi and Wang, Hui and Cheng, Luyao and others},
  booktitle={ICASSP},
  year={2025}
}

Contributors

yfchenlucky

144 commits

yfchenmodelscope

105 commits

wanghuii1

32 commits

GeekOrangeLuYao

21 commits

Darlig/3d-speaker

0

stars

311

commits

Python

primary language

Aug 13, 2026

updated

README



license

3D-Speaker is an open-source toolkit for single- and multi-modal speaker verification, speaker recognition, and speaker diarization. All pretrained models are accessible on ModelScope. Furthermore, we present a large-scale speech corpus also called 3D-Speaker-Dataset to facilitate the research of speech representation disentanglement.

GitHub Repo stars Please support our community by starring it 感谢大家支持

Benchmark

The EER results on VoxCeleb, CNCeleb and 3D-Speaker datasets for fully-supervised speaker verification.

ModelParamsVoxCeleb1-OCNCeleb3D-Speaker
Res2Net4.03 M1.56%7.96%8.03%
ResNet346.34 M1.05%6.92%7.29%
ECAPA-TDNN20.8 M0.86%8.01%8.87%
ERes2Net-base6.61 M0.84%6.69%7.21%
CAM++7.2 M0.65%6.78%7.75%
ERes2NetV217.8M0.61%6.14%6.52%
ERes2Net-large22.46 M0.52%6.17%6.34%

The DER results on public and internal multi-speaker datasets for speaker diarization.

Test3D-Speakerpyannote.audioDiariZen_WavLM
Aishell-410.30%12.2%11.7%
Alimeeting19.73%24.4%17.6%
AMI_SDM21.76%22.4%15.4%
VoxConverse11.75%11.3%28.39%
Meeting-CN_ZH-118.91%22.37%32.66%
Meeting-CN_ZH-212.78%17.86%18%

Quickstart

Install 3D-Speaker

git clone https://github.com/modelscope/3D-Speaker.git && cd 3D-Speaker
conda create -n 3D-Speaker python=3.8
conda activate 3D-Speaker
pip install -r requirements.txt

Running experiments

# Speaker verification: ERes2NetV2 on 3D-Speaker dataset
cd egs/3dspeaker/sv-eres2netv2/
bash run.sh
# Speaker verification: CAM++ on 3D-Speaker dataset
cd egs/3dspeaker/sv-cam++/
bash run.sh
# Speaker verification: ECAPA-TDNN on 3D-Speaker dataset
cd egs/3dspeaker/sv-ecapa/
bash run.sh
# Self-supervised speaker verification: SDPN on VoxCeleb dataset
cd egs/voxceleb/sv-sdpn/
bash run.sh
# Audio and multimodal Speaker diarization:
cd egs/3dspeaker/speaker-diarization/
bash run_audio.sh
bash run_video.sh
# Language identification
cd egs/3dspeaker/language-idenitfication
bash run.sh

Inference using pretrained models from Modelscope

All pretrained models are released on Modelscope.

# Install modelscope
pip install modelscope
# ERes2Net trained on 200k labeled speakers
model_id=iic/speech_eres2net_sv_zh-cn_16k-common
# ERes2NetV2 trained on 200k labeled speakers
model_id=iic/speech_eres2netv2_sv_zh-cn_16k-common
# CAM++ trained on 200k labeled speakers
model_id=iic/speech_campplus_sv_zh-cn_16k-common
# Run CAM++ or ERes2Net inference
python speakerlab/bin/infer_sv.py --model_id $model_id
# Run batch inference
python speakerlab/bin/infer_sv_batch.py --model_id $model_id --wavs $wav_list

# SDPN trained on VoxCeleb
model_id=iic/speech_sdpn_ecapa_tdnn_sv_en_voxceleb_16k
# Run SDPN inference
python speakerlab/bin/infer_sv_ssl.py --model_id $model_id

# Run diarization inference
python speakerlab/bin/infer_diarization.py --wav [wav_list OR wav_path] --out_dir $out_dir
# Enable overlap detection
python speakerlab/bin/infer_diarization.py --wav [wav_list OR wav_path] --out_dir $out_dir --include_overlap --hf_access_token $hf_access_token

DiariZen segmentation frontends

The unified environment keeps the original 3D-Speaker VAD, CAM++ speaker embeddings, spectral clustering, and local-speaker alignment. Only the SincNet/BiLSTM segmentation frontend is replaceable:

BackendRoleModel
pyannote-3.0Original overlap baselinepyannote/segmentation-3.0
diarizen-large-s80-v2Scheme 1WavLM-Large/Conformer, up to 4 speakers per frame
diarizen-base-s80Scheme 2WavLM-Base/Conformer, up to 2 speakers per frame

Create and activate the isolated environment:

conda env create -f environment.yaml
conda activate 3dspeaker-diarizen

Run either DiariZen scheme (the models are public and do not require the gated pyannote token):

# Scheme 1: higher-capacity Large-s80-v2
python speakerlab/bin/infer_diarization.py \
  --wav input.wav --out_dir output \
  --segmentation_backend diarizen-large-s80-v2

# Scheme 2: faster Base-s80
python speakerlab/bin/infer_diarization.py \
  --wav input.wav --out_dir output \
  --segmentation_backend diarizen-base-s80

Use --model_cache_dir to share the ModelScope and Hugging Face cache. --segmentation_batch_size and --segmentation_step override the official defaults when memory or latency tuning is needed. The legacy --include_overlap flag still selects pyannote-3.0 and must not be combined with --segmentation_backend.

Streaming diarization

An independent stateful pipeline reuses the same CAM++ and pyannote segmentation-3.0 models while keeping the offline API and CLI unchanged. The default mode uses a 10 s model window, advances every 1 s, and emits immutable results with a 2 s fixed-lag aggregation policy:

python speakerlab/bin/infer_diarization_streaming.py \
  --wav input_16k_mono.wav \
  --out_dir streaming_output \
  --hf_access_token "$HF_TOKEN"

The command simulates incoming audio with 100 ms chunks, prints each newly committed segment as a JSON line, and writes merged RTTM (or JSON) plus timing, RTF, configuration, and speaker-count metadata. It waits for the first 10 s window before producing output. Input must be mono 16 kHz, and numeric speaker IDs are stable only within one streaming session. See the streaming diarization guide for the Python API, lifecycle, thresholds, and latency semantics.

This integration does not use DiariZen's WeSpeaker embeddings, VBx clustering, or complete pipeline. DiariZen pretrained weights are licensed CC BY-NC 4.0 and are intended for non-commercial research use.

Review diarization results in a browser

After batch inference, start the read-only subjective review tool:

python speakerlab/bin/serve_diarization_web.py

It automatically indexes inference_outputs, streams the original WAV files without modifying them, and supports waveform navigation, custom interval playback, continuous playback of one predicted speaker, and same-lane prediction/GT comparison with global speaker matching. See the diarization web viewer guide for intranet access and moved-path configuration.

Overview of Content

What‘s new :fire:

Contact

If you have any comment or question about 3D-Speaker, please contact us by

  • email: {yfchen97, wanghuii}@mail.ustc.edu.cn, {dengchong.d, zsq174630, shuli.cly}@alibaba-inc.com

License

3D-Speaker is released under the Apache License 2.0.

Acknowledge

3D-Speaker contains third-party components and code modified from some open-source repos, including:
Speechbrain, Wespeaker, D-TDNN, DINO, Vicreg, TalkNet-ASD , Ultra-Light-Fast-Generic-Face-Detector-1MB, pyannote.audio

Citations

If you find this repository useful, please consider giving a star :star: and citation :t-rex::

@article{chen20243d,
  title={3D-Speaker-Toolkit: An Open Source Toolkit for Multi-modal Speaker Verification and Diarization},
  author={Chen, Yafeng and Zheng, Siqi and Wang, Hui and Cheng, Luyao and others},
  booktitle={ICASSP},
  year={2025}
}

Contributors

yfchenlucky

144 commits

yfchenmodelscope

105 commits

wanghuii1

32 commits

GeekOrangeLuYao

21 commits

Languages

Python

56.9%

Shell

23.5%

Perl

12.7%

C++

2.9%

JavaScript

2.4%