-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[egs] Add recipes for CN-Celeb #3758
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
15fa0dd
[egs] Add recipes for CN-Celeb
csltstu a1cbbec
remove v2 of x-vector
csltstu 31d8dcd
[egs] remove recipe in v2
csltstu 9c9b916
[egs] fix a spelling mistake
csltstu 11c6da7
[egs] rename the directories of mfcc and vad
csltstu 20cc8dd
[scripts] add --no-text option
csltstu d837657
[scripts] add --merge-within-speakers-only option
csltstu 1670ff3
[egs] remove local scripts
csltstu 5e55cd1
add --merge-within-speakers-only option
csltstu b74d84e
[egs] update run.sh
csltstu 324396d
[egs] add v2
csltstu 33d3539
[egs] update soft links
csltstu 9d71374
[egs] remove v2 recipe
csltstu 844c524
[egs] modify test results
csltstu e781dc8
[egs] remove x-vector scripts left over from v2
csltstu e79c44d
[scripts] improve some comments
csltstu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
This directory contains example scripts for CN-Celeb speaker | ||
verification. The CN-Celeb corpus is required, and can be | ||
downloaded from Openslr http://www.openslr.org/82/ or from | ||
CSLT@Tsinghua http://cslt.riit.tsinghua.edu.cn/~data/CN-Celeb/ | ||
|
||
The subdirectories "v1" and so on are different speaker recognition | ||
recipes. The recipe in v1 demonstrates a standard approach using a | ||
full-covariance GMM-UBM, iVectors, and a PLDA backend. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
This example demonstrates a traditional iVector system based on | ||
CN-Celeb dataset. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# you can change cmd.sh depending on what type of queue you are using. | ||
# If you have no queueing system and want to run on a local machine, you | ||
# can change all instances 'queue.pl' to run.pl (but be careful and run | ||
# commands one by one: most recipes will exhaust the memory on your | ||
# machine). queue.pl works with GridEngine (qsub). slurm.pl works | ||
# with slurm. Different queues are configured differently, with different | ||
# queue names and different ways of specifying things like memory; | ||
# to account for these differences you can create and edit the file | ||
# conf/queue.conf to match your queue's configuration. Search for | ||
# conf/queue.conf in http://kaldi-asr.org/doc/queue.html for more information, | ||
# or search for the string 'default_config' in utils/queue.pl or utils/slurm.pl. | ||
|
||
export train_cmd="queue.pl --mem 4G" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--sample-frequency=16000 | ||
--frame-length=25 # the default is 25 | ||
--low-freq=20 # the default. | ||
--high-freq=7600 # the default is zero meaning use the Nyquist (8k in this case). | ||
--num-mel-bins=30 | ||
--num-ceps=24 | ||
--snip-edges=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--vad-energy-threshold=5.5 | ||
--vad-energy-mean-scale=0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
# Copyright 2017 Ignacio Viñals | ||
# 2017-2018 David Snyder | ||
# 2019 Jiawen Kang | ||
# | ||
# This script prepares the CN-Celeb dataset. It creates separate directories | ||
# for train, eval enroll and eval test. It also prepares a trials files, in the eval test directory. | ||
|
||
if [ $# != 2 ]; then | ||
echo "Usage: make_cnceleb.sh <CN-Celeb_PATH> <out_dir>" | ||
echo "E.g.: make_cnceleb.sh /export/corpora/CN-Celeb data" | ||
exit 1 | ||
fi | ||
|
||
in_dir=$1 | ||
out_dir=$2 | ||
|
||
# Prepare the development data | ||
this_out_dir=${out_dir}/train | ||
mkdir -p $this_out_dir 2>/dev/null | ||
WAVFILE=$this_out_dir/wav.scp | ||
SPKFILE=$this_out_dir/utt2spk | ||
rm $WAVFILE $SPKFILE 2>/dev/null | ||
this_in_dir=${in_dir}/dev | ||
|
||
for spkr_id in `cat $this_in_dir/dev.lst`; do | ||
for f in $in_dir/data/$spkr_id/*.wav; do | ||
wav_id=$(basename $f | sed s:.wav$::) | ||
echo "${spkr_id}-${wav_id} $f" >> $WAVFILE | ||
echo "${spkr_id}-${wav_id} ${spkr_id}" >> $SPKFILE | ||
done | ||
done | ||
utils/fix_data_dir.sh $this_out_dir | ||
|
||
# Prepare the evaluation data | ||
for mode in enroll test; do | ||
this_out_dir=${out_dir}/eval_${mode} | ||
mkdir -p $this_out_dir 2>/dev/null | ||
WAVFILE=$this_out_dir/wav.scp | ||
SPKFILE=$this_out_dir/utt2spk | ||
rm $WAVFILE $SPKFILE 2>/dev/null | ||
this_in_dir=${in_dir}/eval/${mode} | ||
|
||
for f in $this_in_dir/*.wav; do | ||
wav_id=$(basename $f | sed s:.wav$::) | ||
spkr_id=$(echo ${wav_id} | cut -d "-" -f1) | ||
echo "${wav_id} $f" >> $WAVFILE | ||
echo "${wav_id} ${spkr_id}" >> $SPKFILE | ||
done | ||
utils/fix_data_dir.sh $this_out_dir | ||
done | ||
|
||
# Prepare test trials | ||
this_out_dir=$out_dir/eval_test/trials | ||
mkdir -p $out_dir/eval_test/trials | ||
this_in_dir=${in_dir}/eval/lists | ||
cat $this_in_dir/trials.lst | sed 's@-enroll@@g' | sed 's@test/@@g' | sed 's@.wav@@g' | \ | ||
awk '{if ($3 == "1") | ||
{print $1,$2,"target"} | ||
else | ||
{print $1,$2,"nontarget"} | ||
}'> $this_out_dir/trials.lst | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export KALDI_ROOT=`pwd`/../../.. | ||
export PATH=$PWD/utils/:$KALDI_ROOT/tools/openfst/bin:$KALDI_ROOT/tools/sph2pipe_v2.5:$PWD:$PATH | ||
[ ! -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 | ||
. $KALDI_ROOT/tools/config/common_path.sh | ||
export LC_ALL=C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
#!/bin/bash | ||
# Copyright 2017 Johns Hopkins University (Author: Daniel Garcia-Romero) | ||
# 2017 Johns Hopkins University (Author: Daniel Povey) | ||
# 2017-2018 David Snyder | ||
# 2018 Ewald Enzinger | ||
# 2019 Tsinghua University (Author: Jiawen Kang and Lantian Li) | ||
# Apache 2.0. | ||
# | ||
# This is an i-vector-based recipe for CN-Celeb database. | ||
# See ../README.txt for more info on data required. The recipe uses | ||
# CN-Celeb/dev for training the UBM, T matrix and PLDA, and CN-Celeb/eval | ||
# for evaluation. The results are reported in terms of EER and minDCF, | ||
# and are inline in the comments below. | ||
|
||
. ./cmd.sh | ||
. ./path.sh | ||
set -e | ||
mfccdir=`pwd`/mfcc | ||
vaddir=`pwd`/mfcc | ||
|
||
cnceleb_root=/export/corpora/CN-Celeb | ||
eval_trails_core=data/eval_test/trials/trials.lst | ||
|
||
stage=0 | ||
|
||
if [ $stage -le 0 ]; then | ||
# Prepare the CN-Celeb dataset. The script is used to prepare the development | ||
# dataset and evaluation dataset. | ||
local/make_cnceleb.sh $cnceleb_root data | ||
fi | ||
|
||
if [ $stage -le 1 ]; then | ||
# Make MFCCs and compute the energy-based VAD for each dataset | ||
for name in train eval_enroll eval_test; do | ||
steps/make_mfcc.sh --write-utt2num-frames true --mfcc-config conf/mfcc.conf --nj 20 --cmd "$train_cmd" \ | ||
data/${name} exp/make_mfcc $mfccdir | ||
utils/fix_data_dir.sh data/${name} | ||
sid/compute_vad_decision.sh --nj 20 --cmd "$train_cmd" \ | ||
data/${name} exp/make_vad $vaddir | ||
utils/fix_data_dir.sh data/${name} | ||
done | ||
fi | ||
|
||
if [ $stage -le 2 ]; then | ||
# Train the UBM | ||
sid/train_diag_ubm.sh --cmd "$train_cmd --mem 4G" \ | ||
--nj 20 --num-threads 8 \ | ||
data/train 2048 \ | ||
exp/diag_ubm | ||
|
||
sid/train_full_ubm.sh --cmd "$train_cmd --mem 16G" \ | ||
--nj 20 --remove-low-count-gaussians false \ | ||
data/train \ | ||
exp/diag_ubm exp/full_ubm | ||
fi | ||
|
||
if [ $stage -le 3 ]; then | ||
# Train the i-vector extractor. | ||
sid/train_ivector_extractor.sh --nj 20 --cmd "$train_cmd --mem 16G" \ | ||
--ivector-dim 400 --num-iters 5 \ | ||
exp/full_ubm/final.ubm data/train \ | ||
exp/extractor | ||
fi | ||
|
||
if [ $stage -le 4 ]; then | ||
# Note that there are over one-third of the utterances less than 2 seconds in our training set, | ||
# and these short utterances are harmful for PLDA training. Therefore, to improve performance | ||
# of PLDA modeling and inference, we will combine the short utterances longer than 5 seconds. | ||
utils/data/combine_short_segments.sh --speaker-only true \ | ||
data/train 5 data/train_comb | ||
# Compute the energy-based VAD for train_comb | ||
sid/compute_vad_decision.sh --nj 20 --cmd "$train_cmd" \ | ||
data/train_comb exp/make_vad $vaddir | ||
utils/fix_data_dir.sh data/train_comb | ||
fi | ||
|
||
if [ $stage -le 5 ]; then | ||
# These i-vectors will be used for mean-subtraction, LDA, and PLDA training. | ||
sid/extract_ivectors.sh --cmd "$train_cmd --mem 4G" --nj 20 \ | ||
exp/extractor data/train_comb \ | ||
exp/ivectors_train_comb | ||
|
||
# Extract i-vector for eval sets. | ||
for name in eval_enroll eval_test; do | ||
sid/extract_ivectors.sh --cmd "$train_cmd --mem 4G" --nj 10 \ | ||
exp/extractor data/$name \ | ||
exp/ivectors_$name | ||
done | ||
fi | ||
|
||
if [ $stage -le 6 ]; then | ||
# Compute the mean vector for centering the evaluation i-vectors. | ||
$train_cmd exp/ivectors_train_comb/log/compute_mean.log \ | ||
ivector-mean scp:exp/ivectors_train_comb/ivector.scp \ | ||
exp/ivectors_train_comb/mean.vec || exit 1; | ||
|
||
# This script uses LDA to decrease the dimensionality prior to PLDA. | ||
lda_dim=150 | ||
$train_cmd exp/ivectors_train_comb/log/lda.log \ | ||
ivector-compute-lda --total-covariance-factor=0.0 --dim=$lda_dim \ | ||
"ark:ivector-subtract-global-mean scp:exp/ivectors_train_comb/ivector.scp ark:- |" \ | ||
ark:data/train_comb/utt2spk exp/ivectors_train_comb/transform.mat || exit 1; | ||
|
||
# Train the PLDA model. | ||
$train_cmd exp/ivectors_train_comb/log/plda.log \ | ||
ivector-compute-plda ark:data/train_comb/spk2utt \ | ||
"ark:ivector-subtract-global-mean scp:exp/ivectors_train_comb/ivector.scp ark:- | transform-vec exp/ivectors_train_comb/transform.mat ark:- ark:- | ivector-normalize-length ark:- ark:- |" \ | ||
exp/ivectors_train_comb/plda || exit 1; | ||
|
||
fi | ||
|
||
if [ $stage -le 7 ]; then | ||
# Compute PLDA scores for CN-Celeb eval core trials | ||
$train_cmd exp/scores/log/cnceleb_eval_scoring.log \ | ||
ivector-plda-scoring --normalize-length=true \ | ||
--num-utts=ark:exp/ivectors_eval_enroll/num_utts.ark \ | ||
"ivector-copy-plda --smoothing=0.0 exp/ivectors_train_comb/plda - |" \ | ||
"ark:ivector-mean ark:data/eval_enroll/spk2utt scp:exp/ivectors_eval_enroll/ivector.scp ark:- | ivector-subtract-global-mean exp/ivectors_train_comb/mean.vec ark:- ark:- | transform-vec exp/ivectors_train_comb/transform.mat ark:- ark:- | ivector-normalize-length ark:- ark:- |" \ | ||
"ark:ivector-subtract-global-mean exp/ivectors_train_comb/mean.vec scp:exp/ivectors_eval_test/ivector.scp ark:- | transform-vec exp/ivectors_train_comb/transform.mat ark:- ark:- | ivector-normalize-length ark:- ark:- |" \ | ||
"cat '$eval_trails_core' | cut -d\ --fields=1,2 |" exp/scores/cnceleb_eval_scores || exit 1; | ||
|
||
# CN-Celeb Eval Core: | ||
# EER: 13.91% | ||
# minDCF(p-target=0.01): 0.6530 | ||
# minDCF(p-target=0.001): 0.7521 | ||
echo -e "\nCN-Celeb Eval Core:"; | ||
eer=$(paste $eval_trails_core exp/scores/cnceleb_eval_scores | awk '{print $6, $3}' | compute-eer - 2>/dev/null) | ||
mindcf1=`sid/compute_min_dcf.py --p-target 0.01 exp/scores/cnceleb_eval_scores $eval_trails_core 2> /dev/null` | ||
mindcf2=`sid/compute_min_dcf.py --p-target 0.001 exp/scores/cnceleb_eval_scores $eval_trails_core 2> /dev/null` | ||
echo "EER: $eer%" | ||
echo "minDCF(p-target=0.01): $mindcf1" | ||
echo "minDCF(p-target=0.001): $mindcf2" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../sre08/v1/sid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../wsj/s5/steps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../wsj/s5/utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
were -> are in the usage message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot. I have modified it from the PR.