From bee8346c4b0fd9eb4acb8910620be6173f31cf92 Mon Sep 17 00:00:00 2001
From: 志浩 <neo.dzh@alibaba-inc.com>
Date: 星期三, 02 八月 2023 10:59:31 +0800
Subject: [PATCH] TOLD/SOND: update finetune and train recipe

---
 egs/callhome/diarization/sond/finetune.sh |   42 ++++++++++++++++++++++++++++++------------
 1 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/egs/callhome/diarization/sond/finetune.sh b/egs/callhome/diarization/sond/finetune.sh
index 92a1ef5..84ec103 100644
--- a/egs/callhome/diarization/sond/finetune.sh
+++ b/egs/callhome/diarization/sond/finetune.sh
@@ -8,13 +8,18 @@
 # [2] Speaker Overlap-aware Neural Diarization for Multi-party Meeting Analysis, EMNLP 2022
 # We recommend you run this script stage by stage.
 
+# This recipe includes:
+# 1. downloading a pretrained model on the simulated data from switchboard and NIST,
+# 2. finetuning the pretrained model on Callhome1.
+# Finally, you will get a slightly better DER result 9.95% on Callhome2 than that in the paper 10.14%.
+
 # environment configuration
 if [ ! -e utils ]; then
   ln -s ../../../aishell/transformer/utils ./utils
 fi
 
 # machines configuration
-gpu_devices="0,1,2,3"
+gpu_devices="0,1,2,3"  # for V100-16G, need 4 gpus.
 gpu_num=4
 count=1
 
@@ -46,7 +51,7 @@
 freeze_param=
 
 # inference related
-inference_model=valid.der.ave_5best.pth
+inference_model=valid.der.ave_5best.pb
 inference_config=conf/basic_inference.yaml
 inference_tag=""
 test_sets="callhome2"
@@ -76,10 +81,14 @@
 # Download required resources
 if [ ${stage} -le 0 ] && [ ${stop_stage} -ge 0 ]; then
   echo "Stage 0: Download required resources."
-  wget told_finetune_resources.zip
+  if [ ! -e told_finetune_resources.tar.gz ]; then
+    # MD5SUM: abc7424e4e86ce6f040e9cba4178123b
+    wget --no-check-certificate https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/Speaker_Diar/told_finetune_resources.tar.gz
+    tar zxf told_finetune_resources.tar.gz
+  fi
 fi
 
-# Finetune model on callhome1
+# Finetune model on callhome1, this will take about 1.5 hours.
 if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
   echo "Stage 1: Finetune pretrained model on callhome1."
   world_size=$gpu_num  # run on one machine
@@ -189,11 +198,14 @@
     done
 fi
 
-# Scoring for finetuned model, you may get a DER like
+# Scoring for finetuned model, you may get a DER like:
+# oracle_vad  |  system_vad
+#   7.28      |     8.06
 if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then
   echo "stage 3: Scoring finetuned models"
   if [ ! -e dscore ]; then
     git clone https://github.com/nryant/dscore.git
+    pip install intervaltree
     # add intervaltree to setup.py
   fi
   for dset in ${test_sets}; do
@@ -226,17 +238,23 @@
 # And convert the sph files to wav files (use scripts/dump_pipe_wav.py).
 # Then find the wav files to construct wav.scp and put it at data/callhome2/wav.scp.
 # After iteratively perform SOAP, you will get DER results like:
-# iters| oracle_vad  |  system_vad
-# iter_0:   9.68      |     10.51
-# iter_1:   9.26      |     10.14  (reported in the paper)
-# iter_2:   9.18      |     10.08
-# iter_3:   9.24      |     10.15
-# iter_4:   9.27      |     10.17
+# iters : oracle_vad  |  system_vad
+# iter_0:   9.63      |     10.43
+# iter_1:   9.17      |     10.03
+# iter_2:   9.11      |     9.98
+# iter_3:   9.08      |     9.96
+# iter_4:   9.07      |     9.95
 if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then
+  if [ ! -e ${expdir}/speech_xvector_sv-en-us-callhome-8k-spk6135-pytorch ]; then
+    git lfs install
+    git clone https://www.modelscope.cn/damo/speech_xvector_sv-en-us-callhome-8k-spk6135-pytorch.git
+    mv speech_xvector_sv-en-us-callhome-8k-spk6135-pytorch ${expdir}/
+  fi
+
   for dset in ${test_sets}; do
     echo "stage 4: Evaluating finetuned system on ${dset} set with medfilter_size=83 clustering=EEND-OLA"
     sv_exp_dir=${expdir}/speech_xvector_sv-en-us-callhome-8k-spk6135-pytorch
-    diar_exp=${expdir}/${model_dir}_phase3
+    diar_exp=${expdir}/${model_dir}
     _data="${datadir}/${dset}/dumped_files"
     _inference_tag="$(basename "${inference_config}" .yaml)${inference_tag}"
     _dir="${diar_exp}/${_inference_tag}/${inference_model}/${dset}"

--
Gitblit v1.9.1