This repository provides a comprehensive solution for speaker diarization using a Wav2Vec2-based model. It includes scripts for data preparation, training, evaluation, and inference.
1. Data Preparation
The first step is to prepare the training and testing data. This involves generating reference labels from RTTM files and splitting the audio into chunks.
1.1. Generate Training Data
Run the following script to generate training data. You need to provide the directory containing the RTTM files and a list of WAV files.
This script will generate test data and save it in prepare_training_data/dir_ref_out_for_test/.
2. Training
Once the data is prepared, you can train the speaker diarization model.
bash run_ssd_train.sh
This script will:
Load the pre-trained zhniu/wav2vec2_ssd model.
Use the generated training and validation data.
Train the model for a specified number of epochs.
Save the fine-tuned model to the ./experiments/new_model directory.
3. Evaluation
After training, you can evaluate the model's performance on the test set. The evaluation script calculates precision, recall, and F1-score for speaker change detection (SCD).