This Repository contains the code for detecting the accent of a speaker with their speech signal. The repository experiments with AESRC2020 Dataset.
Use the package manager pip to install the required packages for preparing the dataset, training and testing the model.
pip install -r requirements.txt
# Noise Dataset is optional, but recommended
# 1. Download noise Dataset with wavencoder
# 2. Update config.py with the noise_dataset_path = 'folder-to-download-noise-data'
import wavencoder
wavencoder.utils.download_noise_dataset('folder-to-download-noise-data', sample_rate='16k', download_all=True)
Edit the config.py for configurations on data path, lr, batch size, ... etc.
Or you can optionally give as a command line parameters for train and test
# AESRC2020 Dataset
# prepare csv with path to wav files and labels for training
# Train and Test csv files are available at Dataset folder
python prepare_aesrc_data.py --path='path to aesrc wav data folder'
#Change the logger to Tensorboard or Wandb based on your need in train.py
logger = WandbLogger()
logger = TensorBoardLogger()
python train.py --dev=True
python train.py
python test.py
# Edit config.py for trained model checkpoint
# or add --model_checkpoint='path to saved model checkpoint'
Model | Experiment Run | Test wav length | Test Accuracy |
---|---|---|---|
MFCC_1DCNN_LSTM_Attn | Wandb Run | 3s | 0.34078 |
Mel_Spectrogram_1DCNN_LSTM_Attn | Wandb Run | 3s | 0.3751 |
wav2vec_LSTM_Attn_CenterLoss (center after attn) | Wandb Run | 3s | 0.6123 |
4s | 0.62008 | ||
-1 | 0.6279 | ||
wav2vec_LSTM_Attn_CenterLoss (center before final dense) | Wandb Run | -1 | 0.6161 |
wav2vec_LSTM_Attn_Centerloss_256 (center after Attn) | Wandb Run | -1 | 0.6622 |
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.