3D-Speaker Toolkit

repository·main·Indexed 25 days ago

https://github.com/modelscope/3d-speaker

An 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.

Tokens
17.7K
Snippets
44
Records
119
Agent score
85%

What's inside 3D-Speaker

  1. Res2Net Speaker Verification Configuration and Results

    main

    This 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
    • Evaluation Metrics: EER (%) and MinDCF (p-target=0.01).

    Voxceleb Performance Results

    • Training Set: Voxceleb2-dev (5994 speakers)
    • Test Set: Voxceleb-O
    ModelParamsEER(%)MinDCF
    Res2Net4.03M1.500.138
  2. ResNet Speaker Verification Configuration and Results

    main

    This 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 of 256.
    • 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.
    ModelParamsEER(%)MinDCF
    ResNet346.34M1.040.095
  3. Inference using pretrained models from ModelScope

    main
    You 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 the modelscope library and load the specific model ID.
  4. Run Dialogue Detection task

    main

    Execute 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.py

    Key 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.
  5. Perform Speaker Diarization and Language Identification

    main

    3D-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-diarization and egs/3dspeaker/language-identification.

  6. Run Speaker-Turn Detection task

    main

    Execute 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.py

    Key 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 to sentence).
    • --label_column_name: Column name for labels (defaults to change_point_list).
    • --label_num: Number of labels.
    bash run_speaker_turn_detection.sh exp/
  7. Install and run Active Speaker Detection (TalkNet)

    main

    This 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 ffmpeg is installed in your environment.

    pip install -r requirements.txt
    bash run.sh
  8. Download Alimeeting and Aishell-4 datasets

    main

    The 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 in egs/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.gz
  9. Perform Speaker Verification with ERes2NetV2, CAM++, or ECAPA-TDNN

    main

    The 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.

  10. Run speaker verification experiments on CN-Celeb

    main

    You 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.sh script. 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