3D-Speaker Toolkit
repository·main·Indexed 25 days ago
https://github.com/modelscope/3d-speakerAn open-source toolkit for single- and multi-modal speaker verification, recognition, and diarization. It provides access to large-scale speech corpora and pretrained models via ModelScope, including ERes2Net, CAM++, ECAPA-TDNN, ResNet, Res2Net, and RDINO. The toolkit supports language identification using speaker embeddings or Paraformer, audio-only and multimodal speaker diarization, and active speaker detection via TalkNet.
What's inside 3D-Speaker
- Res2Net is a speaker verification model architecture within the 3D-Speaker project. It is designed for high-performance speaker embedding extraction.
Res2Net Speaker Verification Configuration and Results
mainThis section details the training configuration and performance metrics for the Res2Net model used for speaker verification on the Voxceleb dataset.
Training Configuration
- Features: 80-dim fbank, mean normalization, and speed perturbation.
- Hyperparameters:
- Learning rate (lr):
[0.00005, 0.2] - Batch size:
512 - Hardware: 8 GPUs (Tesla V100)
- Loss: Additive angular margin
- Learning rate (lr):
- Evaluation Metrics: EER (%) and MinDCF (p-target=0.01).
Voxceleb Performance Results
- Training Set: Voxceleb2-dev (5994 speakers)
- Test Set: Voxceleb-O
Model Params EER(%) MinDCF Res2Net 4.03M 1.50 0.138 ResNet Speaker Verification Configuration and Results
mainThis section details the configuration and performance metrics for the ResNet-based speaker verification model trained on the Voxceleb dataset.
Training Configuration
- Features: 80-dim fbank, mean normalization, and speed perturbation.
- Hyperparameters: Learning rate (lr) in range
[0.00005, 0.2], batch size of256. - Hardware: Optimized for 4 GPUs (Tesla V100).
- Loss Function: Additive angular margin.
- Evaluation Metrics: EER (%) and MinDCF (p-target=0.01).
Voxceleb Performance Results
- Training Set: Voxceleb2-dev (5994 speakers).
- Test Set: Voxceleb-O.
Model Params EER(%) MinDCF ResNet34 6.34M 1.04 0.095 Install Speaker Diarization dependencies
mainTo use the speaker diarization tools, install the required Python packages using the provided requirements file.
pip install -r requirements.txtInference using pretrained models from ModelScope
mainYou can perform inference using pretrained models hosted on ModelScope. The toolkit supports various models including ERes2NetV2, CAM++, and ECAPA-TDNN for speaker verification, as well as models for language identification and diarization. To use these, you typically need to install themodelscopelibrary and load the specific model ID.Run Dialogue Detection task
mainExecute the Dialogue Detection task using the provided shell script. The script requires an output directory as the only parameter.
Command:
bash run_dialogue_detection.sh <output_dir>Core Python logic:
egs/semantic_speaker/bert/bin/run_dialogue_detection.pyKey Arguments for
run_dialogue_detection.py:--model_name_or_path: Path to pre-trained BERT model (e.g.,bert-base-chinese).--train_file,--validation_file,--test_file: Paths to the JSON files for training, validation, and testing.
Perform Speaker Diarization and Language Identification
main3D-Speaker supports advanced diarization and language identification tasks:
- Speaker Diarization: Includes standard audio-based diarization and multimodal diarization which fuses audio and video input for improved accuracy. It also supports Dialogue Detection and Semantic Speaker Change Detection.
- Language Identification: Models that integrate phonetic information for higher recognition accuracy, supporting both Mandarin and English (e.g., using CAM++ or ERes2Net).
Recipes can be found in
egs/3dspeaker/speaker-diarizationandegs/3dspeaker/language-identification.Run Speaker-Turn Detection task
mainExecute the Speaker-Turn Detection task using the provided shell script. The script requires an output directory as the only parameter.
Command:
bash run_speaker_turn_detection.sh <output_dir>Core Python logic:
egs/semantic_speaker/bert/bin/run_speaker_turn_detection.pyKey Arguments for
run_speaker_turn_detection.py:--model_name_or_path: Path to pre-trained BERT model.--train_file,--validation_file,--test_file: Paths to the JSON files.--text_column_name: Column name for text (defaults tosentence).--label_column_name: Column name for labels (defaults tochange_point_list).--label_num: Number of labels.
bash run_speaker_turn_detection.sh exp/Install and run Active Speaker Detection (TalkNet)
mainThis recipe implements Active Speaker Detection using the TalkNet model, adapted for multi-process data processing and multi-GPU training/evaluation.
To use this recipe, install the required Python dependencies and execute the run script. You must also ensure
ffmpegis installed in your environment.pip install -r requirements.txt bash run.shDownload Alimeeting and Aishell-4 datasets
mainThe Semantic Speaker Information Extraction task uses Alimeeting and Aishell-4 datasets. You can download them from OpenSLR using
wget. Scripts for downloading are also provided inegs/semantic_speaker/bert/local/.# Alimeeting data download wget https://speech-lab-share-data.oss-cn-shanghai.aliyuncs.com/AliMeeting/openlr/Train_Ali_far.tar.gz wget https://speech-lab-share-data.oss-cn-shanghai.aliyuncs.com/AliMeeting/openlr/Train_Ali_near.tar.gz wget https://speech-lab-share-data.oss-cn-shanghai.aliyuncs.com/AliMeeting/openlr/Eval_Ali.tar.gz wget https://speech-lab-share-data.oss-cn-shanghai.aliyuncs.com/AliMeeting/openlr/Test_Ali.tar.gz # Aishell-4 data download wget https://us.openslr.org/resources/111/train_L.tar.gz wget https://us.openslr.org/resources/111/train_M.tar.gz wget https://us.openslr.org/resources/111/train_S.tar.gz wget https://us.openslr.org/resources/111/test.tar.gzPerform Speaker Verification with ERes2NetV2, CAM++, or ECAPA-TDNN
mainThe toolkit provides recipes and pretrained models for several speaker verification architectures:
- ERes2NetV2: High-performance models (e.g.,
speech_eres2netv2_sv_zh-cn_16k-common) trained on large datasets. - CAM++: Efficient speaker verification models.
- ECAPA-TDNN: Standard speaker verification architecture.
Recipes for training and inference are available in the
egs/directory for various datasets like 3D-Speaker, VoxCeleb, and CN-Celeb.- ERes2NetV2: High-performance models (e.g.,
Run speaker verification experiments on CN-Celeb
mainYou can run training or evaluation experiments for various speaker verification models on the CN-Celeb dataset by navigating to the specific model directory and executing the
run.shscript. Supported models include ERes2Net, CAM++, ECAPA-TDNN, ResNet, Res2Net, and RDINO (self-supervised).# Speaker verification: ERes2Net on CN-Celeb cd egs/cnceleb/sv-eres2net/ bash run.sh # Speaker verification: CAM++ on CN-Celeb cd egs/cnceleb/sv-cam++/ bash run.sh # Speaker verification: ECAPA-TDNN on CN-Celeb cd egs/cnceleb/sv-ecapa/ bash run.sh # Speaker verification: ResNet on CN-Celeb cd egs/cnceleb/sv-resnet/ bash run.sh # Speaker verification: Res2Net on CN-Celeb cd egs/cnceleb/sv-res2net/ bash run.sh # Self-supervised speaker verification: RDINO on CN-Celeb cd egs/cnceleb/sv-rdino/ bash run.sh