Contrastive-Predictive-Coding-PyTorch

October 29, 2019 ยท View on GitHub

This repository contains (PyTorch) code to reproduce the core results for:

If you find the code useful, please cite

@article{lai2019contrastive,
  title={Contrastive Predictive Coding Based Feature for Automatic Speaker Verification},
  author={Lai, Cheng-I},
  journal={arXiv preprint arXiv:1904.01575},
  year={2019}
}

Getting Started

./src/model/model.py contains the CPC models implementation, ./src/main.py is the code for training the CPC models, ./src/spk_class.py trains a NN speaker classifier, ./ivector/ contains the scripts for running an i-vectors speaker verification system.

An example of CPC and speaker classifier training can be found at

./run.sh

CPC Models

CDCK2: base model from the paper 'Representation Learning with Contrastive Predictive Coding'.
CDCK5: CDCK2 with a different decoder.
CDCK6: CDCK2 with a shared encoder and double decoders.

Experimental Results

A. CPC Model Training

CPC model IDnumber of epochmodel sizedev NCE lossdev acc.
CDCK2607.42M1.642726.42
CDCK5605.58M1.781822.48
CDCK6307.33M1.648428.24

B. Speaker Verificaiton on LibriSpeech test-clean-100 (Average Pooling)

Note: 1st trial list and 2nd trial list

FeatureFeature DimSummarizationLDA Dim1st EER2nd EER
MFCC24average pooling249.21113.48
CDCK2256average pooling2005.88711.1
CDCK540average pooling407.50812.25
CDCK6256average pooling2006.80912.73

C. CPC applied with PCA

Feature w PCAOriginal FeaturePCA DimPCA Variance Ratio
CDCK2-36CDCK23676.76
CDCK2-60CDCK26087.40
CDCK5-24CDCK52493.39

D. Speaker Verificaiton on LibriSpeech test-clean-100 (i-vectors)

FeatureFeature DimSummarization1st EER2nd EER
MFCC24i-vectors5.5188.157
CDCK2-6060i-vectors5.3519.753
CDCK5-2424i-vectors4.9118.901
CDCK6-6060i-vectors5.2289.009
MFCC + CDCK2-3660i-vectors3.626.898
MFCC + CDCK5-2448i-vectors3.7126.962
MFCC + CDCK6-3660i-vectors3.6916.765

E. DET Curves of CPC and MFCC Fusion for i-vectors Speaker Verification

Authors

Cheng-I Lai.

If you encouter any problem, feel free to contact me.