├── figs └── meta_learning_arch.png ├── .gitignore ├── path.sh ├── cmd.sh ├── LICENSE.md ├── compute_valid_acc.py ├── egs ├── convert_rttm_to_vad.py ├── wrapper_eval.sh ├── sv_voices_kaldi.sh ├── sv_voices.sh ├── diarize_kaldi.sh └── diarize.sh ├── subsetEgsIntoHdf5.py ├── extract.py ├── train_relation.py ├── train_proto.py ├── train_xent.py ├── README.md ├── pytorch_run.sh ├── models.py └── train_utils.py /figs/meta_learning_arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manojpamk/pytorch_xvectors/HEAD/figs/meta_learning_arch.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | benchmarks 2 | TODO 3 | *.pyc 4 | final_models/ 5 | models/ 6 | archived_setups/ 7 | *cifar* 8 | *.config 9 | *elessar* 10 | old* 11 | train_hdf5.py 12 | convert_egs_to_hdf5.py 13 | local/ 14 | sid/ 15 | steps/ 16 | utils/ 17 | -------------------------------------------------------------------------------- /path.sh: -------------------------------------------------------------------------------- 1 | export KALDI_ROOT=/home/manoj/kaldi/ 2 | export PATH=$PWD/utils/:$KALDI_ROOT/tools/openfst/bin:$KALDI_ROOT/tools/sph2pipe_v2.5:$PWD:$PATH 3 | [ ! -f $KALDI_ROOT/tools/config/common_path.sh ] && echo >&2 "The standard file $KALDI_ROOT/tools/config/common_path.sh is not present -> Exit!" && exit 1 4 | . $KALDI_ROOT/tools/config/common_path.sh 5 | export LC_ALL=C 6 | -------------------------------------------------------------------------------- /cmd.sh: -------------------------------------------------------------------------------- 1 | # you can change cmd.sh depending on what type of queue you are using. 2 | # If you have no queueing system and want to run on a local machine, you 3 | # can change all instances 'queue.pl' to run.pl (but be careful and run 4 | # commands one by one: most recipes will exhaust the memory on your 5 | # machine). queue.pl works with GridEngine (qsub). slurm.pl works 6 | # with slurm. Different queues are configured differently, with different 7 | # queue names and different ways of specifying things like memory; 8 | # to account for these differences you can create and edit the file 9 | # conf/queue.conf to match your queue's configuration. Search for 10 | # conf/queue.conf in http://kaldi-asr.org/doc/queue.html for more information, 11 | # or search for the string 'default_config' in utils/queue.pl or utils/slurm.pl. 12 | 13 | export train_cmd="run.pl" 14 | 15 | 16 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Manoj Kumar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /compute_valid_acc.py: -------------------------------------------------------------------------------- 1 | #!/bin/python3.6 2 | 3 | """ Date Created: Feb 17 2020 4 | This script computes the validation accuracy 5 | """ 6 | 7 | import os 8 | import sys 9 | import torch 10 | import socket 11 | import kaldi_python_io 12 | from train_utils import * 13 | 14 | 15 | egsDir = 16 | modelDir = '/home/manoj/Projects/pytorch_spkembed/xvectors_voxceleb/models/isXvec_False_modelType_3_event_202002-1719-0729' 17 | modelFile = max(glob.glob(modelDir), key=os.path.getctime) 18 | 19 | # Load the model 20 | net = simpleTDNN(params['numSpkrs'], p_dropout=0) 21 | checkpoint = torch.load(modelFile) 22 | net.load_state_dict(checkpoint['model_state_dict']) 23 | net.eval() 24 | 25 | correct, incorrect = 0, 0 26 | for validArk in glob.glob(egsDir+'/valid_egs.*.ark'): 27 | x = kaldi_python_io.Nnet3EgsReader(validArk) 28 | for key, mat in x: 29 | out = net(torch.Tensor(mat[0]['matrix']).permute(1,0).unsqueeze(0)) 30 | if mat[1]['matrix'][0][0][0] == torch.argmax(out)+1: 31 | correct += 1 32 | else: 33 | incorrect += 1 34 | #print('%d,%d' %(mat[1]['matrix'][0][0][0],torch.argmax(out)+1)) 35 | print('Valid accuracy: %1.2f percent' %(1.0*correct/(correct+incorrect))) 36 | -------------------------------------------------------------------------------- /egs/convert_rttm_to_vad.py: -------------------------------------------------------------------------------- 1 | #!/bin/python 2 | 3 | """ 4 | This script converts the RTTM ground truth files into oracleVAD files to be 5 | used for computing SER (speaker error rate) 6 | 7 | Output format (xxx.csv): 8 |