Skip to content

Commit

Permalink
Merge pull request kaldi-asr#24 from chimechallenge/diarize_scoring
Browse files Browse the repository at this point in the history
Added ref RTTM creation
  • Loading branch information
sw005320 authored Dec 9, 2019
2 parents 21118d6 + 2e581ed commit 29a06a2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions egs/chime6/s5_track2/local/decode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ if [ $stage -le 3 ]; then
data/${datadir} || exit 1

mv data/${datadir}_seg data/${datadir}_${nnet_type}_seg
mv data/${datadir}/{segments.bak,utt2spk.bak} data/${datadir}_${nnet_type}_seg
# Generate RTTM file from segmentation performed by SAD. This can
# be used to evaluate the performance of the SAD as an intermediate
# step.
Expand Down
30 changes: 18 additions & 12 deletions egs/chime6/s5_track2/local/diarize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ echo "$0 $@" # Print the command line for logging
if [ -f path.sh ]; then . ./path.sh; fi
. parse_options.sh || exit 1;
if [ $# != 3 ]; then
echo "Usage: $0 <model-dir> <in-data-dir> <out-dir>"
echo "Usage: $0 <model-dir> <in-data-dir> <out-dir>"
echo "e.g.: $0 exp/xvector_nnet_1a data/dev exp/dev_diarization"
echo "Options: "
echo " --nj <nj> # number of parallel jobs."
Expand Down Expand Up @@ -89,19 +89,25 @@ fi
# used in the DIHARD II challenge. This is available at:
# https://github.com/nryant/dscore
if [ $stage -le 5 ]; then
if [ -f $ref_rttm ]; then
echo "$0: computing diariztion error rate (DER) using reference ${ref_rttm}"
ref_rttm_path=$((readlink -f $ref_rttm))
out_rttm_path=$((readlink -f $out_dir/rttm))
if ! [ -d dscore ]; then
git clone https://github.com/nryant/dscore.git || exit 1;
cd dscore
python -m pip install --user -r requirements.txt
cd ..
fi
# If a reference RTTM file is not provided, we create one using the backed up
# segments and utt2spk files in the original data directory.
if [ -z $ref_rttm ]; then
ref_rttm=data/$name/rttm
echo "$0: preparing ref RTTM file from segments and utt2spk"
steps/segmentation/convert_utt2spk_and_segments_to_rttm.py data/$name/utt2spk.bak \
data/$name/segments.bak $ref_rttm
fi
grep 'U06' $ref_rttm > ${ref_rttm}.U06
ref_rttm_path=$(readlink -f ${ref_rttm}.U06)
out_rttm_path=$(readlink -f $out_dir/rttm)
if ! [ -d dscore ]; then
git clone https://github.com/nryant/dscore.git || exit 1;
cd dscore
python score.py -r $ref_rttm_path -s $out_rttm_path
python -m pip install --user -r requirements.txt
cd ..
fi
cd dscore
python score.py -r $ref_rttm_path -s $out_rttm_path
cd ..
fi

0 comments on commit 29a06a2

Please sign in to comment.