Initial upload (part 5)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- MOSS_Speaker-RoPE/wespeaker-voxceleb-redimnet2-B6-LM/.gitattributes +35 -0
- MOSS_Speaker-RoPE/wespeaker-voxceleb-redimnet2-B6-LM/README.md +3 -0
- MOSS_Speaker-RoPE/wespeaker-voxceleb-redimnet2-B6-LM/avg_model.pt +3 -0
- MOSS_Speaker-RoPE/wespeaker-voxceleb-redimnet2-B6-LM/config.yaml +147 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v2/local/prepare_data.sh +92 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v2/local/score.sh +58 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v2/local/score_plda.sh +87 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v2/local/utt2voice_duration.py +36 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v2/path.sh +5 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v2/run.sh +139 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/README +29 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/README.md +99 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/conf/resnet.yaml +81 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/create_preproc_embd_lists.sh +119 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/download_data.sh +66 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/extract_sre.sh +166 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/filter_utt_accd_dur.py +35 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/generate_sre_aug.py +56 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/m4a2wav.pl +64 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/make_sre16_eval.pl +208 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/make_sre16_unlabeled.pl +111 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/make_system_sad.py +147 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/prepare_cts_superset.sh +32 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/prepare_data.sh +307 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/prepare_sre18.sh +111 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/prepare_sre21.sh +109 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/prepare_vox.sh +111 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/score.sh +89 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/score_plda.sh +130 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/score_plda_adapt.sh +112 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/score_plda_org.sh +82 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/utt2voice_duration.py +36 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/path.sh +5 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/qsub_extract.sh +36 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/qsub_train.sh +34 -0
- MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/run.sh +542 -0
- MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/README.md +10 -0
- MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/README.md +24 -0
- MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/conf/whisper_PMFA_stage0.yaml +78 -0
- MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/conf/whisper_PMFA_stage1.yaml +77 -0
- MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/local/download_data.sh +56 -0
- MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/local/download_whisper.sh +13 -0
- MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/local/extract_vox.sh +51 -0
- MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/local/prepare_data.sh +89 -0
- MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/local/score.sh +57 -0
- MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/local/score_norm.sh +69 -0
- MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/path.sh +5 -0
- MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/run.sh +138 -0
- MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v2/README.md +163 -0
- MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v2/conf/campplus.yaml +82 -0
MOSS_Speaker-RoPE/wespeaker-voxceleb-redimnet2-B6-LM/.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
MOSS_Speaker-RoPE/wespeaker-voxceleb-redimnet2-B6-LM/README.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
MOSS_Speaker-RoPE/wespeaker-voxceleb-redimnet2-B6-LM/avg_model.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b9314cd0184d3823c70a2518d354397bf049832f90fb1d7584ff6c0b0d8b152a
|
| 3 |
+
size 55525357
|
MOSS_Speaker-RoPE/wespeaker-voxceleb-redimnet2-B6-LM/config.yaml
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
checkpoint: exp/redimnet2/expB6_v2/-LM/models/model_0.pt
|
| 2 |
+
data_type: shard
|
| 3 |
+
dataloader_args:
|
| 4 |
+
batch_size: 16
|
| 5 |
+
drop_last: true
|
| 6 |
+
num_workers: 4
|
| 7 |
+
pin_memory: false
|
| 8 |
+
prefetch_factor: 4
|
| 9 |
+
dataset_args:
|
| 10 |
+
aug_prob: 0.0
|
| 11 |
+
cmvn: false
|
| 12 |
+
filter: false
|
| 13 |
+
frontend: tfmel
|
| 14 |
+
num_frms: 600
|
| 15 |
+
resample_rate: 16000
|
| 16 |
+
sample_num_per_epoch: 0
|
| 17 |
+
shuffle: true
|
| 18 |
+
shuffle_args:
|
| 19 |
+
shuffle_size: 2500
|
| 20 |
+
spec_aug: false
|
| 21 |
+
speed_perturb: false
|
| 22 |
+
tfmel_args:
|
| 23 |
+
do_preemph: true
|
| 24 |
+
do_spec_aug: false
|
| 25 |
+
eps: 1.0e-08
|
| 26 |
+
f_max: 7600
|
| 27 |
+
f_min: 20
|
| 28 |
+
hop_length: 160
|
| 29 |
+
n_fft: 512
|
| 30 |
+
n_mels: 72
|
| 31 |
+
norm_signal: true
|
| 32 |
+
win_length: 400
|
| 33 |
+
enable_amp: true
|
| 34 |
+
exp_dir: exp/redimnet2/expB6_v2/-LM
|
| 35 |
+
gpus:
|
| 36 |
+
- 2
|
| 37 |
+
- 3
|
| 38 |
+
grad_accum_steps: 8
|
| 39 |
+
log_batch_interval: 100
|
| 40 |
+
loss: CrossEntropyLoss
|
| 41 |
+
loss_args: {}
|
| 42 |
+
margin_scheduler: MarginScheduler
|
| 43 |
+
margin_update:
|
| 44 |
+
epoch_iter: 34125
|
| 45 |
+
final_margin: 0.3
|
| 46 |
+
fix_start_epoch: 0
|
| 47 |
+
increase_start_epoch: 0
|
| 48 |
+
increase_type: exp
|
| 49 |
+
initial_margin: 0.3
|
| 50 |
+
update_margin: false
|
| 51 |
+
model: ReDimNet2Wrap
|
| 52 |
+
model_args:
|
| 53 |
+
C: 64
|
| 54 |
+
F: 72
|
| 55 |
+
block_1d_type: conv+att
|
| 56 |
+
block_2d_type: basic_resnet
|
| 57 |
+
causal: none
|
| 58 |
+
compress_tconvs: true
|
| 59 |
+
emb_bn: false
|
| 60 |
+
embed_dim: 192
|
| 61 |
+
feat_dim: 72
|
| 62 |
+
fm_weigthing_type: NC
|
| 63 |
+
global_context_att: true
|
| 64 |
+
group_divisor: 1
|
| 65 |
+
hop_length: 160
|
| 66 |
+
out_channels: 224
|
| 67 |
+
pooling_func: ASTP
|
| 68 |
+
return_2d_output: true
|
| 69 |
+
spec: null
|
| 70 |
+
spec_in_channels: 1
|
| 71 |
+
stages_setup:
|
| 72 |
+
- - - 1
|
| 73 |
+
- 1
|
| 74 |
+
- 3
|
| 75 |
+
- 3
|
| 76 |
+
- - - 3
|
| 77 |
+
- 3
|
| 78 |
+
- 64
|
| 79 |
+
- - - 2
|
| 80 |
+
- 1
|
| 81 |
+
- 4
|
| 82 |
+
- 2
|
| 83 |
+
- - - 3
|
| 84 |
+
- 3
|
| 85 |
+
- 64
|
| 86 |
+
- - - 1
|
| 87 |
+
- 2
|
| 88 |
+
- 5
|
| 89 |
+
- 2
|
| 90 |
+
- - - 3
|
| 91 |
+
- 3
|
| 92 |
+
- 48
|
| 93 |
+
- - - 2
|
| 94 |
+
- 1
|
| 95 |
+
- 5
|
| 96 |
+
- 1
|
| 97 |
+
- - - 3
|
| 98 |
+
- 3
|
| 99 |
+
- 48
|
| 100 |
+
- - - 1
|
| 101 |
+
- 2
|
| 102 |
+
- 4
|
| 103 |
+
- 0.75
|
| 104 |
+
- - - 3
|
| 105 |
+
- 3
|
| 106 |
+
- 32
|
| 107 |
+
- - - 2
|
| 108 |
+
- 1
|
| 109 |
+
- 3
|
| 110 |
+
- 0.5
|
| 111 |
+
- - - 3
|
| 112 |
+
- 3
|
| 113 |
+
- 24
|
| 114 |
+
model_init: null
|
| 115 |
+
noise_data: data/voxceleb/musan/lmdb
|
| 116 |
+
num_avg: 1
|
| 117 |
+
num_epochs: 5
|
| 118 |
+
optimizer: SGD
|
| 119 |
+
optimizer_args:
|
| 120 |
+
lr: 0.0001
|
| 121 |
+
momentum: 0.9
|
| 122 |
+
nesterov: true
|
| 123 |
+
weight_decay: 2.0e-05
|
| 124 |
+
projection_args:
|
| 125 |
+
do_lm: false
|
| 126 |
+
easy_margin: false
|
| 127 |
+
embed_dim: 192
|
| 128 |
+
lanbuda: 0.7
|
| 129 |
+
margin_type: C
|
| 130 |
+
num_class: 5994
|
| 131 |
+
project_type: sphereface2
|
| 132 |
+
scale: 32.0
|
| 133 |
+
t: 3
|
| 134 |
+
reverb_data: data/voxceleb/rirs/lmdb
|
| 135 |
+
save_epoch_interval: 1
|
| 136 |
+
scheduler: ExponentialDecrease
|
| 137 |
+
scheduler_args:
|
| 138 |
+
epoch_iter: 34125
|
| 139 |
+
final_lr: 1.0e-05
|
| 140 |
+
initial_lr: 0.0001
|
| 141 |
+
num_epochs: 5
|
| 142 |
+
scale_ratio: 4.0
|
| 143 |
+
warm_from_zero: false
|
| 144 |
+
warm_up_epoch: 0
|
| 145 |
+
seed: 42
|
| 146 |
+
train_data: data/voxceleb/vox2_dev/shard.list
|
| 147 |
+
train_label: data/voxceleb/vox2_dev/utt2spk
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v2/local/prepare_data.sh
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2023 Zhengyang Chen (chenzhengyang117@gmail.com)
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
|
| 17 |
+
stage=-1
|
| 18 |
+
stop_stage=-1
|
| 19 |
+
sre_data_dir=
|
| 20 |
+
data=data
|
| 21 |
+
|
| 22 |
+
. tools/parse_options.sh || exit 1
|
| 23 |
+
|
| 24 |
+
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
| 25 |
+
mkdir -p external_tools
|
| 26 |
+
# Download voice activity detection model pretrained by Silero Team
|
| 27 |
+
wget -c https://github.com/snakers4/silero-vad/archive/refs/tags/v4.0.zip -O external_tools/silero-vad-v4.0.zip
|
| 28 |
+
unzip -o external_tools/silero-vad-v4.0.zip -d external_tools
|
| 29 |
+
fi
|
| 30 |
+
|
| 31 |
+
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
|
| 32 |
+
# The meta data for SRE16 should be pre-prepared using Kaldi recipe:
|
| 33 |
+
# https://github.com/kaldi-asr/kaldi/tree/master/egs/sre16/v2
|
| 34 |
+
for dset in swbd_sre sre sre16_major sre16_eval_enroll sre16_eval_test; do
|
| 35 |
+
mkdir -p ${data}/${dset}
|
| 36 |
+
cp ${sre_data_dir}/${dset}/wav.scp ${data}/${dset}/wav.scp
|
| 37 |
+
[ -f ${sre_data_dir}/${dset}/utt2spk ] && cp ${sre_data_dir}/${dset}/utt2spk ${data}/${dset}/utt2spk
|
| 38 |
+
[ -f ${sre_data_dir}/${dset}/spk2utt ] && cp ${sre_data_dir}/${dset}/spk2utt ${data}/${dset}/spk2utt
|
| 39 |
+
done
|
| 40 |
+
fi
|
| 41 |
+
|
| 42 |
+
if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then
|
| 43 |
+
echo "Get vad segmentation for dataset."
|
| 44 |
+
# Set VAD min duration
|
| 45 |
+
min_duration=0.255
|
| 46 |
+
for dset in swbd_sre sre16_major sre16_eval_enroll sre16_eval_test; do
|
| 47 |
+
python3 local/make_system_sad.py \
|
| 48 |
+
--repo-path external_tools/silero-vad-4.0 \
|
| 49 |
+
--scp ${data}/${dset}/wav.scp \
|
| 50 |
+
--min-duration $min_duration > ${data}/${dset}/vad
|
| 51 |
+
done
|
| 52 |
+
tools/filter_scp.pl -f 2 ${data}/sre/wav.scp ${data}/swbd_sre/vad > ${data}/sre/vad
|
| 53 |
+
|
| 54 |
+
# For PLDA training, it is better to augment the training data
|
| 55 |
+
python3 local/generate_sre_aug.py --ori_dir ${data}/sre \
|
| 56 |
+
--aug_dir ${data}/sre_aug \
|
| 57 |
+
--aug_copy_num 2
|
| 58 |
+
tools/utt2spk_to_spk2utt.pl ${data}/sre_aug/utt2spk > ${data}/sre_aug/spk2utt
|
| 59 |
+
|
| 60 |
+
fi
|
| 61 |
+
|
| 62 |
+
if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then
|
| 63 |
+
for dset in swbd_sre; do
|
| 64 |
+
python3 local/utt2voice_duration.py \
|
| 65 |
+
--vad_file ${data}/${dset}/vad \
|
| 66 |
+
--utt2voice_dur ${data}/${dset}/utt2voice_dur
|
| 67 |
+
done
|
| 68 |
+
fi
|
| 69 |
+
|
| 70 |
+
if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then
|
| 71 |
+
# Following the Kaldi recipe: https://github.com/kaldi-asr/kaldi/blob/71f38e62cad01c3078555bfe78d0f3a527422d75/egs/sre16/v2/run.sh#L189
|
| 72 |
+
# We filter out the utterances with duration less than 5s
|
| 73 |
+
for dset in swbd_sre; do
|
| 74 |
+
python3 local/filter_utt_accd_dur.py \
|
| 75 |
+
--wav_scp ${data}/${dset}/wav.scp \
|
| 76 |
+
--utt2voice_dur ${data}/${dset}/utt2voice_dur \
|
| 77 |
+
--filter_wav_scp ${data}/${dset}/filter_wav.scp \
|
| 78 |
+
--dur_thres 5.0
|
| 79 |
+
mv ${data}/${dset}/wav.scp ${data}/${dset}/wav.scp.bak
|
| 80 |
+
mv ${data}/${dset}/filter_wav.scp ${data}/${dset}/wav.scp
|
| 81 |
+
done
|
| 82 |
+
|
| 83 |
+
# Similarly, following the Kaldi recipe,
|
| 84 |
+
# we throw out speakers with fewer than 3 utterances.
|
| 85 |
+
for dset in swbd_sre; do
|
| 86 |
+
tools/fix_data_dir.sh ${data}/${dset}
|
| 87 |
+
cp ${data}/${dset}/spk2utt ${data}/${dset}/spk2utt.bak
|
| 88 |
+
awk '{if(NF>2){print $0}}' ${data}/${dset}/spk2utt.bak > ${data}/${dset}/spk2utt
|
| 89 |
+
tools/spk2utt_to_utt2spk.pl ${data}/${dset}/spk2utt > ${data}/${dset}/utt2spk
|
| 90 |
+
tools/fix_data_dir.sh ${data}/${dset}
|
| 91 |
+
done
|
| 92 |
+
fi
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v2/local/score.sh
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2022 Chengdong Liang (liangchengdong@mail.nwpu.edu.cn)
|
| 4 |
+
# 2023 Zhengyang Chen (chenhzhengyang117@gmail.com)
|
| 5 |
+
#
|
| 6 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 7 |
+
# you may not use this file except in compliance with the License.
|
| 8 |
+
# You may obtain a copy of the License at
|
| 9 |
+
#
|
| 10 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 11 |
+
#
|
| 12 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 13 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 14 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 15 |
+
# See the License for the specific language governing permissions and
|
| 16 |
+
# limitations under the License.
|
| 17 |
+
|
| 18 |
+
exp_dir=
|
| 19 |
+
trials="trials trials_tgl trials_yue"
|
| 20 |
+
data=data
|
| 21 |
+
|
| 22 |
+
stage=-1
|
| 23 |
+
stop_stage=-1
|
| 24 |
+
|
| 25 |
+
. tools/parse_options.sh
|
| 26 |
+
. path.sh
|
| 27 |
+
|
| 28 |
+
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
| 29 |
+
echo "apply cosine scoring ..."
|
| 30 |
+
mkdir -p ${exp_dir}/scores
|
| 31 |
+
trials_dir=${data}/trials
|
| 32 |
+
for x in $trials; do
|
| 33 |
+
echo $x
|
| 34 |
+
python wespeaker/bin/score.py \
|
| 35 |
+
--exp_dir ${exp_dir} \
|
| 36 |
+
--eval_scp_path ${exp_dir}/embeddings/eval/xvector.scp \
|
| 37 |
+
--cal_mean True \
|
| 38 |
+
--cal_mean_dir ${exp_dir}/embeddings/sre16_major \
|
| 39 |
+
${trials_dir}/${x}
|
| 40 |
+
done
|
| 41 |
+
fi
|
| 42 |
+
|
| 43 |
+
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
|
| 44 |
+
echo "compute metrics (EER/minDCF) ..."
|
| 45 |
+
scores_dir=${exp_dir}/scores
|
| 46 |
+
for x in $trials; do
|
| 47 |
+
python wespeaker/bin/compute_metrics.py \
|
| 48 |
+
--p_target 0.01 \
|
| 49 |
+
--c_fa 1 \
|
| 50 |
+
--c_miss 1 \
|
| 51 |
+
${scores_dir}/${x}.score \
|
| 52 |
+
2>&1 | tee -a ${scores_dir}/sre16_cos_result
|
| 53 |
+
|
| 54 |
+
echo "compute DET curve ..."
|
| 55 |
+
python wespeaker/bin/compute_det.py \
|
| 56 |
+
${scores_dir}/${x}.score
|
| 57 |
+
done
|
| 58 |
+
fi
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v2/local/score_plda.sh
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2023 Shuai Wang (wsstriving@gmail.com)
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
exp_dir=
|
| 17 |
+
trials="trials trials_tgl trials_yue"
|
| 18 |
+
data=data
|
| 19 |
+
aug_plda_data=0
|
| 20 |
+
|
| 21 |
+
stage=-1
|
| 22 |
+
stop_stage=-1
|
| 23 |
+
|
| 24 |
+
. tools/parse_options.sh
|
| 25 |
+
. path.sh
|
| 26 |
+
|
| 27 |
+
if [ $aug_plda_data = 0 ];then
|
| 28 |
+
sre_plda_data=sre
|
| 29 |
+
else
|
| 30 |
+
sre_plda_data=sre_aug
|
| 31 |
+
fi
|
| 32 |
+
|
| 33 |
+
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
| 34 |
+
echo "train the plda model ..."
|
| 35 |
+
python wespeaker/bin/train_plda.py \
|
| 36 |
+
--exp_dir ${exp_dir} \
|
| 37 |
+
--scp_path ${exp_dir}/embeddings/${sre_plda_data}/xvector.scp \
|
| 38 |
+
--utt2spk ${data}/${sre_plda_data}/utt2spk \
|
| 39 |
+
--indim 256 \
|
| 40 |
+
--iter 10
|
| 41 |
+
echo "plda training finished"
|
| 42 |
+
fi
|
| 43 |
+
|
| 44 |
+
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
|
| 45 |
+
echo "adapt the plda model ..."
|
| 46 |
+
python wespeaker/bin/adapt_plda.py \
|
| 47 |
+
-mo ${exp_dir}/plda \
|
| 48 |
+
-ma ${exp_dir}/plda_adapt \
|
| 49 |
+
-ad ${exp_dir}/embeddings/sre16_major/xvector.scp \
|
| 50 |
+
-ws 0.75 \
|
| 51 |
+
-as 0.25
|
| 52 |
+
echo "plda adapted finished"
|
| 53 |
+
fi
|
| 54 |
+
|
| 55 |
+
if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then
|
| 56 |
+
echo "apply plda scoring ..."
|
| 57 |
+
mkdir -p ${exp_dir}/scores
|
| 58 |
+
trials_dir=${data}/trials
|
| 59 |
+
for x in $trials; do
|
| 60 |
+
echo "scoring on " $x
|
| 61 |
+
python wespeaker/bin/eval_plda.py \
|
| 62 |
+
--enroll_scp_path ${exp_dir}/embeddings/sre16_eval_enroll/xvector.scp \
|
| 63 |
+
--test_scp_path ${exp_dir}/embeddings/sre16_eval_test/xvector.scp \
|
| 64 |
+
--indomain_scp ${exp_dir}/embeddings/sre16_major/xvector.scp \
|
| 65 |
+
--utt2spk data/sre16_eval_enroll/utt2spk \
|
| 66 |
+
--trial ${trials_dir}/${x} \
|
| 67 |
+
--score_path ${exp_dir}/scores/${x}.pldascore \
|
| 68 |
+
--model_path ${exp_dir}/plda_adapt
|
| 69 |
+
done
|
| 70 |
+
fi
|
| 71 |
+
|
| 72 |
+
if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then
|
| 73 |
+
echo "compute metrics (EER/minDCF) ..."
|
| 74 |
+
scores_dir=${exp_dir}/scores
|
| 75 |
+
for x in $trials; do
|
| 76 |
+
python wespeaker/bin/compute_metrics.py \
|
| 77 |
+
--p_target 0.01 \
|
| 78 |
+
--c_fa 1 \
|
| 79 |
+
--c_miss 1 \
|
| 80 |
+
${scores_dir}/${x}.pldascore \
|
| 81 |
+
2>&1 | tee -a ${scores_dir}/sre16_plda_result
|
| 82 |
+
|
| 83 |
+
echo "compute DET curve ..."
|
| 84 |
+
python wespeaker/bin/compute_det.py \
|
| 85 |
+
${scores_dir}/${x}.pldascore
|
| 86 |
+
done
|
| 87 |
+
fi
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v2/local/utt2voice_duration.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2023 Zhengyang Chen
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
import fire
|
| 16 |
+
from collections import OrderedDict
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def main(vad_file, utt2voice_dur):
|
| 20 |
+
utt2voice_dur_dict = OrderedDict()
|
| 21 |
+
|
| 22 |
+
with open(vad_file, 'r') as f:
|
| 23 |
+
for line in f.readlines():
|
| 24 |
+
segs = line.strip().split()
|
| 25 |
+
utt, start, end = segs[-3], float(segs[-2]), float(segs[-1])
|
| 26 |
+
if utt not in utt2voice_dur_dict:
|
| 27 |
+
utt2voice_dur_dict[utt] = 0.0
|
| 28 |
+
utt2voice_dur_dict[utt] += end - start
|
| 29 |
+
|
| 30 |
+
with open(utt2voice_dur, 'w') as f:
|
| 31 |
+
for utt, duration in utt2voice_dur_dict.items():
|
| 32 |
+
f.write('{} {}\n'.format(utt, duration))
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
if __name__ == "__main__":
|
| 36 |
+
fire.Fire(main)
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v2/path.sh
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export PATH=$PWD:$PATH
|
| 2 |
+
|
| 3 |
+
# NOTE(kan-bayashi): Use UTF-8 in Python to avoid UnicodeDecodeError when LC_ALL=C
|
| 4 |
+
export PYTHONIOENCODING=UTF-8
|
| 5 |
+
export PYTHONPATH=../../../:$PYTHONPATH
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v2/run.sh
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright 2022 Hongji Wang (jijijiang77@gmail.com)
|
| 4 |
+
# 2022 Chengdong Liang (liangchengdong@mail.nwpu.edu.cn)
|
| 5 |
+
# 2023 Zhengyang Chen (chenzhengyang117@gmail.com)
|
| 6 |
+
|
| 7 |
+
. ./path.sh || exit 1
|
| 8 |
+
|
| 9 |
+
stage=-1
|
| 10 |
+
stop_stage=-1
|
| 11 |
+
|
| 12 |
+
HOST_NODE_ADDR="localhost:29400"
|
| 13 |
+
num_nodes=1
|
| 14 |
+
job_id=2024
|
| 15 |
+
|
| 16 |
+
# the sre data should be prepared in kaldi format and stored in the following directory
|
| 17 |
+
# only wav.scp, utt2spk and spk2utt files are needed
|
| 18 |
+
sre_data_dir=sre_data_dir
|
| 19 |
+
data=data
|
| 20 |
+
data_type="shard" # shard/raw
|
| 21 |
+
# whether augment the PLDA data
|
| 22 |
+
aug_plda_data=0
|
| 23 |
+
|
| 24 |
+
config=conf/resnet.yaml
|
| 25 |
+
exp_dir=exp/ResNet34-TSTP-emb256-fbank40-num_frms200-aug0.6-spFalse-saFalse-Softmax-SGD-epoch150
|
| 26 |
+
gpus="[0,1]"
|
| 27 |
+
num_avg=10
|
| 28 |
+
checkpoint=
|
| 29 |
+
|
| 30 |
+
trials="trials trials_tgl trials_yue"
|
| 31 |
+
|
| 32 |
+
. tools/parse_options.sh || exit 1
|
| 33 |
+
|
| 34 |
+
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
| 35 |
+
echo "Prepare datasets ..."
|
| 36 |
+
./local/prepare_data.sh --stage 2 --stop_stage 5 --sre_data_dir ${sre_data_dir} --data ${data}
|
| 37 |
+
fi
|
| 38 |
+
|
| 39 |
+
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
|
| 40 |
+
echo "Convert train data to ${data_type}..."
|
| 41 |
+
for dset in swbd_sre; do
|
| 42 |
+
python tools/make_shard_list.py --num_utts_per_shard 1000 \
|
| 43 |
+
--num_threads 16 \
|
| 44 |
+
--prefix shards \
|
| 45 |
+
--shuffle \
|
| 46 |
+
--vad_file ${data}/$dset/vad \
|
| 47 |
+
${data}/$dset/wav.scp ${data}/$dset/utt2spk \
|
| 48 |
+
${data}/$dset/shards ${data}/$dset/shard.list
|
| 49 |
+
done
|
| 50 |
+
|
| 51 |
+
echo "Convert data for PLDA backend training and evaluation to raw format..."
|
| 52 |
+
if [ $aug_plda_data = 0 ];then
|
| 53 |
+
sre_plda_data=sre
|
| 54 |
+
else
|
| 55 |
+
sre_plda_data=sre_aug
|
| 56 |
+
fi
|
| 57 |
+
for dset in ${sre_plda_data} sre16_major sre16_eval_enroll sre16_eval_test; do
|
| 58 |
+
python tools/make_raw_list.py --vad_file ${data}/$dset/vad \
|
| 59 |
+
${data}/$dset/wav.scp \
|
| 60 |
+
${data}/$dset/utt2spk ${data}/$dset/raw.list
|
| 61 |
+
|
| 62 |
+
done
|
| 63 |
+
# Convert all musan data to LMDB
|
| 64 |
+
python tools/make_lmdb.py ${data}/musan/wav.scp ${data}/musan/lmdb
|
| 65 |
+
# Convert all rirs data to LMDB
|
| 66 |
+
python tools/make_lmdb.py ${data}/rirs/wav.scp ${data}/rirs/lmdb
|
| 67 |
+
fi
|
| 68 |
+
|
| 69 |
+
if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then
|
| 70 |
+
echo "Start training ..."
|
| 71 |
+
num_gpus=$(echo $gpus | awk -F ',' '{print NF}')
|
| 72 |
+
echo "$0: num_nodes is $num_nodes, proc_per_node is $num_gpus"
|
| 73 |
+
torchrun --nnodes=$num_nodes --nproc_per_node=$num_gpus \
|
| 74 |
+
--rdzv_id=$job_id --rdzv_backend="c10d" --rdzv_endpoint=$HOST_NODE_ADDR \
|
| 75 |
+
wespeaker/bin/train.py --config $config \
|
| 76 |
+
--exp_dir ${exp_dir} \
|
| 77 |
+
--gpus $gpus \
|
| 78 |
+
--num_avg ${num_avg} \
|
| 79 |
+
--data_type "${data_type}" \
|
| 80 |
+
--train_data ${data}/swbd_sre/${data_type}.list \
|
| 81 |
+
--train_label ${data}/swbd_sre/utt2spk \
|
| 82 |
+
--reverb_data ${data}/rirs/lmdb \
|
| 83 |
+
--noise_data ${data}/musan/lmdb \
|
| 84 |
+
${checkpoint:+--checkpoint $checkpoint}
|
| 85 |
+
fi
|
| 86 |
+
|
| 87 |
+
if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then
|
| 88 |
+
echo "Do model average ..."
|
| 89 |
+
avg_model=$exp_dir/models/avg_model.pt
|
| 90 |
+
python wespeaker/bin/average_model.py \
|
| 91 |
+
--dst_model $avg_model \
|
| 92 |
+
--src_path $exp_dir/models \
|
| 93 |
+
--num ${num_avg}
|
| 94 |
+
|
| 95 |
+
model_path=$avg_model
|
| 96 |
+
if [[ $config == *repvgg*.yaml ]]; then
|
| 97 |
+
echo "convert repvgg model ..."
|
| 98 |
+
python wespeaker/models/convert_repvgg.py \
|
| 99 |
+
--config $exp_dir/config.yaml \
|
| 100 |
+
--load $avg_model \
|
| 101 |
+
--save $exp_dir/models/convert_model.pt
|
| 102 |
+
model_path=$exp_dir/models/convert_model.pt
|
| 103 |
+
fi
|
| 104 |
+
|
| 105 |
+
echo "Extract embeddings ..."
|
| 106 |
+
local/extract_sre.sh \
|
| 107 |
+
--exp_dir $exp_dir --model_path $model_path \
|
| 108 |
+
--nj 32 --gpus $gpus --data_type raw --data ${data} \
|
| 109 |
+
--reverb_data ${data}/rirs/lmdb \
|
| 110 |
+
--noise_data ${data}/musan/lmdb \
|
| 111 |
+
--aug_plda_data ${aug_plda_data}
|
| 112 |
+
fi
|
| 113 |
+
|
| 114 |
+
if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then
|
| 115 |
+
echo "Score using Cosine Distance..."
|
| 116 |
+
local/score.sh \
|
| 117 |
+
--stage 1 --stop-stage 2 \
|
| 118 |
+
--data ${data} \
|
| 119 |
+
--exp_dir $exp_dir \
|
| 120 |
+
--trials "$trials"
|
| 121 |
+
fi
|
| 122 |
+
|
| 123 |
+
if [ ${stage} -le 6 ] && [ ${stop_stage} -ge 6 ]; then
|
| 124 |
+
echo "Score with adapted PLDA ..."
|
| 125 |
+
local/score_plda.sh \
|
| 126 |
+
--stage 1 --stop-stage 4 \
|
| 127 |
+
--data ${data} \
|
| 128 |
+
--exp_dir $exp_dir \
|
| 129 |
+
--aug_plda_data ${aug_plda_data} \
|
| 130 |
+
--trials "$trials"
|
| 131 |
+
fi
|
| 132 |
+
|
| 133 |
+
if [ ${stage} -le 7 ] && [ ${stop_stage} -ge 7 ]; then
|
| 134 |
+
echo "Export the best model ..."
|
| 135 |
+
python wespeaker/bin/export_jit.py \
|
| 136 |
+
--config $exp_dir/config.yaml \
|
| 137 |
+
--checkpoint $exp_dir/models/avg_model.pt \
|
| 138 |
+
--output_file $exp_dir/models/final.zip
|
| 139 |
+
fi
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/README
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Changed a little in make_system_sad.py to make split a large data set in parts
|
| 2 |
+
when extracting VAD. It took ages to start otherwise and this will also be
|
| 3 |
+
helpful in case there is a crash since output is saved after each part instead
|
| 4 |
+
of after the whole set.
|
| 5 |
+
|
| 6 |
+
# We use some scripts from Kaldi (combine_data.sh and fix_data_dir.sh)
|
| 7 |
+
|
| 8 |
+
# This should not be needed anymore.
|
| 9 |
+
# ln -s $KALDI_ROOT/egs/wsj/s5/utils
|
| 10 |
+
# export PATH=$PATH:$(pwd)/utils/ # This is necessary since some Kaldi scripts assume other Kaldi scripts exists in the path.
|
| 11 |
+
#export PATH=$PATH:$KALDI_ROOT/
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
CTS
|
| 15 |
+
spk / utt
|
| 16 |
+
Org. data 6867 / 605760
|
| 17 |
+
After VAD 6867 / 605704
|
| 18 |
+
After removing T < 5s 6867 / 604774
|
| 19 |
+
After removing utt/spk < 3 6867 / 604774
|
| 20 |
+
|
| 21 |
+
VOX
|
| 22 |
+
spk / utt
|
| 23 |
+
Org. data 7245 / 1245525
|
| 24 |
+
After VAD 7245 / 1245469
|
| 25 |
+
After removing T < 5s 7245 / 816385
|
| 26 |
+
After removing utt/spk < 3 7245 / 816385
|
| 27 |
+
|
| 28 |
+
Total
|
| 29 |
+
After removing utt/spk < 3 14112 / 1421159
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Main differences from ../v2
|
| 2 |
+
* The training data is the CTS superset plus VoxCeleb with GSM codec
|
| 3 |
+
* The test data is SRE16, SRE18, and SRE21
|
| 4 |
+
* Preprocessing of embeddings before backend/scoring is supported
|
| 5 |
+
|
| 6 |
+
### Important
|
| 7 |
+
Similarly to ../v2, this recipe uses silero vad https://github.com/snakers4/silero-vad
|
| 8 |
+
downloaded from here https://github.com/snakers4/silero-vad/archive/refs/tags/v4.0.zip
|
| 9 |
+
If you intended to use this recipe for an evaluation/competition, make sure to check that
|
| 10 |
+
it is allowed to use the data that has been used to train Silero.
|
| 11 |
+
|
| 12 |
+
### Instructions
|
| 13 |
+
* Set the paths in stage 1. The variable ```sre_data_dir``` is assumed to be prepared by
|
| 14 |
+
Kaldi (https://github.com/kaldi-asr/kaldi/tree/master/egs/sre16/v2).
|
| 15 |
+
Only the eval and unlabeled (major) data of sre16 is taken from there.
|
| 16 |
+
```voxceleb_dir``` is the path to voxceleb prepared by wespeaker (```../../voxceleb/v2```).
|
| 17 |
+
If you set it to "" (empty string), the preparation will be run here. For the other datasets,
|
| 18 |
+
the path to the folder provided by LDA should be provided. The relevant LDC numbers and
|
| 19 |
+
file names of the data can be seen in the script. If you don't have
|
| 20 |
+
one or two of the "eval/dev" sets of "sre16", "sre18" or "sre21" and not specify it, you may
|
| 21 |
+
have to comment it from some more places in order to avoided crashes. (Eventually
|
| 22 |
+
the script will hopefully be made more robust to this.)
|
| 23 |
+
If you don't have the CTS superset data, you can skip stage 5 in ```local/prepare_data.sh```
|
| 24 |
+
and instead replace the CTS data it with some other data, e.g., the training data prepared in ```../v2```
|
| 25 |
+
If so, it is probably the easiest to name this data "CTS" since this name is assumed later
|
| 26 |
+
in the recipe.
|
| 27 |
+
* Select which torchrun command to use in stage 3. The first line
|
| 28 |
+
(currently commented) is for "single-node, multi-worker" (one
|
| 29 |
+
pytorch job per machine). The second line is for "Stacked
|
| 30 |
+
single-node multi-worker" (more than one pytorch job may be
|
| 31 |
+
submitted to the same node in your cluster.) See
|
| 32 |
+
https://pytorch.org/docs/stable/elastic/run.html for explanations.
|
| 33 |
+
* Stage 3 (training) and stage 4 (embedding extraction) need GPU. You may have
|
| 34 |
+
to arrange how to run these parts based on your environment.
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
### Explanation of embedding processing
|
| 38 |
+
|
| 39 |
+
The code supports flexible combinations of embedding processing steps, such as length-norm and LDA.
|
| 40 |
+
A processing chain is specified e.g., as follows
|
| 41 |
+
```
|
| 42 |
+
mean-subtract --scp $mean1_scp | length-norm | lda --scp $lda_scp --utt2spk $utt2spk --dim $lda_dim | length-norm"
|
| 43 |
+
```
|
| 44 |
+
The script ```wespeaker/bin/prep_embd_proc.py``` takes such a processing chain as input, loops through the processing steps (separated by ```|```), calculates
|
| 45 |
+
the necessary processing parameters (means, lda transforms etc.) and stores the whole processing chain with parameters in
|
| 46 |
+
pickle format. The parameters for each step will be calculated sequentially and the data specified for the parameter estimation of a step will
|
| 47 |
+
be processed by the earlier steps. Therefore the data for the different steps can be different. For example when estimating LDA in the above chain, the data given by ```$lda_scp``` will first be processed by ```mean-subtract``` whose parameters were estimated by ```$mean1_scp``` which could be a different dataset.
|
| 48 |
+
In scenarios where unlabeled domain adaptation data is available, we want to use this data for the first mean subtraction while still using the out domain data for LDA estimation. This CANNOT be achieved by specifying the processing chain
|
| 49 |
+
```
|
| 50 |
+
mean-subtract --scp $indomain_scp | length-norm | lda --scp $lda_scp --utt2spk $utt2spk --dim $lda_dim | length-norm
|
| 51 |
+
```
|
| 52 |
+
since this would have the consequence that in LDA estimation, the data (```$lda_scp```) would be subjected to mean subtraction
|
| 53 |
+
using the mean of the indomain data (```$indomain_scp```). To solve this, we have an additional script ```wespeaker/bin/update_embd_proc.py``` used as follows
|
| 54 |
+
```
|
| 55 |
+
new_link="mean-subtract --scp $indomain_scp"
|
| 56 |
+
python wespeaker/bin/update_embd_proc.py --in_path $preprocessing_path_cts_aug --out_path $preprocessing_path_sre18_unlab --link_no_to_remove 0 --new_link "$new_link"
|
| 57 |
+
```
|
| 58 |
+
where ```$preprocessing_path_cts_aug``` is the path to the pickled original processing chain and ```$preprocessing_path_sre18_unlab``` is the path to the new pickled processing chain.
|
| 59 |
+
The script will remove link 0, e.g. ```mean-subtract --scp $mean1_scp``` and replace it with ```mean-subtract --scp $indomain_scp```.
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
### Regarding extractor training data pruning
|
| 63 |
+
|
| 64 |
+
Similarly to ```../v2``` and Kaldi's sre16 recipe, we discard some of the training utterances based on duration as well as training speakers based on their number of utterances.
|
| 65 |
+
This is controlled in stage 9 of ```local/prepare_data.sh```. It is quite flexible but currently a bit messy and some consequences of the settings are not obvious. Therefore some explanation is provided here.
|
| 66 |
+
There are three "blocks" in stage 9:
|
| 67 |
+
* The first block discards all utterances shorter or equal to some specified duration (currently set to 5s) according to VOICED DURATION.
|
| 68 |
+
* The second block discards all utterances shorter or equal to some specified duration (currently set to 5s) according to TOTAL DURATION, i.e., ignoring VAD info.
|
| 69 |
+
* The third block discards all speakers that has less than or equal to a specified number of utterances. (Currently set to 2, i.e. speaker with 3 or more utterances are kept.)
|
| 70 |
+
It is possible to set the thresholds differently for the different sets. IMPORTANT: The pruning in block 1 is based on ```data/data_set_name/utt2voice_dur``` which is calculated
|
| 71 |
+
from the VAD info, so if a recording does not have any speech, it will not be present in utt2voice_dur and therefore discarded in this block even if the duration threshold is
|
| 72 |
+
set to e.g. -1. If we want such utterances to be kept for one set we should not run this block for the set (as currently is the case for voxceleb). The current setup is as follows:
|
| 73 |
+
1. Apply block one to CTS but not Voxceleb
|
| 74 |
+
2. Apply block two to Voxceleb but not CTS. (Applying this stage to CTS would not have an effect if the thresholds are the same since the total duration is always larger or equal to the voiced duration.)
|
| 75 |
+
3. Apply stage three to both CTS and VoxCeleb.
|
| 76 |
+
|
| 77 |
+
This means Voxceleb recordings are kept even if they have no speech accordng to VAD. The later shard creation stage applies VAD if available, otherwise keeps the file as it is. So Voxceleb recording with no speech according to VAD will NOT be discarded (but there are only around 70 of them which is unlikely to have any effect on the trained system.). Also, there is a risk that pruning according to total duration while applying VAD in shard creation could result in recordings shorter than "num_frms". These will be zero padded at training time so there will be no crash but this is probably also suboptimal.
|
| 78 |
+
These is setting are arguably somewhat weird. Applying block one also to voxceleb (and not using block two at all) would be more reasonable but it seems to degrade the performance due to discarding too many files. A better solution than the current would be to try with smaller thresholds than 5s but we have had not had time to explore this yet. Also, it would be reasonable to discard recordings with no speech according to VAD in the shard creation stage. However, when no VAD is available for a file, the shard creation code does not know whether this is because no speech was detected for this file according to VAD, or because VAD was not ran for this file. Since we want to have the possibility to keep recordings for which the latter is the case, we have it this way (it could for example be considered not to use VAD for voxceleb at all, in which case we need to avoid discarding these files at the shard creation stage). A more flexible and clear solution is needed and we will work on this for future updates.
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
### Some data statistics
|
| 82 |
+
| | CTS #utt | CTS #spk | CTS #utt | CTS #spk | comment|
|
| 83 |
+
| --- | --- | --- | --- | --- | --- |
|
| 84 |
+
|Original data | 605760 | 6867 | 1245525 | 7245 | |
|
| 85 |
+
|exclud recording with nospeech acording to VAD| 605704 | 6867 | 1245455 | 7245 | VAD is a bit random so these numbers could vary slightly, especially for voxceleb. |
|
| 86 |
+
|After filtering according voiced duration | 604774 | 6867 | 816411 | 7245 | Accordingly, here too. We don't use this for voxceleb in the current settings. |
|
| 87 |
+
|After filtering according total duration | - | - | 868326 | 7245 | Haven't checked this for CTS.
|
| 88 |
+
|
| 89 |
+
No speaker are discarded in block three with the current setting.
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
### Things to explore
|
| 93 |
+
Very few things have been tuned. For example the following could be low-hanging fruits:
|
| 94 |
+
* The above mentioned pruning rules
|
| 95 |
+
* Utterance durations of the training segments.
|
| 96 |
+
* Shall voxceleb be included? Is applying the GSM codec a good idea? (Note that GSM codec is applied in the data preparation stage while augmentation is applied at training time, i.e, GSM codec comes before augmentations. This is not so realistic, since in reality noise and reverberation comes before the data is recorded and encoded. However, it is consistent with CTS where we also apply augmentations at the already encoded audio since it was encoded at recording time.)
|
| 97 |
+
* The other architectures.
|
| 98 |
+
|
| 99 |
+
We will tune this futher in the future. We are also happy to hear about any such results obtained by others.
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/conf/resnet.yaml
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### train configuration
|
| 2 |
+
|
| 3 |
+
exp_dir: exp/ResNet34-TSTP-emb256-fbank40-num_frms200-aug0.6-spFalse-saFalse-Softmax-SGD-epoch150
|
| 4 |
+
gpus: "[0,1]"
|
| 5 |
+
num_avg: 10
|
| 6 |
+
enable_amp: False # whether enable automatic mixed precision training
|
| 7 |
+
|
| 8 |
+
seed: 42
|
| 9 |
+
num_epochs: 150
|
| 10 |
+
save_epoch_interval: 5 # save model every 5 epochs
|
| 11 |
+
log_batch_interval: 100 # log every 100 batchs
|
| 12 |
+
|
| 13 |
+
dataloader_args:
|
| 14 |
+
batch_size: 256
|
| 15 |
+
num_workers: 7 # Total number of cores will be (this +1)*num_gpus
|
| 16 |
+
pin_memory: False
|
| 17 |
+
prefetch_factor: 8
|
| 18 |
+
drop_last: True
|
| 19 |
+
|
| 20 |
+
dataset_args:
|
| 21 |
+
# the sample number which will be traversed within one epoch, if the value equals to 0,
|
| 22 |
+
# the utterance number in the dataset will be used as the sample_num_per_epoch.
|
| 23 |
+
sample_num_per_epoch: 780000
|
| 24 |
+
shuffle: True
|
| 25 |
+
shuffle_args:
|
| 26 |
+
shuffle_size: 1500
|
| 27 |
+
filter: True
|
| 28 |
+
filter_args:
|
| 29 |
+
min_num_frames: 100
|
| 30 |
+
max_num_frames: 300
|
| 31 |
+
resample_rate: 8000
|
| 32 |
+
speed_perturb: False
|
| 33 |
+
num_frms: 200
|
| 34 |
+
aug_prob: 0.6 # prob to add reverb & noise aug per sample
|
| 35 |
+
fbank_args:
|
| 36 |
+
num_mel_bins: 64
|
| 37 |
+
frame_shift: 10
|
| 38 |
+
frame_length: 25
|
| 39 |
+
dither: 1.0
|
| 40 |
+
spec_aug: False
|
| 41 |
+
spec_aug_args:
|
| 42 |
+
num_t_mask: 1
|
| 43 |
+
num_f_mask: 1
|
| 44 |
+
max_t: 10
|
| 45 |
+
max_f: 8
|
| 46 |
+
prob: 0.6
|
| 47 |
+
|
| 48 |
+
model: ResNet34 # ResNet18, ResNet34, ResNet50, ResNet101, ResNet152
|
| 49 |
+
model_init: null
|
| 50 |
+
model_args:
|
| 51 |
+
feat_dim: 64
|
| 52 |
+
embed_dim: 256
|
| 53 |
+
pooling_func: "TSTP" # TSTP, ASTP, MQMHASTP
|
| 54 |
+
two_emb_layer: False
|
| 55 |
+
projection_args:
|
| 56 |
+
project_type: "softmax" # add_margin, arc_margin, sphere, softmax, arc_margin_intertopk_subcenter
|
| 57 |
+
|
| 58 |
+
margin_scheduler: MarginScheduler
|
| 59 |
+
margin_update:
|
| 60 |
+
initial_margin: 0.0
|
| 61 |
+
final_margin: 0.2
|
| 62 |
+
increase_start_epoch: 20
|
| 63 |
+
fix_start_epoch: 40
|
| 64 |
+
update_margin: True
|
| 65 |
+
increase_type: "exp" # exp, linear
|
| 66 |
+
|
| 67 |
+
loss: CrossEntropyLoss
|
| 68 |
+
loss_args: {}
|
| 69 |
+
|
| 70 |
+
optimizer: SGD
|
| 71 |
+
optimizer_args:
|
| 72 |
+
momentum: 0.9
|
| 73 |
+
nesterov: True
|
| 74 |
+
weight_decay: 0.0001
|
| 75 |
+
|
| 76 |
+
scheduler: ExponentialDecrease
|
| 77 |
+
scheduler_args:
|
| 78 |
+
initial_lr: 0.1
|
| 79 |
+
final_lr: 0.00005
|
| 80 |
+
warm_up_epoch: 6
|
| 81 |
+
warm_from_zero: True
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/create_preproc_embd_lists.sh
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2024 Johan Rohdin (rohdin@fit.vutbr.cz)
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
# The preprocessed embeddings are already stored but we need to create the lists
|
| 19 |
+
# as score.sh wants them.
|
| 20 |
+
|
| 21 |
+
exp_dir=$1
|
| 22 |
+
data=data
|
| 23 |
+
|
| 24 |
+
# We have three different preprocessors for which we need to prepare the lists
|
| 25 |
+
# embd_proc_cts_aug.pkl # LDA and cts_aug mean subtraction
|
| 26 |
+
# embd_proc_sre16_major.pkl # LDA and sre16_major mean subtracion (Only used for SRE16)
|
| 27 |
+
# embd_proc_sre18_dev_unlabeled.pkl # LDA and sre18_dev_unlabeled mean subtracion (Only used for SRE18)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
### !!!
|
| 31 |
+
# Note that xvector2 is only a hack for BUT
|
| 32 |
+
|
| 33 |
+
##################################################################
|
| 34 |
+
# CTS AUG for all sets
|
| 35 |
+
echo "mean vector of enroll"
|
| 36 |
+
python tools/vector_mean.py \
|
| 37 |
+
--spk2utt ${data}/sre16/eval/enrollment/spk2utt \
|
| 38 |
+
--xvector_scp $exp_dir/embeddings/sre16/eval/enrollment/xvector_proc_embd_proc_cts_aug.scp \
|
| 39 |
+
--spk_xvector_ark $exp_dir/embeddings/sre16/eval/enrollment/enroll_spk_xvector_proc_embd_proc_cts_aug.ark
|
| 40 |
+
|
| 41 |
+
python tools/vector_mean.py \
|
| 42 |
+
--spk2utt ${data}/sre18/dev/enrollment/mdl_id2utt \
|
| 43 |
+
--xvector_scp $exp_dir/embeddings/sre18/dev/enrollment/xvector_proc_embd_proc_cts_aug.scp \
|
| 44 |
+
--spk_xvector_ark $exp_dir/embeddings/sre18/dev/enrollment/enroll_spk_xvector_proc_embd_proc_cts_aug.ark
|
| 45 |
+
|
| 46 |
+
python tools/vector_mean.py \
|
| 47 |
+
--spk2utt ${data}/sre18/eval/enrollment/mdl_id2utt \
|
| 48 |
+
--xvector_scp $exp_dir/embeddings/sre18/eval/enrollment/xvector_proc_embd_proc_cts_aug.scp \
|
| 49 |
+
--spk_xvector_ark $exp_dir/embeddings/sre18/eval/enrollment/enroll_spk_xvector_proc_embd_proc_cts_aug.ark
|
| 50 |
+
|
| 51 |
+
python tools/vector_mean.py \
|
| 52 |
+
--spk2utt ${data}/sre21/dev/enrollment/mdl_id2utt \
|
| 53 |
+
--xvector_scp $exp_dir/embeddings/sre21/dev/enrollment/xvector_proc_embd_proc_cts_aug.scp \
|
| 54 |
+
--spk_xvector_ark $exp_dir/embeddings/sre21/dev/enrollment/enroll_spk_xvector_proc_embd_proc_cts_aug.ark
|
| 55 |
+
|
| 56 |
+
python tools/vector_mean.py \
|
| 57 |
+
--spk2utt ${data}/sre21/eval/enrollment/mdl_id2utt \
|
| 58 |
+
--xvector_scp $exp_dir/embeddings/sre21/eval/enrollment/xvector_proc_embd_proc_cts_aug.scp \
|
| 59 |
+
--spk_xvector_ark $exp_dir/embeddings/sre21/eval/enrollment/enroll_spk_xvector_proc_embd_proc_cts_aug.ark
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
# Create one scp with both enroll and test since this is expected by some scripts
|
| 63 |
+
cat ${exp_dir}/embeddings/sre16/eval/enrollment/enroll_spk_xvector_proc_embd_proc_cts_aug.scp \
|
| 64 |
+
${exp_dir}/embeddings/sre16/eval/test/xvector_proc_embd_proc_cts_aug.scp \
|
| 65 |
+
> ${exp_dir}/embeddings/sre16/eval/xvector_proc_embd_proc_cts_aug.scp
|
| 66 |
+
|
| 67 |
+
cat ${exp_dir}/embeddings/sre18/dev/enrollment/enroll_spk_xvector_proc_embd_proc_cts_aug.scp \
|
| 68 |
+
${exp_dir}/embeddings/sre18/dev/test/xvector_proc_embd_proc_cts_aug.scp \
|
| 69 |
+
> ${exp_dir}/embeddings/sre18/dev/xvector_proc_embd_proc_cts_aug.scp
|
| 70 |
+
|
| 71 |
+
cat ${exp_dir}/embeddings/sre18/eval/enrollment/enroll_spk_xvector_proc_embd_proc_cts_aug.scp \
|
| 72 |
+
${exp_dir}/embeddings/sre18/eval/test/xvector_proc_embd_proc_cts_aug.scp \
|
| 73 |
+
> ${exp_dir}/embeddings/sre18/eval/xvector_proc_embd_proc_cts_aug.scp
|
| 74 |
+
|
| 75 |
+
cat ${exp_dir}/embeddings/sre21/dev/enrollment/enroll_spk_xvector_proc_embd_proc_cts_aug.scp \
|
| 76 |
+
${exp_dir}/embeddings/sre21/dev/test/xvector_proc_embd_proc_cts_aug.scp \
|
| 77 |
+
> ${exp_dir}/embeddings/sre21/dev/xvector_proc_embd_proc_cts_aug.scp
|
| 78 |
+
|
| 79 |
+
cat ${exp_dir}/embeddings/sre21/eval/enrollment/enroll_spk_xvector_proc_embd_proc_cts_aug.scp \
|
| 80 |
+
${exp_dir}/embeddings/sre21/eval/test/xvector_proc_embd_proc_cts_aug.scp \
|
| 81 |
+
> ${exp_dir}/embeddings/sre21/eval/xvector_proc_embd_proc_cts_aug.scp
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
##################################################################
|
| 85 |
+
# sre16_major for sre16 eval
|
| 86 |
+
echo "mean vector of enroll"
|
| 87 |
+
python tools/vector_mean.py \
|
| 88 |
+
--spk2utt ${data}/sre16/eval/enrollment/spk2utt \
|
| 89 |
+
--xvector_scp $exp_dir/embeddings/sre16/eval/enrollment/xvector_proc_embd_proc_sre16_major.scp \
|
| 90 |
+
--spk_xvector_ark $exp_dir/embeddings/sre16/eval/enrollment/enroll_spk_xvector_proc_embd_proc_sre16_major.ark
|
| 91 |
+
|
| 92 |
+
# Create one scp with both enroll and test since this is expected by some scripts
|
| 93 |
+
cat ${exp_dir}/embeddings/sre16/eval/enrollment/enroll_spk_xvector_proc_embd_proc_sre16_major.scp \
|
| 94 |
+
${exp_dir}/embeddings/sre16/eval/test/xvector_proc_embd_proc_sre16_major.scp \
|
| 95 |
+
> ${exp_dir}/embeddings/sre16/eval/xvector_proc_embd_proc_sre16_major.scp
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
##################################################################
|
| 99 |
+
# sre18_dev_unlabeled for sre18 dev/eval
|
| 100 |
+
echo "mean vector of enroll"
|
| 101 |
+
python tools/vector_mean.py \
|
| 102 |
+
--spk2utt ${data}/sre18/dev/enrollment/mdl_id2utt \
|
| 103 |
+
--xvector_scp $exp_dir/embeddings/sre18/dev/enrollment/xvector_proc_embd_proc_sre18_dev_unlabeled.scp \
|
| 104 |
+
--spk_xvector_ark $exp_dir/embeddings/sre18/dev/enrollment/enroll_spk_xvector_proc_embd_proc_sre18_dev_unlabeled.ark
|
| 105 |
+
|
| 106 |
+
python tools/vector_mean.py \
|
| 107 |
+
--spk2utt ${data}/sre18/eval/enrollment/mdl_id2utt \
|
| 108 |
+
--xvector_scp $exp_dir/embeddings/sre18/eval/enrollment/xvector_proc_embd_proc_sre18_dev_unlabeled.scp \
|
| 109 |
+
--spk_xvector_ark $exp_dir/embeddings/sre18/eval/enrollment/enroll_spk_xvector_proc_embd_proc_sre18_dev_unlabeled.ark
|
| 110 |
+
|
| 111 |
+
# Create one scp with both enroll and test since this is expected by some scripts
|
| 112 |
+
cat ${exp_dir}/embeddings/sre18/dev/enrollment/enroll_spk_xvector_proc_embd_proc_sre18_dev_unlabeled.scp \
|
| 113 |
+
${exp_dir}/embeddings/sre18/dev/test/xvector_proc_embd_proc_sre18_dev_unlabeled.scp \
|
| 114 |
+
> ${exp_dir}/embeddings/sre18/dev/xvector_proc_embd_proc_sre18_dev_unlabeled.scp
|
| 115 |
+
|
| 116 |
+
cat ${exp_dir}/embeddings/sre18/eval/enrollment/enroll_spk_xvector_proc_embd_proc_sre18_dev_unlabeled.scp \
|
| 117 |
+
${exp_dir}/embeddings/sre18/eval/test/xvector_proc_embd_proc_sre18_dev_unlabeled.scp \
|
| 118 |
+
> ${exp_dir}/embeddings/sre18/eval/xvector_proc_embd_proc_sre18_dev_unlabeled.scp
|
| 119 |
+
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/download_data.sh
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2022 Hongji Wang (jijijiang77@gmail.com)
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
|
| 17 |
+
download_dir=data/download_data
|
| 18 |
+
|
| 19 |
+
. tools/parse_options.sh || exit 1
|
| 20 |
+
|
| 21 |
+
[ ! -d ${download_dir} ] && mkdir -p ${download_dir}
|
| 22 |
+
|
| 23 |
+
if [ ! -f ${download_dir}/musan.tar.gz ]; then
|
| 24 |
+
echo "Downloading musan.tar.gz ..."
|
| 25 |
+
wget --no-check-certificate https://openslr.elda.org/resources/17/musan.tar.gz -P ${download_dir}
|
| 26 |
+
md5=$(md5sum ${download_dir}/musan.tar.gz | awk '{print $1}')
|
| 27 |
+
[ $md5 != "0c472d4fc0c5141eca47ad1ffeb2a7df" ] && echo "Wrong md5sum of musan.tar.gz" && exit 1
|
| 28 |
+
fi
|
| 29 |
+
|
| 30 |
+
if [ ! -f ${download_dir}/rirs_noises.zip ]; then
|
| 31 |
+
echo "Downloading rirs_noises.zip ..."
|
| 32 |
+
wget --no-check-certificate https://us.openslr.org/resources/28/rirs_noises.zip -P ${download_dir}
|
| 33 |
+
md5=$(md5sum ${download_dir}/rirs_noises.zip | awk '{print $1}')
|
| 34 |
+
[ $md5 != "e6f48e257286e05de56413b4779d8ffb" ] && echo "Wrong md5sum of rirs_noises.zip" && exit 1
|
| 35 |
+
fi
|
| 36 |
+
|
| 37 |
+
if [ ! -f ${download_dir}/vox1_test_wav.zip ]; then
|
| 38 |
+
echo "Downloading vox1_test_wav.zip ..."
|
| 39 |
+
wget --no-check-certificate https://thor.robots.ox.ac.uk/~vgg/data/voxceleb/vox1a/vox1_test_wav.zip -P ${download_dir}
|
| 40 |
+
md5=$(md5sum ${download_dir}/vox1_test_wav.zip | awk '{print $1}')
|
| 41 |
+
[ $md5 != "185fdc63c3c739954633d50379a3d102" ] && echo "Wrong md5sum of vox1_test_wav.zip" && exit 1
|
| 42 |
+
fi
|
| 43 |
+
|
| 44 |
+
if [ ! -f ${download_dir}/vox1_dev_wav.zip ]; then
|
| 45 |
+
echo "Downloading vox1_dev_wav.zip ..."
|
| 46 |
+
for part in a b c d; do
|
| 47 |
+
wget --no-check-certificate https://thor.robots.ox.ac.uk/~vgg/data/voxceleb/vox1a/vox1_dev_wav_parta${part} -P ${download_dir} &
|
| 48 |
+
done
|
| 49 |
+
wait
|
| 50 |
+
cat ${download_dir}/vox1_dev* >${download_dir}/vox1_dev_wav.zip
|
| 51 |
+
md5=$(md5sum ${download_dir}/vox1_dev_wav.zip | awk '{print $1}')
|
| 52 |
+
[ $md5 != "ae63e55b951748cc486645f532ba230b" ] && echo "Wrong md5sum of vox1_dev_wav.zip" && exit 1
|
| 53 |
+
fi
|
| 54 |
+
|
| 55 |
+
if [ ! -f ${download_dir}/vox2_aac.zip ]; then
|
| 56 |
+
echo "Downloading vox2_aac.zip ..."
|
| 57 |
+
for part in a b c d e f g h; do
|
| 58 |
+
wget --no-check-certificate https://thor.robots.ox.ac.uk/~vgg/data/voxceleb/vox1a/vox2_dev_aac_parta${part} -P ${download_dir} &
|
| 59 |
+
done
|
| 60 |
+
wait
|
| 61 |
+
cat ${download_dir}/vox2_dev_aac* >${download_dir}/vox2_aac.zip
|
| 62 |
+
md5=$(md5sum ${download_dir}/vox2_aac.zip | awk '{print $1}')
|
| 63 |
+
[ $md5 != "bbc063c46078a602ca71605645c2a402" ] && echo "Wrong md5sum of vox2_aac.zip" && exit 1
|
| 64 |
+
fi
|
| 65 |
+
|
| 66 |
+
echo "Download success !!!"
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/extract_sre.sh
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2022 Hongji Wang (jijijiang77@gmail.com)
|
| 4 |
+
# 2023 Zhengyang Chen (chenzhengyang117@gmail.com)
|
| 5 |
+
# 2024 Johan Rohdin (rohdin@fit.vutbr.cz)
|
| 6 |
+
#
|
| 7 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 8 |
+
# you may not use this file except in compliance with the License.
|
| 9 |
+
# You may obtain a copy of the License at
|
| 10 |
+
#
|
| 11 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 12 |
+
#
|
| 13 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 14 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 15 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 16 |
+
# See the License for the specific language governing permissions and
|
| 17 |
+
# limitations under the License.
|
| 18 |
+
|
| 19 |
+
exp_dir=''
|
| 20 |
+
model_path=''
|
| 21 |
+
nj=4
|
| 22 |
+
gpus="[0,1]"
|
| 23 |
+
data_type="shard" # shard/raw/feat
|
| 24 |
+
data=data
|
| 25 |
+
reverb_data=data/rirs/lmdb
|
| 26 |
+
noise_data=data/musan/lmdb
|
| 27 |
+
aug_plda_data=0
|
| 28 |
+
|
| 29 |
+
. tools/parse_options.sh
|
| 30 |
+
set -e
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
####
|
| 35 |
+
true && {
|
| 36 |
+
data_name_array=(
|
| 37 |
+
"cts_aug"
|
| 38 |
+
"sre16/major"
|
| 39 |
+
"sre16/eval/enrollment"
|
| 40 |
+
"sre16/eval/test"
|
| 41 |
+
"sre18/dev/enrollment/"
|
| 42 |
+
"sre18/dev/test/"
|
| 43 |
+
"sre18/dev/unlabeled/"
|
| 44 |
+
"sre18/eval/enrollment/"
|
| 45 |
+
"sre18/eval/test/"
|
| 46 |
+
"sre21/dev/enrollment/"
|
| 47 |
+
"sre21/dev/test/"
|
| 48 |
+
"sre21/eval/enrollment/"
|
| 49 |
+
"sre21/eval/test/"
|
| 50 |
+
)
|
| 51 |
+
data_list_path_array=(
|
| 52 |
+
"${data}/cts_aug/${data_type}.list"
|
| 53 |
+
"${data}/sre16/major/${data_type}.list"
|
| 54 |
+
"${data}/sre16/eval/enrollment/${data_type}.list"
|
| 55 |
+
"${data}/sre16/eval/test/${data_type}.list"
|
| 56 |
+
"${data}/sre18/dev/enrollment/${data_type}.list"
|
| 57 |
+
"${data}/sre18/dev/test/${data_type}.list"
|
| 58 |
+
"${data}/sre18/dev/unlabeled/${data_type}.list"
|
| 59 |
+
"${data}/sre18/eval/enrollment/${data_type}.list"
|
| 60 |
+
"${data}/sre18/eval/test/${data_type}.list"
|
| 61 |
+
"${data}/sre21/dev/enrollment/${data_type}.list"
|
| 62 |
+
"${data}/sre21/dev/test/${data_type}.list"
|
| 63 |
+
"${data}/sre21/eval/enrollment/${data_type}.list"
|
| 64 |
+
"${data}/sre21/eval/test/${data_type}.list"
|
| 65 |
+
)
|
| 66 |
+
data_scp_path_array=(
|
| 67 |
+
"${data}/cts_aug/wav.scp"
|
| 68 |
+
"${data}/sre16/major/wav.scp"
|
| 69 |
+
"${data}/sre16/eval/enrollment/wav.scp"
|
| 70 |
+
"${data}/sre16/eval/test/wav.scp"
|
| 71 |
+
"${data}/sre18/dev/enrollment/wav.scp"
|
| 72 |
+
"${data}/sre18/dev/test/wav.scp"
|
| 73 |
+
"${data}/sre18/dev/unlabeled/wav.scp"
|
| 74 |
+
"${data}/sre18/eval/enrollment/wav.scp"
|
| 75 |
+
"${data}/sre18/eval/test/wav.scp"
|
| 76 |
+
"${data}/sre21/dev/enrollment/wav.scp"
|
| 77 |
+
"${data}/sre21/dev/test/wav.scp"
|
| 78 |
+
"${data}/sre21/eval/enrollment/wav.scp"
|
| 79 |
+
"${data}/sre21/eval/test/wav.scp"
|
| 80 |
+
) # to count the number of wavs
|
| 81 |
+
nj_array=($nj $nj $nj $nj $nj $nj $nj $nj $nj $nj $nj $nj $nj)
|
| 82 |
+
batch_size_array=(1 1 1 1 1 1 1 1 1 1 1 1 1) # batch_size of test set must be 1 !!!
|
| 83 |
+
num_workers_array=(1 1 1 1 1 1 1 1 1 1 1 1 1)
|
| 84 |
+
aug_prob_array=(0.67 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
count=${#data_name_array[@]}
|
| 89 |
+
|
| 90 |
+
true && {
|
| 91 |
+
for i in $(seq 0 $(($count - 1))); do
|
| 92 |
+
echo $i
|
| 93 |
+
wavs_num=$(wc -l ${data_scp_path_array[$i]} | awk '{print $1}')
|
| 94 |
+
bash tools/extract_embedding.sh --exp_dir ${exp_dir} \
|
| 95 |
+
--model_path $model_path \
|
| 96 |
+
--data_type ${data_type} \
|
| 97 |
+
--data_list ${data_list_path_array[$i]} \
|
| 98 |
+
--wavs_num ${wavs_num} \
|
| 99 |
+
--store_dir ${data_name_array[$i]} \
|
| 100 |
+
--batch_size ${batch_size_array[$i]} \
|
| 101 |
+
--num_workers ${num_workers_array[$i]} \
|
| 102 |
+
--aug_prob ${aug_prob_array[$i]} \
|
| 103 |
+
--reverb_data ${reverb_data} \
|
| 104 |
+
--noise_data ${noise_data} \
|
| 105 |
+
--nj ${nj_array[$i]} \
|
| 106 |
+
--gpus $gpus
|
| 107 |
+
done
|
| 108 |
+
|
| 109 |
+
wait
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
# Create enrollment models. This is the first order statistics. The zeroth order
|
| 113 |
+
# (the number of enrollment vectors) should, in principle, also be considered.
|
| 114 |
+
echo "mean vector of enroll"
|
| 115 |
+
python tools/vector_mean.py \
|
| 116 |
+
--spk2utt ${data}/sre16/eval/enrollment/spk2utt \
|
| 117 |
+
--xvector_scp $exp_dir/embeddings/sre16/eval/enrollment/xvector.scp \
|
| 118 |
+
--spk_xvector_ark $exp_dir/embeddings/sre16/eval/enrollment/enroll_spk_xvector.ark
|
| 119 |
+
|
| 120 |
+
python tools/vector_mean.py \
|
| 121 |
+
--spk2utt ${data}/sre18/dev/enrollment/mdl_id2utt \
|
| 122 |
+
--xvector_scp $exp_dir/embeddings/sre18/dev/enrollment/xvector.scp \
|
| 123 |
+
--spk_xvector_ark $exp_dir/embeddings/sre18/dev/enrollment/enroll_mdl_xvector.ark
|
| 124 |
+
|
| 125 |
+
python tools/vector_mean.py \
|
| 126 |
+
--spk2utt ${data}/sre18/eval/enrollment/mdl_id2utt \
|
| 127 |
+
--xvector_scp $exp_dir/embeddings/sre18/eval/enrollment/xvector.scp \
|
| 128 |
+
--spk_xvector_ark $exp_dir/embeddings/sre18/eval/enrollment/enroll_mdl_xvector.ark
|
| 129 |
+
|
| 130 |
+
python tools/vector_mean.py \
|
| 131 |
+
--spk2utt ${data}/sre21/dev/enrollment/mdl_id2utt \
|
| 132 |
+
--xvector_scp $exp_dir/embeddings/sre21/dev/enrollment/xvector.scp \
|
| 133 |
+
--spk_xvector_ark $exp_dir/embeddings/sre21/dev/enrollment/enroll_mdl_xvector.ark
|
| 134 |
+
|
| 135 |
+
python tools/vector_mean.py \
|
| 136 |
+
--spk2utt ${data}/sre21/eval/enrollment/mdl_id2utt \
|
| 137 |
+
--xvector_scp $exp_dir/embeddings/sre21/eval/enrollment/xvector.scp \
|
| 138 |
+
--spk_xvector_ark $exp_dir/embeddings/sre21/eval/enrollment/enroll_mdl_xvector.ark
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
# Create one scp with both enroll and test since this is expected by some scripts
|
| 142 |
+
cat ${exp_dir}/embeddings/sre16/eval/enrollment/enroll_spk_xvector.scp \
|
| 143 |
+
${exp_dir}/embeddings/sre16/eval/test/xvector.scp \
|
| 144 |
+
> ${exp_dir}/embeddings/sre16/eval/xvector.scp
|
| 145 |
+
|
| 146 |
+
cat ${exp_dir}/embeddings/sre18/dev/enrollment/enroll_mdl_xvector.scp \
|
| 147 |
+
${exp_dir}/embeddings/sre18/dev/test/xvector.scp \
|
| 148 |
+
> ${exp_dir}/embeddings/sre18/dev/xvector.scp
|
| 149 |
+
|
| 150 |
+
cat ${exp_dir}/embeddings/sre18/eval/enrollment/enroll_mdl_xvector.scp \
|
| 151 |
+
${exp_dir}/embeddings/sre18/eval/test/xvector.scp \
|
| 152 |
+
> ${exp_dir}/embeddings/sre18/eval/xvector.scp
|
| 153 |
+
|
| 154 |
+
cat ${exp_dir}/embeddings/sre21/dev/enrollment/enroll_mdl_xvector.scp \
|
| 155 |
+
${exp_dir}/embeddings/sre21/dev/test/xvector.scp \
|
| 156 |
+
> ${exp_dir}/embeddings/sre21/dev/xvector.scp
|
| 157 |
+
|
| 158 |
+
cat ${exp_dir}/embeddings/sre21/eval/enrollment/enroll_mdl_xvector.scp \
|
| 159 |
+
${exp_dir}/embeddings/sre21/eval/test/xvector.scp \
|
| 160 |
+
> ${exp_dir}/embeddings/sre21/eval/xvector.scp
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
echo "Embedding dir is (${exp_dir}/embeddings)."
|
| 165 |
+
|
| 166 |
+
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/filter_utt_accd_dur.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2023 Zhengyang Chen
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
import fire
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def main(wav_scp, utt2voice_dur, filter_wav_scp, dur_thres=5.0):
|
| 19 |
+
|
| 20 |
+
utt2voice_dur_dict = {}
|
| 21 |
+
with open(utt2voice_dur, "r") as f:
|
| 22 |
+
for line in f:
|
| 23 |
+
utt, dur = line.strip().split()
|
| 24 |
+
utt2voice_dur_dict[utt] = float(dur)
|
| 25 |
+
|
| 26 |
+
with open(wav_scp, "r") as f, open(filter_wav_scp, "w") as fw:
|
| 27 |
+
for line in f:
|
| 28 |
+
utt = line.strip().split()[0]
|
| 29 |
+
if utt in utt2voice_dur_dict:
|
| 30 |
+
if utt2voice_dur_dict[utt] > dur_thres:
|
| 31 |
+
fw.write(line)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
if __name__ == "__main__":
|
| 35 |
+
fire.Fire(main)
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/generate_sre_aug.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2023 Zhengyang Chen
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
import os
|
| 16 |
+
import fire
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def main(ori_dir, aug_dir, aug_copy_num=2):
|
| 20 |
+
|
| 21 |
+
if not os.path.exists(aug_dir):
|
| 22 |
+
os.makedirs(aug_dir)
|
| 23 |
+
|
| 24 |
+
read_wav_scp = os.path.join(ori_dir, 'wav.scp')
|
| 25 |
+
aug_wav_scp = os.path.join(aug_dir, 'wav.scp')
|
| 26 |
+
read_utt2spk = os.path.join(ori_dir, 'utt2spk')
|
| 27 |
+
aug_utt2spk = os.path.join(aug_dir, 'utt2spk')
|
| 28 |
+
read_vad = os.path.join(ori_dir, 'vad')
|
| 29 |
+
store_vad = os.path.join(aug_dir, 'vad')
|
| 30 |
+
|
| 31 |
+
with open(read_wav_scp, 'r') as f, open(aug_wav_scp, 'w') as wf:
|
| 32 |
+
for line in f:
|
| 33 |
+
line = line.strip().split()
|
| 34 |
+
utt, other_info = line[0], ' '.join(line[1:])
|
| 35 |
+
for i in range(aug_copy_num + 1):
|
| 36 |
+
wf.write(utt + '_copy-' + str(i) + ' ' + other_info + '\n')
|
| 37 |
+
|
| 38 |
+
with open(read_utt2spk, 'r') as f, open(aug_utt2spk, 'w') as wf:
|
| 39 |
+
for line in f:
|
| 40 |
+
line = line.strip().split()
|
| 41 |
+
utt, spk = line[0], line[1]
|
| 42 |
+
for i in range(aug_copy_num + 1):
|
| 43 |
+
wf.write(utt + '_copy-' + str(i) + ' ' + spk + '\n')
|
| 44 |
+
|
| 45 |
+
with open(read_vad, 'r') as f, open(store_vad, 'w') as wf:
|
| 46 |
+
for line in f:
|
| 47 |
+
line = line.strip().split()
|
| 48 |
+
seg, utt, vad = line[0], line[1], ' '.join(line[2:])
|
| 49 |
+
for i in range(aug_copy_num + 1):
|
| 50 |
+
new_seg = seg + '_copy-' + str(i)
|
| 51 |
+
new_utt = utt + '_copy-' + str(i)
|
| 52 |
+
wf.write(new_seg + ' ' + new_utt + ' ' + vad + '\n')
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
if __name__ == "__main__":
|
| 56 |
+
fire.Fire(main)
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/m4a2wav.pl
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/perl
|
| 2 |
+
#
|
| 3 |
+
# Copyright 2018 Ewald Enzinger
|
| 4 |
+
# 2022 Hongji Wang
|
| 5 |
+
#
|
| 6 |
+
# Usage: m4a2wav.pl /export/voxceleb2_m4a dev /export/voxceleb2_wav
|
| 7 |
+
#
|
| 8 |
+
# Note: This script requires ffmpeg to be installed and its location included in $PATH.
|
| 9 |
+
|
| 10 |
+
if (@ARGV != 3) {
|
| 11 |
+
print STDERR "Usage: $0 <path-to-voxceleb2_m4a> <dataset> <path-to-voxceleb2_wav>\n";
|
| 12 |
+
print STDERR "e.g. $0 /export/voxceleb2_m4a dev /export/voxceleb2_wav\n";
|
| 13 |
+
exit(1);
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
# Check that ffmpeg is installed.
|
| 17 |
+
if (`which ffmpeg` eq "") {
|
| 18 |
+
die "Error: this script requires that ffmpeg is installed.";
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
($database_m4a, $dataset, $database_wav) = @ARGV;
|
| 22 |
+
|
| 23 |
+
if ("$dataset" ne "dev" && "$dataset" ne "test") {
|
| 24 |
+
die "dataset parameter must be 'dev' or 'test'!";
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
opendir my $dh, "$database_m4a/$dataset/aac" or die "Cannot open directory: $!";
|
| 28 |
+
my @spkr_dirs = grep {-d "$database_m4a/$dataset/aac/$_" && ! /^\.{1,2}$/} readdir($dh);
|
| 29 |
+
closedir $dh;
|
| 30 |
+
|
| 31 |
+
if (system("mkdir -p $database_wav/$dataset") != 0) {
|
| 32 |
+
die "Error making directory $database_wav/$dataset";
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
open(fp, ">", "$database_wav/$dataset/m4a2wav_$dataset.sh") or die "Could not open the output file $database_wav/m4a2wav.sh";
|
| 36 |
+
|
| 37 |
+
foreach (@spkr_dirs) {
|
| 38 |
+
my $spkr_id = $_;
|
| 39 |
+
|
| 40 |
+
opendir my $dh, "$database_m4a/$dataset/aac/$spkr_id/" or die "Cannot open directory: $!";
|
| 41 |
+
my @rec_dirs = grep {-d "$database_m4a/$dataset/aac/$spkr_id/$_" && ! /^\.{1,2}$/} readdir($dh);
|
| 42 |
+
closedir $dh;
|
| 43 |
+
|
| 44 |
+
foreach (@rec_dirs) {
|
| 45 |
+
my $rec_id = $_;
|
| 46 |
+
|
| 47 |
+
opendir my $dh, "$database_m4a/$dataset/aac/$spkr_id/$rec_id/" or die "Cannot open directory: $!";
|
| 48 |
+
my @files = map{s/\.[^.]+$//;$_}grep {/\.m4a$/} readdir($dh);
|
| 49 |
+
closedir $dh;
|
| 50 |
+
|
| 51 |
+
foreach (@files) {
|
| 52 |
+
my $name = $_;
|
| 53 |
+
if ( not -e "$database_wav/$dataset/aac/$spkr_id/$rec_id"){
|
| 54 |
+
system("mkdir -p $database_wav/$dataset/aac/$spkr_id/$rec_id");
|
| 55 |
+
}
|
| 56 |
+
my $wav = "ffmpeg -v 8 -i $database_m4a/$dataset/aac/$spkr_id/$rec_id/$name.m4a -f wav -acodec pcm_s16le $database_wav/$dataset/aac/$spkr_id/$rec_id/$name.wav";
|
| 57 |
+
print fp "$wav", "\n";
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
close(fp) or die;
|
| 62 |
+
|
| 63 |
+
# generate wav
|
| 64 |
+
#system("sh $database_wav/$dataset/m4a2wav_$dataset.sh");
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/make_sre16_eval.pl
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/perl
|
| 2 |
+
use warnings; #sed replacement for -w perl parameter
|
| 3 |
+
use File::Basename;
|
| 4 |
+
|
| 5 |
+
# Copyright 2017 David Snyder
|
| 6 |
+
# 2024 Johan Rohdin (rohdin@fit.vutbr.cz)
|
| 7 |
+
# Apache 2.0
|
| 8 |
+
#
|
| 9 |
+
|
| 10 |
+
# This script is taken from the Kaldi SRE16 recipe. For the Wespeaker recipe, we
|
| 11 |
+
# have done a few very minor changes, namely:
|
| 12 |
+
# 1. The path to the keys tar file are provided as an additional input argument.
|
| 13 |
+
# 2. The produced wav.scp will use ffmpeg instead of sph2pipe.
|
| 14 |
+
# 3. Some changes in paths to fit wespeaker recipe.
|
| 15 |
+
# 4. Warning if wav files have no meta data. Mainly happens if the directory
|
| 16 |
+
# searched for wav files contains files that are not in the original data.
|
| 17 |
+
# 5 Formatting to fit Wespeaker's requirement.
|
| 18 |
+
|
| 19 |
+
if (@ARGV != 3) {
|
| 20 |
+
print STDERR "Usage: $0 <path-to-SRE16-eval> <path-to-sre16-evalset-keys>" ,
|
| 21 |
+
" <path-to-output>\n";
|
| 22 |
+
print STDERR "e.g. $0 /export/corpora/SRE/R149_0_1 data/\n";
|
| 23 |
+
exit(1);
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
($db_base, $evalset_keys, $out_dir) = @ARGV;
|
| 27 |
+
|
| 28 |
+
# Handle enroll
|
| 29 |
+
$out_dir_enroll = "$out_dir/sre16/eval/enroll";
|
| 30 |
+
if (system("mkdir -p $out_dir_enroll")) {
|
| 31 |
+
die "Error making directory $out_dir_enroll";
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
$tmp_dir_enroll = "$out_dir_enroll/tmp";
|
| 35 |
+
if (system("mkdir -p $tmp_dir_enroll") != 0) {
|
| 36 |
+
die "Error making directory $tmp_dir_enroll";
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
open(SPKR, ">$out_dir_enroll/utt2spk")
|
| 40 |
+
|| die "Could not open the output file $out_dir_enroll/utt2spk";
|
| 41 |
+
open(WAV, ">$out_dir_enroll/wav.scp")
|
| 42 |
+
|| die "Could not open the output file $out_dir_enroll/wav.scp";
|
| 43 |
+
open(META, "<$db_base/docs/sre16_eval_enrollment.tsv")
|
| 44 |
+
or die "cannot open wav list";
|
| 45 |
+
%utt2fixedutt = ();
|
| 46 |
+
while (<META>) {
|
| 47 |
+
$line = $_;
|
| 48 |
+
@toks = split(" ", $line);
|
| 49 |
+
$spk = $toks[0];
|
| 50 |
+
$utt = $toks[1];
|
| 51 |
+
if ($utt ne "segment") {
|
| 52 |
+
print SPKR "${spk}-${utt} $spk\n";
|
| 53 |
+
$utt2fixedutt{$utt} = "${spk}-${utt}";
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
# Using cmd here and a few other places to satisfy the 80 char. requirement.
|
| 58 |
+
my $cmd1="find $db_base/data/enrollment/ -name '*.sph'".
|
| 59 |
+
" > $tmp_dir_enroll/sph.list";
|
| 60 |
+
if (system($cmd1) != 0) {
|
| 61 |
+
die "Error getting list of sph files";
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
open(WAVLIST, "<$tmp_dir_enroll/sph.list") or die "cannot open wav list";
|
| 65 |
+
|
| 66 |
+
while(<WAVLIST>) {
|
| 67 |
+
chomp;
|
| 68 |
+
$sph = $_;
|
| 69 |
+
@t = split("/",$sph);
|
| 70 |
+
@t1 = split("[./]",$t[$#t]);
|
| 71 |
+
$utt=$utt2fixedutt{$t1[0]};
|
| 72 |
+
if ($utt) {
|
| 73 |
+
print WAV "$utt",
|
| 74 |
+
" ffmpeg -nostdin -i $sph -ac 1 -ar 8000 -f wav pipe:1 |\n";
|
| 75 |
+
}else {
|
| 76 |
+
print("WARNING $t1[0] not in meta data. Will not be used.\n");
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
close(WAV) || die;
|
| 80 |
+
close(SPKR) || die;
|
| 81 |
+
|
| 82 |
+
# Handle test
|
| 83 |
+
$out_dir_test= "$out_dir/sre16/eval/test";
|
| 84 |
+
if (system("mkdir -p $out_dir_test")) {
|
| 85 |
+
die "Error making directory $out_dir_test";
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
$tmp_dir_test = "$out_dir_test/tmp";
|
| 89 |
+
if (system("mkdir -p $tmp_dir_test") != 0) {
|
| 90 |
+
die "Error making directory $tmp_dir_test";
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
if (system("cp $evalset_keys $out_dir_test")) {
|
| 95 |
+
die "Error copying sre16 keys.";
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
my $key_name = basename( $evalset_keys );
|
| 99 |
+
|
| 100 |
+
if (system("tar -xvf $out_dir_test/$key_name -C $out_dir_test")) {
|
| 101 |
+
die "Could not untar sre16 keys.";
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
open(SPKR, ">$out_dir_test/utt2spk")
|
| 106 |
+
|| die "Could not open the output file $out_dir_test/utt2spk";
|
| 107 |
+
open(WAV, ">$out_dir_test/wav.scp")
|
| 108 |
+
|| die "Could not open the output file $out_dir_test/wav.scp";
|
| 109 |
+
open(TRIALS, ">$out_dir_test/trials")
|
| 110 |
+
|| die "Could not open the output file $out_dir_test/trials";
|
| 111 |
+
open(TGL_TRIALS, ">$out_dir_test/trials_tgl")
|
| 112 |
+
|| die "Could not open the output file $out_dir_test/trials_tgl";
|
| 113 |
+
open(YUE_TRIALS, ">$out_dir_test/trials_yue")
|
| 114 |
+
|| die "Could not open the output file $out_dir_test/trials_yue";
|
| 115 |
+
|
| 116 |
+
my $cmd2="find $db_base/data/test/ -name '*.sph' > $tmp_dir_test/sph.list";
|
| 117 |
+
if (system($cmd2) != 0) {
|
| 118 |
+
die "Error getting list of sph files";
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
open(KEY, "<$out_dir_test/R149_0_1/docs/sre16_eval_trial_key.tsv")
|
| 123 |
+
|| die "Could not open trials file",
|
| 124 |
+
" $out_dir_test/R149_0_1/docs/sre16_eval_trial_key.tsv.";
|
| 125 |
+
open(SEG_KEY, "<$out_dir_test/R149_0_1/docs/sre16_eval_segment_key.tsv")
|
| 126 |
+
|| die "Could not open trials file",
|
| 127 |
+
" $out_dir_test/R149_0_1/docs/sre16_eval_segment_key.tsv.";
|
| 128 |
+
open(LANG_KEY, "<$out_dir_test/R149_0_1/metadata/calls.tsv")
|
| 129 |
+
|| die " Could not open trials file",
|
| 130 |
+
" $out_dir_test/R149_0_1/metadata/calls.tsv.";
|
| 131 |
+
open(WAVLIST, "<$tmp_dir_test/sph.list") or die "cannot open wav list";
|
| 132 |
+
|
| 133 |
+
%utt2call = ();
|
| 134 |
+
while(<SEG_KEY>) {
|
| 135 |
+
chomp;
|
| 136 |
+
$line = $_;
|
| 137 |
+
@toks = split(" ", $line);
|
| 138 |
+
$utt = $toks[0];
|
| 139 |
+
$call = $toks[1];
|
| 140 |
+
if ($utt ne "segment") {
|
| 141 |
+
$utt2call{$utt} = $call;
|
| 142 |
+
}
|
| 143 |
+
}
|
| 144 |
+
close(SEG_KEY) || die;
|
| 145 |
+
|
| 146 |
+
%call2lang = ();
|
| 147 |
+
while(<LANG_KEY>) {
|
| 148 |
+
chomp;
|
| 149 |
+
$line = $_;
|
| 150 |
+
@toks = split(" ", $line);
|
| 151 |
+
$call = $toks[0];
|
| 152 |
+
$lang = $toks[1];
|
| 153 |
+
$call2lang{$call} = $lang;
|
| 154 |
+
}
|
| 155 |
+
close(LANG_KEY) || die;
|
| 156 |
+
|
| 157 |
+
while(<WAVLIST>) {
|
| 158 |
+
chomp;
|
| 159 |
+
$sph = $_;
|
| 160 |
+
@t = split("/",$sph);
|
| 161 |
+
@t1 = split("[./]",$t[$#t]);
|
| 162 |
+
$utt=$t1[0];
|
| 163 |
+
print WAV "$utt"," ffmpeg -nostdin -i $sph -ac 1 -ar 8000 -f wav pipe:1 |\n";
|
| 164 |
+
print SPKR "$utt $utt\n";
|
| 165 |
+
}
|
| 166 |
+
close(WAV) || die;
|
| 167 |
+
close(SPKR) || die;
|
| 168 |
+
|
| 169 |
+
while (<KEY>) {
|
| 170 |
+
$line = $_;
|
| 171 |
+
@toks = split(" ", $line);
|
| 172 |
+
$spk = $toks[0];
|
| 173 |
+
$utt = $toks[1];
|
| 174 |
+
$call = $utt2call{$utt};
|
| 175 |
+
$target_type = $toks[3];
|
| 176 |
+
if ($utt ne "segment") {
|
| 177 |
+
print TRIALS "${spk} ${utt} ${target_type}\n";
|
| 178 |
+
if ($call2lang{$call} eq "tgl") {
|
| 179 |
+
print TGL_TRIALS "${spk} ${utt} ${target_type}\n";
|
| 180 |
+
} elsif ($call2lang{$call} eq "yue") {
|
| 181 |
+
print YUE_TRIALS "${spk} ${utt} ${target_type}\n";
|
| 182 |
+
} else {
|
| 183 |
+
die "Unexpected language $call2lang{$call} for utterance $utt.";
|
| 184 |
+
}
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
close(TRIALS) || die;
|
| 189 |
+
close(TGL_TRIALS) || die;
|
| 190 |
+
close(YUE_TRIALS) || die;
|
| 191 |
+
|
| 192 |
+
my $cmd3="tools/utt2spk_to_spk2utt.pl".
|
| 193 |
+
" $out_dir_enroll/utt2spk >$out_dir_enroll/spk2utt";
|
| 194 |
+
if (system($cmd3) != 0) {
|
| 195 |
+
die "Error creating spk2utt file in directory $out_dir_enroll";
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
my $cmd4="tools/utt2spk_to_spk2utt.pl $out_dir_test/utt2spk >$out_dir_test/spk2utt";
|
| 199 |
+
if (system($cmd4) != 0) {
|
| 200 |
+
die "Error creating spk2utt file in directory $out_dir_test";
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
if (system("tools/fix_data_dir.sh $out_dir_enroll") != 0) {
|
| 204 |
+
die "Error fixing data dir $out_dir_enroll";
|
| 205 |
+
}
|
| 206 |
+
if (system("tools/fix_data_dir.sh $out_dir_test") != 0) {
|
| 207 |
+
die "Error fixing data dir $out_dir_test";
|
| 208 |
+
}
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/make_sre16_unlabeled.pl
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/perl
|
| 2 |
+
use warnings; #sed replacement for -w perl parameter
|
| 3 |
+
# Copyright 2017 David Snyder
|
| 4 |
+
# 2024 Johan Rohdin (rohdin@fit.vutbr.cz): Just some minor changes
|
| 5 |
+
# in paths to fit the Wespeaker recipe organization as well
|
| 6 |
+
# formatting to fit Wespeaker's requirements.
|
| 7 |
+
# Apache 2.0
|
| 8 |
+
|
| 9 |
+
if (@ARGV != 2) {
|
| 10 |
+
print STDERR "Usage: $0 <path-to-call-my-net-training-data> ", "
|
| 11 |
+
<path-to-output>\n";
|
| 12 |
+
print STDERR "e.g. $0",
|
| 13 |
+
"/export/corpora/SRE/LDC2016E46_SRE16_Call_My_Net_Training_Data data/\n";
|
| 14 |
+
exit(1);
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
($db_base, $out_dir) = @ARGV;
|
| 18 |
+
|
| 19 |
+
# Handle major subset.
|
| 20 |
+
$out_dir_major = "$out_dir/sre16/major";
|
| 21 |
+
if (system("mkdir -p $out_dir_major")) {
|
| 22 |
+
die "Error making directory $out_dir_major";
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
$tmp_dir_major = "$out_dir_major/tmp";
|
| 26 |
+
if (system("mkdir -p $tmp_dir_major") != 0) {
|
| 27 |
+
die "Error making directory $tmp_dir_major";
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
open(SPKR, ">$out_dir_major/utt2spk")
|
| 31 |
+
|| die "Could not open the output file $out_dir_major/utt2spk";
|
| 32 |
+
open(WAV, ">$out_dir_major/wav.scp")
|
| 33 |
+
|| die "Could not open the output file $out_dir_major/wav.scp";
|
| 34 |
+
|
| 35 |
+
my $cmd1="find $db_base/data/unlabeled/major/ -name '*.sph'".
|
| 36 |
+
" > $tmp_dir_major/sph.list";
|
| 37 |
+
if (system($cmd1) != 0) {
|
| 38 |
+
die "Error getting list of sph files";
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
open(WAVLIST, "<$tmp_dir_major/sph.list") or die "cannot open wav list";
|
| 42 |
+
|
| 43 |
+
while(<WAVLIST>) {
|
| 44 |
+
chomp;
|
| 45 |
+
$sph = $_;
|
| 46 |
+
@t = split("/",$sph);
|
| 47 |
+
@t1 = split("[./]",$t[$#t]);
|
| 48 |
+
$utt=$t1[0];
|
| 49 |
+
print WAV "$utt"," ffmpeg -nostdin -i $sph -ac 1 -ar 8000 -f wav pipe:1 |\n";
|
| 50 |
+
print SPKR "$utt $utt\n";
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
close(WAV) || die;
|
| 54 |
+
close(SPKR) || die;
|
| 55 |
+
|
| 56 |
+
# Handle minor subset.
|
| 57 |
+
$out_dir_minor= "$out_dir/sre16/minor";
|
| 58 |
+
if (system("mkdir -p $out_dir_minor")) {
|
| 59 |
+
die "Error making directory $out_dir_minor";
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
$tmp_dir_minor = "$out_dir_minor/tmp";
|
| 63 |
+
if (system("mkdir -p $tmp_dir_minor") != 0) {
|
| 64 |
+
die "Error making directory $tmp_dir_minor";
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
open(SPKR, ">$out_dir_minor/utt2spk")
|
| 68 |
+
|| die "Could not open the output file $out_dir_minor/utt2spk";
|
| 69 |
+
open(WAV, ">$out_dir_minor/wav.scp")
|
| 70 |
+
|| die "Could not open the output file $out_dir_minor/wav.scp";
|
| 71 |
+
|
| 72 |
+
my $cmd2="find $db_base/data/unlabeled/minor/ -name '*.sph'".
|
| 73 |
+
" > $tmp_dir_minor/sph.list";
|
| 74 |
+
if (system($cmd2) != 0) {
|
| 75 |
+
die "Error getting list of sph files";
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
open(WAVLIST, "<$tmp_dir_minor/sph.list")
|
| 79 |
+
or die "cannot open wav list";
|
| 80 |
+
|
| 81 |
+
while(<WAVLIST>) {
|
| 82 |
+
chomp;
|
| 83 |
+
$sph = $_;
|
| 84 |
+
@t = split("/",$sph);
|
| 85 |
+
@t1 = split("[./]",$t[$#t]);
|
| 86 |
+
$utt=$t1[0];
|
| 87 |
+
print WAV "$utt"," ffmpeg -nostdin -i $sph -ac 1 -ar 8000 -f wav pipe:1 |\n";
|
| 88 |
+
print SPKR "$utt $utt\n";
|
| 89 |
+
}
|
| 90 |
+
close(WAV) || die;
|
| 91 |
+
close(SPKR) || die;
|
| 92 |
+
|
| 93 |
+
my $cmd3="tools/utt2spk_to_spk2utt.pl $out_dir_major/utt2spk".
|
| 94 |
+
">$out_dir_major/spk2utt";
|
| 95 |
+
if (system($cmd3) != 0) {
|
| 96 |
+
die "Error creating spk2utt file in directory $out_dir_major";
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
my $cmd4="tools/utt2spk_to_spk2utt.pl $out_dir_minor/utt2spk".
|
| 100 |
+
" > $out_dir_minor/spk2utt";
|
| 101 |
+
if (system($cmd4) != 0) {
|
| 102 |
+
die "Error creating spk2utt file in directory $out_dir_minor";
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
if (system("tools/fix_data_dir.sh $out_dir_major") != 0) {
|
| 106 |
+
die "Error fixing data dir $out_dir_major";
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
if (system("tools/fix_data_dir.sh $out_dir_minor") != 0) {
|
| 110 |
+
die "Error fixing data dir $out_dir_minor";
|
| 111 |
+
}
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/make_system_sad.py
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2022 Xu Xiang
|
| 2 |
+
# 2023 Zhengyang Chen
|
| 3 |
+
# 2024 Johan Rohdin
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
import os
|
| 19 |
+
os.environ["OMP_NUM_THREADS"] = "1"
|
| 20 |
+
os.environ["OPENBLAS_NUM_THREADS"] = "1"
|
| 21 |
+
os.environ["MKL_NUM_THREADS"] = "1"
|
| 22 |
+
os.environ["VECLIB_MAXIMUM_THREADS"] = "1"
|
| 23 |
+
os.environ["NUMEXPR_NUM_THREADS"] = "1"
|
| 24 |
+
|
| 25 |
+
import sys
|
| 26 |
+
import io
|
| 27 |
+
import functools
|
| 28 |
+
import concurrent.futures
|
| 29 |
+
import argparse
|
| 30 |
+
import importlib
|
| 31 |
+
import torchaudio
|
| 32 |
+
import subprocess
|
| 33 |
+
|
| 34 |
+
import torch
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def get_args():
|
| 38 |
+
parser = argparse.ArgumentParser(description='')
|
| 39 |
+
parser.add_argument('--repo-path', required=True,
|
| 40 |
+
help='VAD model repo path')
|
| 41 |
+
parser.add_argument('--scp', required=True, help='wav scp')
|
| 42 |
+
parser.add_argument('--min-duration', required=True,
|
| 43 |
+
type=float, help='min duration')
|
| 44 |
+
args = parser.parse_args()
|
| 45 |
+
|
| 46 |
+
return args
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
@functools.lru_cache(maxsize=1)
|
| 50 |
+
def load_wav(
|
| 51 |
+
wav_rxfilename,
|
| 52 |
+
):
|
| 53 |
+
""" This function reads audio file and return data in pytorch tensor.
|
| 54 |
+
"lru_cache" holds recently loaded audio so that can be called
|
| 55 |
+
many times on the same audio file.
|
| 56 |
+
OPTIMIZE: controls lru_cache size for random access,
|
| 57 |
+
considering memory size
|
| 58 |
+
"""
|
| 59 |
+
if wav_rxfilename.endswith('|'):
|
| 60 |
+
# input piped command
|
| 61 |
+
p = subprocess.Popen(wav_rxfilename[:-1], shell=True,
|
| 62 |
+
stdout=subprocess.PIPE)
|
| 63 |
+
data, samplerate = torchaudio.load(io.BytesIO(p.stdout.read()))
|
| 64 |
+
elif wav_rxfilename == '-':
|
| 65 |
+
# stdin
|
| 66 |
+
data, samplerate = torchaudio.load(sys.stdin)
|
| 67 |
+
else:
|
| 68 |
+
# normal wav file
|
| 69 |
+
data, samplerate = torchaudio.load(wav_rxfilename)
|
| 70 |
+
return data.squeeze(0), samplerate
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def read_scp(scp):
|
| 74 |
+
utt_wav_pair = []
|
| 75 |
+
for line in open(scp, 'r'):
|
| 76 |
+
segs = line.strip().split()
|
| 77 |
+
if len(segs) > 2:
|
| 78 |
+
utt, wav = segs[0], ' '.join(segs[1:])
|
| 79 |
+
else:
|
| 80 |
+
utt, wav = segs[0], segs[1]
|
| 81 |
+
utt_wav_pair.append((utt, wav))
|
| 82 |
+
|
| 83 |
+
return utt_wav_pair
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
def silero_vad(utt_wav_pair, repo_path, min_duration,
|
| 87 |
+
sampling_rate=8000, threshold=0.25):
|
| 88 |
+
|
| 89 |
+
def module_from_file(module_name, file_path):
|
| 90 |
+
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
| 91 |
+
module = importlib.util.module_from_spec(spec)
|
| 92 |
+
sys.modules[module_name] = module
|
| 93 |
+
spec.loader.exec_module(module)
|
| 94 |
+
return module
|
| 95 |
+
|
| 96 |
+
utils_vad = module_from_file("utils_vad",
|
| 97 |
+
os.path.join(repo_path, "utils_vad.py"))
|
| 98 |
+
model = utils_vad.init_jit_model(
|
| 99 |
+
os.path.join(repo_path, 'files/silero_vad.jit'))
|
| 100 |
+
|
| 101 |
+
utt, wav = utt_wav_pair
|
| 102 |
+
|
| 103 |
+
wav_f = wav
|
| 104 |
+
|
| 105 |
+
wav, sr = load_wav(wav)
|
| 106 |
+
assert sr == sampling_rate, "Audio file {} has wrong sampling rate \
|
| 107 |
+
({} instead of {})".format(wav_f, sr, sampling_rate)
|
| 108 |
+
|
| 109 |
+
speech_timestamps = utils_vad.get_speech_timestamps(
|
| 110 |
+
wav, model, sampling_rate=sampling_rate,
|
| 111 |
+
threshold=threshold)
|
| 112 |
+
|
| 113 |
+
vad_result = ""
|
| 114 |
+
for item in speech_timestamps:
|
| 115 |
+
begin = item['start'] / sampling_rate
|
| 116 |
+
end = item['end'] / sampling_rate
|
| 117 |
+
if end - begin >= min_duration:
|
| 118 |
+
vad_result += "{}-{:08d}-{:08d} {} {:.3f} {:.3f}\n".format(
|
| 119 |
+
utt, int(begin * 1000), int(end * 1000), utt, begin, end)
|
| 120 |
+
|
| 121 |
+
return vad_result
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
def main():
|
| 125 |
+
args = get_args()
|
| 126 |
+
|
| 127 |
+
vad = functools.partial(silero_vad,
|
| 128 |
+
repo_path=args.repo_path,
|
| 129 |
+
min_duration=args.min_duration)
|
| 130 |
+
utt_wav_pair_list = read_scp(args.scp)
|
| 131 |
+
# with concurrent.futures.ProcessPoolExecutor() as executor:
|
| 132 |
+
# print(''.join(executor.map(vad, utt_wav_pair_list)), end='')
|
| 133 |
+
# It seems the pool doesn't work well so split into chunks of max size n
|
| 134 |
+
# (e.g. 10000). Splitting like this also has the consequence that the VAD
|
| 135 |
+
# is printed after processing n files instead of after processing all files.
|
| 136 |
+
n = 10000
|
| 137 |
+
utt_wav_pair_list_of_list = [utt_wav_pair_list[i * n:(i + 1) * n]
|
| 138 |
+
for i in range((len(utt_wav_pair_list) + n - 1) // n)]
|
| 139 |
+
for lol in utt_wav_pair_list_of_list:
|
| 140 |
+
with concurrent.futures.ProcessPoolExecutor() as executor:
|
| 141 |
+
print(''.join(executor.map(vad, lol)), end='')
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
if __name__ == '__main__':
|
| 145 |
+
torch.set_num_threads(1)
|
| 146 |
+
|
| 147 |
+
main()
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/prepare_cts_superset.sh
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
set -o pipefail
|
| 4 |
+
|
| 5 |
+
export LC_ALL=C
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
data_cts=data/cts/
|
| 9 |
+
cts_superset_dir=""
|
| 10 |
+
wav_dir=wav/cts/
|
| 11 |
+
|
| 12 |
+
. tools/parse_options.sh || exit 1
|
| 13 |
+
|
| 14 |
+
echo $cts_superset_dir
|
| 15 |
+
|
| 16 |
+
if [ ! -f $cts_superset_dir/docs/cts_superset_segment_key.tsv ];then
|
| 17 |
+
echo "ERROR: $cts_superset_dir/docs/cts_superset_segment_key.tsv does not exist."
|
| 18 |
+
exit 1
|
| 19 |
+
fi
|
| 20 |
+
|
| 21 |
+
mkdir -p $data_cts
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
echo -n "" > ${data_cts}/wav.scp
|
| 25 |
+
for x in $(tail -n +2 $cts_superset_dir/docs/cts_superset_segment_key.tsv | cut -f 1 | sed "s:\.sph::" );do
|
| 26 |
+
echo "$x ffmpeg -nostdin -i ${cts_superset_dir}/data/${x}.sph -ar 8000 -f wav pipe:1 |" >> $data_cts/wav.scp
|
| 27 |
+
done
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
tail -n +2 $cts_superset_dir/docs/cts_superset_segment_key.tsv | cut -f 1,3 --output-delimiter=" " | sed "s:\.sph::" | sort > ${data_cts}/utt2spk
|
| 31 |
+
|
| 32 |
+
tools/utt2spk_to_spk2utt.pl ${data_cts}/utt2spk > ${data_cts}/spk2utt
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/prepare_data.sh
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2023 Zhengyang Chen (chenzhengyang117@gmail.com)
|
| 4 |
+
# 2024 Johan Rohdin (rohdin@fit.vutbr.cz)
|
| 5 |
+
#
|
| 6 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 7 |
+
# you may not use this file except in compliance with the License.
|
| 8 |
+
# You may obtain a copy of the License at
|
| 9 |
+
#
|
| 10 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 11 |
+
#
|
| 12 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 13 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 14 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 15 |
+
# See the License for the specific language governing permissions and
|
| 16 |
+
# limitations under the License.
|
| 17 |
+
|
| 18 |
+
stage=-1
|
| 19 |
+
stop_stage=-1
|
| 20 |
+
#sre_data_dir=
|
| 21 |
+
data=data
|
| 22 |
+
|
| 23 |
+
###
|
| 24 |
+
sre16_unlab_dir=""
|
| 25 |
+
sre16_evalset_dir=""
|
| 26 |
+
sre16_evalset_keys=""
|
| 27 |
+
###
|
| 28 |
+
sre18_devset_dir=""
|
| 29 |
+
sre18_evalset_dir=""
|
| 30 |
+
sre18_evalset_keys=""
|
| 31 |
+
###
|
| 32 |
+
sre21_devset_dir=""
|
| 33 |
+
sre21_evalset_dir=""
|
| 34 |
+
sre21_evalset_keys=""
|
| 35 |
+
###
|
| 36 |
+
cts_superset_dir=""
|
| 37 |
+
###
|
| 38 |
+
voxceleb_dir=""
|
| 39 |
+
|
| 40 |
+
compute_total_utterance_duration=true # Whether to compute the total utterance duration, i.e., including no speech parts
|
| 41 |
+
# Can be used as an addition filtering requirement. Currently only supported for
|
| 42 |
+
# VoxCeleb.
|
| 43 |
+
compute_vad_for_voxceleb=true
|
| 44 |
+
include_voxceleb_vad_in_train_data=true # If false, only CTS vad will be inluded which means that VAD will not be applied for VoxCeleb during training.
|
| 45 |
+
|
| 46 |
+
. tools/parse_options.sh || exit 1
|
| 47 |
+
|
| 48 |
+
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
| 49 |
+
mkdir -p external_tools
|
| 50 |
+
# Download voice activity detection model pretrained by Silero Team
|
| 51 |
+
wget -c https://github.com/snakers4/silero-vad/archive/refs/tags/v4.0.zip -O external_tools/silero-vad-v4.0.zip
|
| 52 |
+
unzip -o external_tools/silero-vad-v4.0.zip -d external_tools
|
| 53 |
+
fi
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
### SRE16
|
| 57 |
+
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
|
| 58 |
+
# We use the scripts from the Kaldi SRE16 recipe with some minor modifications.
|
| 59 |
+
|
| 60 |
+
# Prepare NIST SRE 2016 evaluation data.
|
| 61 |
+
local/make_sre16_eval.pl $sre16_evalset_dir $sre16_evalset_keys data
|
| 62 |
+
|
| 63 |
+
# Prepare unlabeled Cantonese and Tagalog development data. This dataset
|
| 64 |
+
# was distributed to SRE participants.
|
| 65 |
+
local/make_sre16_unlabeled.pl $sre16_unlab_dir data
|
| 66 |
+
fi
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
### SRE18
|
| 70 |
+
if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then
|
| 71 |
+
echo "Preparing SRE18"
|
| 72 |
+
local/prepare_sre18.sh --stage 1 --stop_stage 1 --sre18_dev_dir $sre18_devset_dir --sre18_eval_dir $sre18_evalset_dir --sre18_eval_keys_file $sre18_evalset_keys --data_dir $data/sre18
|
| 73 |
+
fi
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
### SRE21
|
| 77 |
+
if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then
|
| 78 |
+
echo "Preparing SRE21"
|
| 79 |
+
local/prepare_sre21.sh --stage 1 --stop_stage 1 --sre21_dev_dir $sre21_devset_dir --sre21_eval_dir $sre21_evalset_dir --sre21_eval_keys_file $sre21_evalset_keys --data_dir $data/sre21
|
| 80 |
+
fi
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
### CTS
|
| 84 |
+
if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then
|
| 85 |
+
echo "Preparing CTS"
|
| 86 |
+
local/prepare_cts_superset.sh --cts_superset_dir $cts_superset_dir --data_cts $data/cts --wav_dir `pwd`/wav/cts
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
# Only mixer data. Used for backend training. Create only lists here.
|
| 90 |
+
# The data directory will be created later, after VAD.
|
| 91 |
+
awk -F"\t" '{if($7 == "mx3" || $7 == "mx45" || $7 == "mx6"){print $0} }' ${cts_superset_dir}/docs/cts_superset_segment_key.tsv \
|
| 92 |
+
> data/cts_superset_segment_key_mx3456.tsv
|
| 93 |
+
cut -f 1 data/cts_superset_segment_key_mx3456.tsv | sed s:\\.sph$:: > data/mx_3456.list
|
| 94 |
+
|
| 95 |
+
fi
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
### VoxCeleb
|
| 99 |
+
# We are using all of VoxCeleb 1 and the training (aka "development") part of VoxCeleb 2.
|
| 100 |
+
# (The test part of VoxCeleb 2) may have some overlap with VoxCeleb 1. See
|
| 101 |
+
# https://www.robots.ox.ac.uk/~vgg/publications/2019/Nagrani19/nagrani19.pdf, Table 4.)
|
| 102 |
+
if [ ${stage} -le 6 ] && [ ${stop_stage} -ge 6 ]; then
|
| 103 |
+
|
| 104 |
+
echo "Preparing VoxCeleb"
|
| 105 |
+
if [[ $voxceleb_dir == "" ]];then
|
| 106 |
+
echo "Preparing Voxceleb, rirs and Musan"
|
| 107 |
+
voxceleb_dir=${data}_vox
|
| 108 |
+
mkdir ${voxceleb_dir}
|
| 109 |
+
local/prepare_vox.sh --stage 1 --stop_stage 4 --data ${data}_vox
|
| 110 |
+
fi
|
| 111 |
+
|
| 112 |
+
if [[ ! -d $voxceleb_dir/vox1 || ! -d $voxceleb_dir/vox2_dev ]];then
|
| 113 |
+
echo "ERROR: Problem with Voxceleb data directory."
|
| 114 |
+
exit 1
|
| 115 |
+
fi
|
| 116 |
+
|
| 117 |
+
# Downsample VoxCeleb and apply GSM. We create a new wav.scp with this command in the
|
| 118 |
+
# extraction chain rather than creating the new wav files explicitly.
|
| 119 |
+
sox_command='-t gsm -r 8000 - | sox -t gsm -r 8000 - -t wav -r 8000 -c 1 -e signed-integer -'
|
| 120 |
+
for dset in vox1 vox2_dev;do
|
| 121 |
+
tools/copy_data_dir.sh $voxceleb_dir/$dset $data/${dset}_gsmfr
|
| 122 |
+
awk -v sc="$sox_command" '{print $1 " sox " $2 " " sc " |" }' $voxceleb_dir/$dset/wav.scp > $data/${dset}_gsmfr/wav.scp
|
| 123 |
+
done
|
| 124 |
+
|
| 125 |
+
# Combine all Voxceleb data
|
| 126 |
+
tools/combine_data.sh data/vox_gsmfr data/vox1_gsmfr/ data/vox2_dev_gsmfr/
|
| 127 |
+
|
| 128 |
+
# Copy rirs and musan from voxceleb. We don't need to downsample as this will be
|
| 129 |
+
# done on-the-fly. If the direcotires already contain the data in lmdb format
|
| 130 |
+
# we just link it. Otherwise we copy it and let later stages create the lmdb
|
| 131 |
+
# format data here. Since we don't want to affect the original data.
|
| 132 |
+
for x in rirs musan;do
|
| 133 |
+
if [ -d $voxceleb_dir/$x/lmdb ];then
|
| 134 |
+
ln -s $voxceleb_dir/$x $data/
|
| 135 |
+
else
|
| 136 |
+
mkdir $data/$x
|
| 137 |
+
cp -r $voxceleb_dir/$x/wav.scp $data/$x/wav.scp
|
| 138 |
+
fi
|
| 139 |
+
done
|
| 140 |
+
|
| 141 |
+
fi
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
if [ ${stage} -le 7 ] && [ ${stop_stage} -ge 7 ]; then
|
| 145 |
+
|
| 146 |
+
echo "Get vad segmentation for dataset."
|
| 147 |
+
true && {
|
| 148 |
+
# Set VAD min duration
|
| 149 |
+
min_duration=0.25
|
| 150 |
+
for dset in vox_gsmfr cts sre18/dev/test sre18/dev/enrollment sre18/dev/unlabeled sre18/eval/test sre18/eval/enrollment sre21/dev/test sre21/dev/enrollment sre21/eval/test sre21/eval/enrollment sre16_major sre16/eval/enrollment sre16/eval/test; do
|
| 151 |
+
python3 local/make_system_sad.py \
|
| 152 |
+
--repo-path external_tools/silero-vad-4.0 \
|
| 153 |
+
--scp ${data}/${dset}/wav.scp \
|
| 154 |
+
--min-duration $min_duration > ${data}/${dset}/vad
|
| 155 |
+
cp -r ${data}/${dset} ${data}/${dset}-bk # Since VAD is quite time-consuming, it is good to have a backup.
|
| 156 |
+
done
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
true && {
|
| 160 |
+
# We may consider to use only the mixer portion of the CTS data for backen training
|
| 161 |
+
# as it may be closer to the SRE data.
|
| 162 |
+
|
| 163 |
+
tools/subset_data_dir.sh --utt-list data/mx_3456.list data/cts data/mx_3456
|
| 164 |
+
tools/filter_scp.pl -f 2 ${data}/mx_3456/wav.scp ${data}/cts/vad > ${data}/mx_3456/vad
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
# For PLDA training, it is better to augment the training data
|
| 168 |
+
python3 local/generate_sre_aug.py --ori_dir ${data}/mx_3456 \
|
| 169 |
+
--aug_dir ${data}/mx_3456_aug \
|
| 170 |
+
--aug_copy_num 2
|
| 171 |
+
|
| 172 |
+
tools/utt2spk_to_spk2utt.pl ${data}/mx_3456_aug/utt2spk > ${data}/mx_3456_aug/spk2utt
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
true && {
|
| 176 |
+
# We may consider to use only the mixer portion of the CTS data for backend training
|
| 177 |
+
# as it may be closer to the SRE data.
|
| 178 |
+
|
| 179 |
+
# For PLDA training, it is better to augment the training data
|
| 180 |
+
python3 local/generate_sre_aug.py --ori_dir ${data}/cts \
|
| 181 |
+
--aug_dir ${data}/cts_aug \
|
| 182 |
+
--aug_copy_num 2
|
| 183 |
+
|
| 184 |
+
tools/utt2spk_to_spk2utt.pl ${data}/cts_aug/utt2spk > ${data}/cts_aug/spk2utt
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
fi
|
| 188 |
+
|
| 189 |
+
if [ ${stage} -le 8 ] && [ ${stop_stage} -ge 8 ]; then
|
| 190 |
+
|
| 191 |
+
true && {
|
| 192 |
+
for dset in cts vox_gsmfr; do
|
| 193 |
+
echo $dset
|
| 194 |
+
if [ -f ${data}/${dset}/vad ] && ( [ $dset != "vox_gsmfr" ] || $compute_vad_for_voxceleb ) ;then
|
| 195 |
+
echo "Using VAD info"
|
| 196 |
+
python3 local/utt2voice_duration.py \
|
| 197 |
+
--vad_file ${data}/${dset}/vad \
|
| 198 |
+
--utt2voice_dur ${data}/${dset}/utt2voice_dur
|
| 199 |
+
cp ${data}/${dset}/utt2voice_dur ${data}/${dset}-bk/ # Good to have backup also of this
|
| 200 |
+
fi
|
| 201 |
+
done
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
true && {
|
| 205 |
+
# The below need to be improved to work for a general wav.scp. It only works for the specif format of voxceleb wav.scp
|
| 206 |
+
# at the moment.
|
| 207 |
+
for dset in vox_gsmfr; do
|
| 208 |
+
if $compute_total_utterance_duration; then
|
| 209 |
+
# We may, for example, avoid applying VAD on VoxCeleb in which case we need this.
|
| 210 |
+
# Note that the durations are estimated on the original wave file, before sox
|
| 211 |
+
# downsampling and GSM codec is applied.
|
| 212 |
+
echo "Using soxi"
|
| 213 |
+
|
| 214 |
+
cut -f3 -d" " ${data}/${dset}/wav.scp | awk '{ print "soxi -D " $0 }' > ${data}/${dset}/soxi_cmd.sh
|
| 215 |
+
split -a 4 -d -n l/12 ${data}/${dset}/soxi_cmd.sh ${data}/${dset}/soxi_cmd.split.
|
| 216 |
+
for i in {0000..11}; do
|
| 217 |
+
bash ${data}/${dset}/soxi_cmd.split.$i > ${data}/${dset}/soxi_cmd.split.$i.out &
|
| 218 |
+
done
|
| 219 |
+
wait
|
| 220 |
+
|
| 221 |
+
for i in {0000..11}; do cat ${data}/${dset}/soxi_cmd.split.$i.out; done > ${data}/${dset}/dur_tmp
|
| 222 |
+
cut -f1 -d" " ${data}/${dset}/wav.scp > ${data}/${dset}/utt_tmp
|
| 223 |
+
paste -d " " ${data}/${dset}/utt_tmp ${data}/${dset}/dur_tmp > ${data}/${dset}/utt2dur
|
| 224 |
+
|
| 225 |
+
rm ${data}/${dset}/soxi_cmd.* ${data}/${dset}/vox_gsmfr/dur_tmp ${data}/${dset}/utt_tmp
|
| 226 |
+
|
| 227 |
+
cp ${data}/${dset}/utt2dur ${data}/${dset}-bk/ # Good to have backup also of this
|
| 228 |
+
fi
|
| 229 |
+
done
|
| 230 |
+
}
|
| 231 |
+
fi
|
| 232 |
+
|
| 233 |
+
if [ ${stage} -le 9 ] && [ ${stop_stage} -ge 9 ]; then
|
| 234 |
+
|
| 235 |
+
declare -A voice_dur_threshold=( ["cts"]=5.0 ["vox_gsmfr"]=0.0 ) # Note that a threshold of 0.0 still means that utterances with no speech
|
| 236 |
+
# according to VAD will be discarded at this stage. So if we want to keep
|
| 237 |
+
# them, we should skip block 1 for the set instead.
|
| 238 |
+
declare -A dur_threshold=( ["cts"]=0.0 ["vox_gsmfr"]=5.0 )
|
| 239 |
+
|
| 240 |
+
declare -A uttPerSpk_threshold=( ["cts"]=2 ["vox_gsmfr"]=2 ) # Kept if more than this threshold. (I.e. equality not sufficient.)
|
| 241 |
+
|
| 242 |
+
true && {
|
| 243 |
+
# Following the Kaldi recipe: https://github.com/kaldi-asr/kaldi/blob/71f38e62cad01c3078555bfe78d0f3a527422d75/egs/sre16/v2/run.sh#L189
|
| 244 |
+
# We filter out the utterances with duration less than 5s
|
| 245 |
+
echo "Stage 9, block 1"
|
| 246 |
+
echo "Applying filtering based on voice duration "
|
| 247 |
+
#for dset in cts vox_gsmfr; do
|
| 248 |
+
for dset in cts; do
|
| 249 |
+
n_utt_before=$( wc -l ${data}/${dset}/utt2spk | cut -f1 -d " " )
|
| 250 |
+
n_spk_before=$( wc -l ${data}/${dset}/spk2utt | cut -f1 -d " " )
|
| 251 |
+
python3 local/filter_utt_accd_dur.py \
|
| 252 |
+
--wav_scp ${data}/${dset}/wav.scp \
|
| 253 |
+
--utt2voice_dur ${data}/${dset}/utt2voice_dur \
|
| 254 |
+
--filter_wav_scp ${data}/${dset}/filter_wav.scp \
|
| 255 |
+
--dur_thres ${voice_dur_threshold[$dset]}
|
| 256 |
+
mv ${data}/${dset}/wav.scp ${data}/${dset}/wav.scp.bak
|
| 257 |
+
mv ${data}/${dset}/filter_wav.scp ${data}/${dset}/wav.scp
|
| 258 |
+
tools/fix_data_dir.sh ${data}/${dset}
|
| 259 |
+
echo " $dset "
|
| 260 |
+
echo " #utt / #spk before: $n_utt_before / $n_spk_before "
|
| 261 |
+
n_utt_after=$( wc -l ${data}/${dset}/utt2spk | cut -f1 -d " " )
|
| 262 |
+
n_spk_after=$( wc -l ${data}/${dset}/spk2utt | cut -f1 -d " " )
|
| 263 |
+
echo " #utt / #spk after: $n_utt_after / $n_spk_after "
|
| 264 |
+
done
|
| 265 |
+
}
|
| 266 |
+
echo "Stage 9, block 2"
|
| 267 |
+
echo "Applying filtering based on the whole utterance duration (including non-speech parts) "
|
| 268 |
+
#for dset in cts vox_gsmfr; do
|
| 269 |
+
for dset in vox_gsmfr; do
|
| 270 |
+
n_utt_before=$( wc -l ${data}/${dset}/utt2spk | cut -f1 -d " " )
|
| 271 |
+
n_spk_before=$( wc -l ${data}/${dset}/spk2utt | cut -f1 -d " " )
|
| 272 |
+
python3 local/filter_utt_accd_dur.py \
|
| 273 |
+
--wav_scp ${data}/${dset}/wav.scp \
|
| 274 |
+
--utt2voice_dur ${data}/${dset}/utt2dur \
|
| 275 |
+
--filter_wav_scp ${data}/${dset}/filter_wav.scp \
|
| 276 |
+
--dur_thres ${dur_threshold[$dset]}
|
| 277 |
+
mv ${data}/${dset}/wav.scp ${data}/${dset}/wav.scp.bak
|
| 278 |
+
mv ${data}/${dset}/filter_wav.scp ${data}/${dset}/wav.scp
|
| 279 |
+
tools/fix_data_dir.sh ${data}/${dset}
|
| 280 |
+
echo " $dset "
|
| 281 |
+
echo " #utt / #spk before: $n_utt_before / $n_spk_before "
|
| 282 |
+
n_utt_after=$( wc -l ${data}/${dset}/utt2spk | cut -f1 -d " " )
|
| 283 |
+
n_spk_after=$( wc -l ${data}/${dset}/spk2utt | cut -f1 -d " " )
|
| 284 |
+
echo " #utt / #spk after: $n_utt_after / $n_spk_after "
|
| 285 |
+
done
|
| 286 |
+
|
| 287 |
+
|
| 288 |
+
# Similarly, following the Kaldi recipe,
|
| 289 |
+
# we throw out speakers with fewer than 3 utterances.
|
| 290 |
+
echo "Stage 9, block 3"
|
| 291 |
+
for dset in cts vox_gsmfr; do
|
| 292 |
+
#tools/fix_data_dir.sh ${data}/${dset}
|
| 293 |
+
cp ${data}/${dset}/spk2utt ${data}/${dset}/spk2utt.bak
|
| 294 |
+
awk -v thr=${uttPerSpk_threshold[$dset]} '{if(NF>thr){print $0}}' ${data}/${dset}/spk2utt.bak > ${data}/${dset}/spk2utt
|
| 295 |
+
tools/spk2utt_to_utt2spk.pl ${data}/${dset}/spk2utt > ${data}/${dset}/utt2spk
|
| 296 |
+
tools/fix_data_dir.sh ${data}/${dset}
|
| 297 |
+
done
|
| 298 |
+
|
| 299 |
+
./tools/combine_data.sh data/cts_vox data/cts/ data/vox_gsmfr
|
| 300 |
+
if $include_voxceleb_vad_in_train_data;then
|
| 301 |
+
cat data/cts/vad data/vox_gsmfr/vad > data/cts_vox/vad
|
| 302 |
+
else
|
| 303 |
+
cat data/cts/vad > data/cts_vox/vad
|
| 304 |
+
fi
|
| 305 |
+
fi
|
| 306 |
+
|
| 307 |
+
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/prepare_sre18.sh
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2023 Johan Rohdin (rohdin@fit.vutbr.cz)
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
set -o pipefail
|
| 19 |
+
|
| 20 |
+
export LC_ALL=C
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
sre18_dev_dir=""
|
| 24 |
+
sre18_eval_dir=""
|
| 25 |
+
sre18_eval_keys_file=""
|
| 26 |
+
data_dir=data/sre18
|
| 27 |
+
wav_dir=wav/
|
| 28 |
+
stage=1
|
| 29 |
+
stop_stage=1
|
| 30 |
+
|
| 31 |
+
. tools/parse_options.sh || exit 1
|
| 32 |
+
|
| 33 |
+
echo "sre18 dev dir: $sre18_dev_dir"
|
| 34 |
+
echo "sre18 eval dir: $sre18_eval_dir"
|
| 35 |
+
echo "sre18 eval keys file: $sre18_eval_keys_file"
|
| 36 |
+
|
| 37 |
+
declare -A set2dir=( ["dev"]=$sre18_dev_dir ["eval"]=$sre18_eval_dir )
|
| 38 |
+
declare -A set2subset=( ["dev"]="enrollment test unlabeled" ["eval"]="enrollment test" )
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
for z in dev eval;do
|
| 45 |
+
src_dir=${set2dir[$z]}
|
| 46 |
+
|
| 47 |
+
echo "Processing SRE 18 $z set from $src_dir"
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
true && {
|
| 51 |
+
for s in ${set2subset[$z]};do
|
| 52 |
+
|
| 53 |
+
tgt_dir=$data_dir/$z/$s
|
| 54 |
+
echo " - $s set. Storing in $tgt_dir"
|
| 55 |
+
mkdir -p $tgt_dir
|
| 56 |
+
|
| 57 |
+
if [ -f $tgt_dir/wav.scp ];then
|
| 58 |
+
rm $tgt_dir/wav.scp
|
| 59 |
+
fi
|
| 60 |
+
|
| 61 |
+
# Create the wav files
|
| 62 |
+
for x in $( ls $src_dir/data/${s}/ );do
|
| 63 |
+
name=$(basename $x .sph)
|
| 64 |
+
if [ $name != $x ];then
|
| 65 |
+
# suffix is .sph
|
| 66 |
+
echo "$name ffmpeg -nostdin -i $src_dir/data/${s}/$x -ar 8000 -f wav pipe:1 |" >> $tgt_dir/wav.scp
|
| 67 |
+
else
|
| 68 |
+
name=$(basename $x .flac)
|
| 69 |
+
if [ $name != $x ];then
|
| 70 |
+
# suffix is .flac
|
| 71 |
+
# From http://trac.ffmpeg.org/wiki/audio%20types:"The default for muxing
|
| 72 |
+
# into WAV files is pcm_s16le." so the below should be ok.
|
| 73 |
+
echo "$name ffmpeg -nostdin -i $src_dir/data/${s}/$x -ar 8000 -f wav pipe:1 |" >> $tgt_dir/wav.scp
|
| 74 |
+
else
|
| 75 |
+
echo "ERROR: Invalid suffix in file $x"
|
| 76 |
+
exit 1
|
| 77 |
+
fi
|
| 78 |
+
fi
|
| 79 |
+
done
|
| 80 |
+
done
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
# Mappings for "enrollment models" <-> "utterances"
|
| 84 |
+
# The evaluation consider enrollment "models" rather than enrollment "speakers". Possibly several models could be
|
| 85 |
+
# from the same speaker. There speaker ID of the models are not known. So we can't create "spk2utt" and utt2spk".
|
| 86 |
+
# For test data there is no such mappings either.
|
| 87 |
+
grep -v modelid $src_dir/docs/sre18_${z}_enrollment.tsv | cut -f1,2 | sed "s:\t: :" > $data_dir/$z/enrollment/enrollment.txt
|
| 88 |
+
cat $data_dir/$z/enrollment/enrollment.txt | sed "s:.sph$::" | sed "s:.flac$: :" \
|
| 89 |
+
| awk '{print $2 " " $1}' > $data_dir/$z/enrollment/utt2mdl_id
|
| 90 |
+
# No utterance is used in more than one mdl so utt2mdl_id makes sense.
|
| 91 |
+
./tools/utt2spk_to_spk2utt.pl $data_dir/$z/enrollment/utt2mdl_id > $data_dir/$z/enrollment/mdl_id2utt
|
| 92 |
+
|
| 93 |
+
true && {
|
| 94 |
+
# Trial list and keys. Not available in the eval directory so the specified file is used.
|
| 95 |
+
if [ $z == "eval" ];then
|
| 96 |
+
cp $sre18_eval_keys_file $data_dir/$z/
|
| 97 |
+
key_name=$( basename $sre18_eval_keys_file .tbz2)
|
| 98 |
+
tar -xvf $data_dir/$z/${key_name}.tbz2 -C $data_dir/$z/
|
| 99 |
+
key_file=$data_dir/$z/LDC2018E51/docs/sre18_eval_trial_key.tsv
|
| 100 |
+
else
|
| 101 |
+
key_file=$src_dir/docs/sre18_dev_trial_key.tsv
|
| 102 |
+
fi
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
tail -n+2 $key_file | cut -f1,2,4 | sed "s:\.sph::" | sed "s:\.flac::" | sed "s:\t: :g" > $data_dir/$z/sre18_${z}_trials
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
done
|
| 109 |
+
fi
|
| 110 |
+
|
| 111 |
+
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/prepare_sre21.sh
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2023 Johan Rohdin (rohdin@fit.vutbr.cz)
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
set -o pipefail
|
| 19 |
+
|
| 20 |
+
export LC_ALL=C
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
sre21_dev_dir=""
|
| 24 |
+
sre21_eval_dir=""
|
| 25 |
+
sre21_eval_keys_file=""
|
| 26 |
+
data_dir=data/sre21
|
| 27 |
+
wav_dir=wav/ #sre21_eval
|
| 28 |
+
stage=1
|
| 29 |
+
stop_stage=1
|
| 30 |
+
|
| 31 |
+
. tools/parse_options.sh || exit 1
|
| 32 |
+
|
| 33 |
+
echo "sre21 dev dir: $sre21_dev_dir"
|
| 34 |
+
echo "sre21 eval dir: $sre21_eval_dir"
|
| 35 |
+
echo "sre21 eval keys file: $sre21_eval_keys_file"
|
| 36 |
+
|
| 37 |
+
declare -A set2dir=( ["dev"]=$sre21_dev_dir ["eval"]=$sre21_eval_dir )
|
| 38 |
+
|
| 39 |
+
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
for z in dev eval;do
|
| 43 |
+
src_dir=${set2dir[$z]}
|
| 44 |
+
|
| 45 |
+
echo "Processing SRE 21 $z set from $src_dir"
|
| 46 |
+
|
| 47 |
+
true && {
|
| 48 |
+
for s in enrollment test;do
|
| 49 |
+
|
| 50 |
+
tgt_dir=$data_dir/$z/$s
|
| 51 |
+
echo " - $s set. Storing in $tgt_dir"
|
| 52 |
+
mkdir -p $tgt_dir
|
| 53 |
+
|
| 54 |
+
if [ -f $tgt_dir/wav.scp ];then
|
| 55 |
+
rm $tgt_dir/wav.scp
|
| 56 |
+
fi
|
| 57 |
+
|
| 58 |
+
# Create the wav files
|
| 59 |
+
for x in $( ls $src_dir/data/audio/${s}/ );do
|
| 60 |
+
name=$(basename $x .sph)
|
| 61 |
+
if [ $name != $x ];then
|
| 62 |
+
# suffix is .sph
|
| 63 |
+
echo "$name ffmpeg -nostdin -i $src_dir/data/audio/${s}/$x -ar 8000 -f wav pipe:1 |" >> $tgt_dir/wav.scp
|
| 64 |
+
else
|
| 65 |
+
name=$(basename $x .flac)
|
| 66 |
+
if [ $name != $x ];then
|
| 67 |
+
# suffix is .flac
|
| 68 |
+
# From http://trac.ffmpeg.org/wiki/audio%20types:"The default for muxing
|
| 69 |
+
# into WAV files is pcm_s16le." so the below should be ok.
|
| 70 |
+
echo "$name ffmpeg -nostdin -i $src_dir/data/audio/${s}/$x -ar 8000 -f wav pipe:1 |" >> $tgt_dir/wav.scp
|
| 71 |
+
else
|
| 72 |
+
echo "ERROR: Invalid suffix in file $x"
|
| 73 |
+
exit 1
|
| 74 |
+
fi
|
| 75 |
+
fi
|
| 76 |
+
done
|
| 77 |
+
done
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
# Mappings for "enrollment models" <-> "utterances"
|
| 81 |
+
# The evaluation consider enrollment "models" rather than enrollment "speakers". Possibly several models could be
|
| 82 |
+
# from the same speaker. There speaker ID of the models are not known. So we can't create "spk2utt" and utt2spk".
|
| 83 |
+
# For test data there is no such mappings either.
|
| 84 |
+
grep -v modelid $src_dir/docs/sre21_audio_${z}_enrollment.tsv | sed "s:\t: :" > $data_dir/$z/enrollment/enrollment.txt
|
| 85 |
+
cat $data_dir/$z/enrollment/enrollment.txt | sed "s:.sph$::" | sed "s:.flac$: :" \
|
| 86 |
+
| awk '{print $2 " " $1}' > $data_dir/$z/enrollment/utt2mdl_id
|
| 87 |
+
# No utterance is used in more than one mdl so utt2mdl_id makes sense.
|
| 88 |
+
./tools/utt2spk_to_spk2utt.pl $data_dir/$z/enrollment/utt2mdl_id > $data_dir/$z/enrollment/mdl_id2utt
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
# Trial list and keys. Not available in the eval directory so the specified file is used.
|
| 92 |
+
if [ $z == "eval" ];then
|
| 93 |
+
cp $sre21_eval_keys_file $data_dir/$z/
|
| 94 |
+
key_name=$( basename $sre21_eval_keys_file )
|
| 95 |
+
echo "tar -xvf $data_dir/$z/$key_name -C $data_dir/$z/"
|
| 96 |
+
tar -xvf $data_dir/$z/$key_name -C $data_dir/$z/
|
| 97 |
+
key_file=$data_dir/$z/sre21/releases/LDC2021E10/docs/sre21_audio_eval_trial_key.tsv
|
| 98 |
+
else
|
| 99 |
+
key_file=$src_dir/docs/sre21_audio_dev_trial_key.tsv
|
| 100 |
+
fi
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
tail -n+2 $key_file | cut -f1,2,3 | sed "s:\.sph::" | sed "s:\.flac::" | sed "s:\t: :g" > $data_dir/$z/sre21_${z}_trials
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
done
|
| 107 |
+
fi
|
| 108 |
+
|
| 109 |
+
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/prepare_vox.sh
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2022 Hongji Wang (jijijiang77@gmail.com)
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
|
| 17 |
+
stage=-1
|
| 18 |
+
stop_stage=-1
|
| 19 |
+
data=data
|
| 20 |
+
|
| 21 |
+
. tools/parse_options.sh || exit 1
|
| 22 |
+
|
| 23 |
+
data=`realpath ${data}`
|
| 24 |
+
download_dir=${data}/download_data
|
| 25 |
+
rawdata_dir=${data}/raw_data
|
| 26 |
+
|
| 27 |
+
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
| 28 |
+
echo "Download musan.tar.gz, rirs_noises.zip, vox1_test_wav.zip, vox1_dev_wav.zip, and vox2_aac.zip."
|
| 29 |
+
echo "This may take a long time. Thus we recommand you to download all archives above in your own way first."
|
| 30 |
+
|
| 31 |
+
./local/download_data.sh --download_dir ${download_dir}
|
| 32 |
+
fi
|
| 33 |
+
|
| 34 |
+
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
|
| 35 |
+
echo "Decompress all archives ..."
|
| 36 |
+
echo "This could take some time ..."
|
| 37 |
+
|
| 38 |
+
for archive in musan.tar.gz rirs_noises.zip vox1_test_wav.zip vox1_dev_wav.zip vox2_aac.zip; do
|
| 39 |
+
[ ! -f ${download_dir}/$archive ] && echo "Archive $archive not exists !!!" && exit 1
|
| 40 |
+
done
|
| 41 |
+
[ ! -d ${rawdata_dir} ] && mkdir -p ${rawdata_dir}
|
| 42 |
+
|
| 43 |
+
if [ ! -d ${rawdata_dir}/musan ]; then
|
| 44 |
+
tar -xzvf ${download_dir}/musan.tar.gz -C ${rawdata_dir}
|
| 45 |
+
fi
|
| 46 |
+
|
| 47 |
+
if [ ! -d ${rawdata_dir}/RIRS_NOISES ]; then
|
| 48 |
+
unzip ${download_dir}/rirs_noises.zip -d ${rawdata_dir}
|
| 49 |
+
fi
|
| 50 |
+
|
| 51 |
+
if [ ! -d ${rawdata_dir}/voxceleb1 ]; then
|
| 52 |
+
mkdir -p ${rawdata_dir}/voxceleb1/test ${rawdata_dir}/voxceleb1/dev
|
| 53 |
+
unzip ${download_dir}/vox1_test_wav.zip -d ${rawdata_dir}/voxceleb1/test
|
| 54 |
+
unzip ${download_dir}/vox1_dev_wav.zip -d ${rawdata_dir}/voxceleb1/dev
|
| 55 |
+
fi
|
| 56 |
+
|
| 57 |
+
if [ ! -d ${rawdata_dir}/voxceleb2_m4a ]; then
|
| 58 |
+
mkdir -p ${rawdata_dir}/voxceleb2_m4a
|
| 59 |
+
unzip ${download_dir}/vox2_aac.zip -d ${rawdata_dir}/voxceleb2_m4a
|
| 60 |
+
fi
|
| 61 |
+
|
| 62 |
+
echo "Decompress success !!!"
|
| 63 |
+
fi
|
| 64 |
+
|
| 65 |
+
if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then
|
| 66 |
+
echo "Convert voxceleb2 wav format from m4a to wav using ffmpeg."
|
| 67 |
+
echo "This could also take some time ..."
|
| 68 |
+
|
| 69 |
+
if [ ! -d ${rawdata_dir}/voxceleb2_wav ]; then
|
| 70 |
+
./local/m4a2wav.pl ${rawdata_dir}/voxceleb2_m4a dev ${rawdata_dir}/voxceleb2_wav
|
| 71 |
+
# Here we use 8 parallel jobs
|
| 72 |
+
cat ${rawdata_dir}/voxceleb2_wav/dev/m4a2wav_dev.sh | xargs -P 8 -i sh -c "{}"
|
| 73 |
+
fi
|
| 74 |
+
|
| 75 |
+
echo "Convert m4a2wav success !!!"
|
| 76 |
+
fi
|
| 77 |
+
|
| 78 |
+
if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then
|
| 79 |
+
echo "Prepare wav.scp for each dataset ..."
|
| 80 |
+
export LC_ALL=C # kaldi config
|
| 81 |
+
|
| 82 |
+
mkdir -p ${data}/musan ${data}/rirs ${data}/vox1 ${data}/vox2_dev
|
| 83 |
+
# musan
|
| 84 |
+
find ${rawdata_dir}/musan -name "*.wav" | awk -F"/" '{print $(NF-2)"/"$(NF-1)"/"$NF,$0}' >${data}/musan/wav.scp
|
| 85 |
+
# rirs
|
| 86 |
+
find ${rawdata_dir}/RIRS_NOISES/simulated_rirs -name "*.wav" | awk -F"/" '{print $(NF-2)"/"$(NF-1)"/"$NF,$0}' >${data}/rirs/wav.scp
|
| 87 |
+
# vox1
|
| 88 |
+
find ${rawdata_dir}/voxceleb1 -name "*.wav" | awk -F"/" '{print $(NF-2)"/"$(NF-1)"/"$NF,$0}' | sort >${data}/vox1/wav.scp
|
| 89 |
+
awk '{print $1}' ${data}/vox1/wav.scp | awk -F "/" '{print $0,$1}' >${data}/vox1/utt2spk
|
| 90 |
+
./tools/utt2spk_to_spk2utt.pl ${data}/vox1/utt2spk >${data}/vox1/spk2utt
|
| 91 |
+
if [ ! -d ${data}/vox1/trials ]; then
|
| 92 |
+
echo "Download trials for vox1 ..."
|
| 93 |
+
mkdir -p ${data}/vox1/trials
|
| 94 |
+
#wget --no-check-certificate https://www.robots.ox.ac.uk/~vgg/data/voxceleb/meta/veri_test.txt -O ${data}/vox1/trials/vox1-O.txt
|
| 95 |
+
#wget --no-check-certificate https://www.robots.ox.ac.uk/~vgg/data/voxceleb/meta/list_test_hard.txt -O ${data}/vox1/trials/vox1-H.txt
|
| 96 |
+
#wget --no-check-certificate https://www.robots.ox.ac.uk/~vgg/data/voxceleb/meta/list_test_all.txt -O ${data}/vox1/trials/vox1-E.txt
|
| 97 |
+
wget --no-check-certificate https://www.robots.ox.ac.uk/~vgg/data/voxceleb/meta/veri_test2.txt -O ${data}/vox1/trials/vox1-O\(cleaned\).txt
|
| 98 |
+
wget --no-check-certificate https://www.robots.ox.ac.uk/~vgg/data/voxceleb/meta/list_test_hard2.txt -O ${data}/vox1/trials/vox1-H\(cleaned\).txt
|
| 99 |
+
wget --no-check-certificate https://www.robots.ox.ac.uk/~vgg/data/voxceleb/meta/list_test_all2.txt -O ${data}/vox1/trials/vox1-E\(cleaned\).txt
|
| 100 |
+
# transform them into kaldi trial format
|
| 101 |
+
awk '{if($1==0)label="nontarget";else{label="target"}; print $2,$3,label}' ${data}/vox1/trials/vox1-O\(cleaned\).txt >${data}/vox1/trials/vox1_O_cleaned.kaldi
|
| 102 |
+
awk '{if($1==0)label="nontarget";else{label="target"}; print $2,$3,label}' ${data}/vox1/trials/vox1-H\(cleaned\).txt >${data}/vox1/trials/vox1_H_cleaned.kaldi
|
| 103 |
+
awk '{if($1==0)label="nontarget";else{label="target"}; print $2,$3,label}' ${data}/vox1/trials/vox1-E\(cleaned\).txt >${data}/vox1/trials/vox1_E_cleaned.kaldi
|
| 104 |
+
fi
|
| 105 |
+
# vox2
|
| 106 |
+
find ${rawdata_dir}/voxceleb2_wav -name "*.wav" | awk -F"/" '{print $(NF-2)"/"$(NF-1)"/"$NF,$0}' | sort >${data}/vox2_dev/wav.scp
|
| 107 |
+
awk '{print $1}' ${data}/vox2_dev/wav.scp | awk -F "/" '{print $0,$1}' >${data}/vox2_dev/utt2spk
|
| 108 |
+
./tools/utt2spk_to_spk2utt.pl ${data}/vox2_dev/utt2spk >${data}/vox2_dev/spk2utt
|
| 109 |
+
|
| 110 |
+
echo "Success !!!"
|
| 111 |
+
fi
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/score.sh
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2022 Chengdong Liang (liangchengdong@mail.nwpu.edu.cn)
|
| 4 |
+
# 2023 Zhengyang Chen (chenhzhengyang117@gmail.com)
|
| 5 |
+
# 2024 Johan Rohdin (rohdin@fit.vutbr.cz)
|
| 6 |
+
#
|
| 7 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 8 |
+
# you may not use this file except in compliance with the License.
|
| 9 |
+
# You may obtain a copy of the License at
|
| 10 |
+
#
|
| 11 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 12 |
+
#
|
| 13 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 14 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 15 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 16 |
+
# See the License for the specific language governing permissions and
|
| 17 |
+
# limitations under the License.
|
| 18 |
+
|
| 19 |
+
#exp_dir=
|
| 20 |
+
#trials="trials trials_tgl trials_yue"
|
| 21 |
+
#data=data
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
trials=""
|
| 25 |
+
xvectors=""
|
| 26 |
+
cal_mean_dir=""
|
| 27 |
+
exp_dir=""
|
| 28 |
+
|
| 29 |
+
stage=-1
|
| 30 |
+
stop_stage=-1
|
| 31 |
+
|
| 32 |
+
. tools/parse_options.sh
|
| 33 |
+
. path.sh
|
| 34 |
+
|
| 35 |
+
echo " - trials $trials"
|
| 36 |
+
echo " - xvectors $xvectors"
|
| 37 |
+
echo " - cal_mean dir $cal_mean_dir"
|
| 38 |
+
echo " - exp_dir $exp_dir"
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
scores_dir=${exp_dir}/scores
|
| 42 |
+
|
| 43 |
+
echo $cal_mean_dir
|
| 44 |
+
|
| 45 |
+
if [ -z $cal_mean_dir ];then
|
| 46 |
+
cal_mean_string="--cal_mean False --cal_mean_dir xxxx" # For the moment, score.py requires something to be input to --cal_mean_dir
|
| 47 |
+
output_name=$(basename $xvectors | sed "s:xvector::" | sed "s:.scp::" | sed "s:^_::") # Changes xvector_proc_embd_proc_sre16_major.scp -> proc_embd_proc_sre16_major
|
| 48 |
+
else # xvector.scp -> '' (empty string)
|
| 49 |
+
cal_mean_string="--cal_mean True --cal_mean_dir $cal_mean_dir"
|
| 50 |
+
output_name="mean_$(echo $cal_mean_dir | sed "s:.*embeddings/::" | sed -e "s:/:_:g")" # Name will be e.g. mean_sre16_major if sre16/major data is used
|
| 51 |
+
fi # for mean subtraction.
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
echo $cal_mean_string
|
| 55 |
+
echo $output_name
|
| 56 |
+
|
| 57 |
+
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
| 58 |
+
echo "apply cosine scoring ..."
|
| 59 |
+
mkdir -p ${exp_dir}/scores
|
| 60 |
+
for x in $(echo $trials | tr "," " "); do
|
| 61 |
+
echo "Trials $x"
|
| 62 |
+
python wespeaker/bin/score.py \
|
| 63 |
+
--exp_dir ${exp_dir} \
|
| 64 |
+
--eval_scp_path $xvectors \
|
| 65 |
+
$cal_mean_string \
|
| 66 |
+
${x}
|
| 67 |
+
xx=$(basename $x)
|
| 68 |
+
mv ${scores_dir}/${xx}.score ${scores_dir}/${xx}.${output_name}_cos.score
|
| 69 |
+
done
|
| 70 |
+
fi
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
|
| 74 |
+
echo "compute metrics (EER/minDCF) ..."
|
| 75 |
+
for x in $(echo $trials | tr "," " "); do
|
| 76 |
+
xx=$(basename $x)
|
| 77 |
+
echo $xx
|
| 78 |
+
python wespeaker/bin/compute_metrics.py \
|
| 79 |
+
--p_target 0.01 \
|
| 80 |
+
--c_fa 1 \
|
| 81 |
+
--c_miss 1 \
|
| 82 |
+
${scores_dir}/${xx}.${output_name}_cos.score \
|
| 83 |
+
2>&1 | tee ${scores_dir}/${xx}.${output_name}_cos.result
|
| 84 |
+
|
| 85 |
+
echo "compute DET curve ..."
|
| 86 |
+
python wespeaker/bin/compute_det.py \
|
| 87 |
+
${scores_dir}/${xx}.${output_name}_cos.score
|
| 88 |
+
done
|
| 89 |
+
fi
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/score_plda.sh
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2023 Shuai Wang (wsstriving@gmail.com)
|
| 4 |
+
# 2024 Johan Rohdin (rohdin@fit.vutbr.cz)
|
| 5 |
+
#
|
| 6 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 7 |
+
# you may not use this file except in compliance with the License.
|
| 8 |
+
# You may obtain a copy of the License at
|
| 9 |
+
#
|
| 10 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 11 |
+
#
|
| 12 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 13 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 14 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 15 |
+
# See the License for the specific language governing permissions and
|
| 16 |
+
# limitations under the License.
|
| 17 |
+
exp_dir="exp/ResNet34-TSTP-emb256-fbank40-num_frms200-aug0.6-spFalse-saFalse-Softmax-SGD-epoch10/"
|
| 18 |
+
data=data
|
| 19 |
+
trials="${data}/sre16/eval/trials ${data}/sre16/eval/trials_tgl ${data}/sre16/eval/trials_yue"
|
| 20 |
+
aug_plda_data=0
|
| 21 |
+
|
| 22 |
+
enroll_scp=sre16/eval/enrollment/xvector.scp
|
| 23 |
+
test_scp=sre16/eval/test/xvector.scp
|
| 24 |
+
utt2spk=data/sre16/eval/enrollment/utt2spk
|
| 25 |
+
preprocessing_chain='length-norm'
|
| 26 |
+
preprocessing_path="${exp_dir}/embd_proc.pkl"
|
| 27 |
+
|
| 28 |
+
stage=-1
|
| 29 |
+
stop_stage=-1
|
| 30 |
+
|
| 31 |
+
. tools/parse_options.sh
|
| 32 |
+
. path.sh
|
| 33 |
+
|
| 34 |
+
if [ $aug_plda_data = 0 ];then
|
| 35 |
+
sre_plda_data=cts
|
| 36 |
+
else
|
| 37 |
+
sre_plda_data=cts_aug
|
| 38 |
+
fi
|
| 39 |
+
|
| 40 |
+
echo "preprocessing_path $preprocessing_path"
|
| 41 |
+
preproc_name=$(basename $preprocessing_path .pkl)
|
| 42 |
+
echo "preproc_name $preproc_name"
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
# Kaldi PLDA cts_aug, cts_aug mean, speaker mean last, no lnorm in PLDA
|
| 47 |
+
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
| 48 |
+
echo "Preparing preprocessing chain for backend "
|
| 49 |
+
python wespeaker/bin/prep_embd_proc.py \
|
| 50 |
+
--chain "$preprocessing_chain" \
|
| 51 |
+
--path $preprocessing_path
|
| 52 |
+
echo "Backend preprocessor prepared"
|
| 53 |
+
fi
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
|
| 57 |
+
echo "Applying preprocessing on PLDA training data."
|
| 58 |
+
python wespeaker/bin/apply_embd_proc.py \
|
| 59 |
+
--path $preprocessing_path \
|
| 60 |
+
--input ${exp_dir}/embeddings/${sre_plda_data}/xvector.scp \
|
| 61 |
+
--output ${exp_dir}/embeddings/${sre_plda_data}/xvector_proc_$preproc_name.ark,scp
|
| 62 |
+
fi
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then
|
| 66 |
+
echo "train the plda model ..."
|
| 67 |
+
python wespeaker/bin/train_plda.py \
|
| 68 |
+
--exp_dir ${exp_dir} \
|
| 69 |
+
--scp_path ${exp_dir}/embeddings/${sre_plda_data}/xvector_proc_$preproc_name.scp \
|
| 70 |
+
--utt2spk ${data}/${sre_plda_data}/utt2spk \
|
| 71 |
+
--indim 100 \
|
| 72 |
+
--iter 10
|
| 73 |
+
echo "plda training finished"
|
| 74 |
+
fi
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then
|
| 78 |
+
echo "Applying preprocessing on evaluation and adaptation data."
|
| 79 |
+
for x in $enroll_scp $test_scp $indomain_scp;do
|
| 80 |
+
#new_x=$(echo $x | sed "s:\.scp:_proc\.ark,scp:")
|
| 81 |
+
new_x=$(echo $x | sed "s:\.scp:_proc_$preproc_name\.ark,scp:")
|
| 82 |
+
echo "Processing in: $x"
|
| 83 |
+
echo "Processing out: $new_x"
|
| 84 |
+
python wespeaker/bin/apply_embd_proc.py \
|
| 85 |
+
--path $preprocessing_path \
|
| 86 |
+
--input ${exp_dir}/embeddings/$x \
|
| 87 |
+
--output ${exp_dir}/embeddings/$new_x
|
| 88 |
+
done
|
| 89 |
+
fi
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then
|
| 93 |
+
echo "apply plda scoring ..."
|
| 94 |
+
mkdir -p ${exp_dir}/scores
|
| 95 |
+
|
| 96 |
+
enroll_scp=$(echo $enroll_scp | sed "s:\.scp:_proc_$preproc_name\.scp:")
|
| 97 |
+
test_scp=$(echo $test_scp | sed "s:\.scp:_proc_$preproc_name\.scp:")
|
| 98 |
+
|
| 99 |
+
for x in $(echo $trials | tr "," " "); do
|
| 100 |
+
xx=$(basename $x)
|
| 101 |
+
echo "scoring on " $x
|
| 102 |
+
python wespeaker/bin/eval_plda.py \
|
| 103 |
+
--enroll_scp_path ${exp_dir}/embeddings/$enroll_scp \
|
| 104 |
+
--test_scp_path ${exp_dir}/embeddings/$test_scp \
|
| 105 |
+
--utt2spk $utt2spk \
|
| 106 |
+
--trial ${x} \
|
| 107 |
+
--score_path ${exp_dir}/scores/${xx}.proc_${preproc_name}_plda.score \
|
| 108 |
+
--model_path ${exp_dir}/plda
|
| 109 |
+
done
|
| 110 |
+
fi
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
if [ ${stage} -le 6 ] && [ ${stop_stage} -ge 6 ]; then
|
| 114 |
+
echo "compute metrics (EER/minDCF) ..."
|
| 115 |
+
scores_dir=${exp_dir}/scores
|
| 116 |
+
for x in $(echo $trials | tr "," " "); do
|
| 117 |
+
xx=$(basename $x)
|
| 118 |
+
python wespeaker/bin/compute_metrics.py \
|
| 119 |
+
--p_target 0.01 \
|
| 120 |
+
--c_fa 1 \
|
| 121 |
+
--c_miss 1 \
|
| 122 |
+
${scores_dir}/${xx}.proc_${preproc_name}_plda.score \
|
| 123 |
+
2>&1 | tee ${scores_dir}/${xx}.proc_${preproc_name}_plda.result
|
| 124 |
+
# 2>&1 | tee -a ${scores_dir}/${xx}_plda_result
|
| 125 |
+
|
| 126 |
+
echo "compute DET curve ..."
|
| 127 |
+
python wespeaker/bin/compute_det.py \
|
| 128 |
+
${scores_dir}/${xx}.proc_${preproc_name}_plda.score
|
| 129 |
+
done
|
| 130 |
+
fi
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/score_plda_adapt.sh
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2023 Shuai Wang (wsstriving@gmail.com)
|
| 4 |
+
# 2024 Johan Rohdin (rohdin@fit.vutbr.cz)
|
| 5 |
+
#
|
| 6 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 7 |
+
# you may not use this file except in compliance with the License.
|
| 8 |
+
# You may obtain a copy of the License at
|
| 9 |
+
#
|
| 10 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 11 |
+
#
|
| 12 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 13 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 14 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 15 |
+
# See the License for the specific language governing permissions and
|
| 16 |
+
# limitations under the License.
|
| 17 |
+
exp_dir=exp/ResNet34-TSTP-emb256-fbank40-num_frms200-aug0.6-spFalse-saFalse-Softmax-SGD-epoch10/
|
| 18 |
+
data=data
|
| 19 |
+
trials="${data}/sre16/eval/trials ${data}/sre16/eval/trials_tgl ${data}/sre16/eval/trials_yue"
|
| 20 |
+
aug_plda_data=0
|
| 21 |
+
|
| 22 |
+
enroll_scp=sre16/eval/enrollment/xvector.scp
|
| 23 |
+
test_scp=sre16/eval/test/xvector.scp
|
| 24 |
+
indomain_scp=sre16/major/xvector.scp # For adaptation
|
| 25 |
+
utt2spk=data/sre16/eval/enrollment/utt2spk
|
| 26 |
+
preprocessing_path=${exp_dir}/embd_proc_sre16_major.pkl
|
| 27 |
+
|
| 28 |
+
stage=-1
|
| 29 |
+
stop_stage=-1
|
| 30 |
+
|
| 31 |
+
. tools/parse_options.sh
|
| 32 |
+
. path.sh
|
| 33 |
+
|
| 34 |
+
if [ $aug_plda_data = 0 ];then
|
| 35 |
+
sre_plda_data=sre
|
| 36 |
+
else
|
| 37 |
+
sre_plda_data=sre_aug
|
| 38 |
+
fi
|
| 39 |
+
|
| 40 |
+
preproc_name=$(basename $preprocessing_path .pkl)
|
| 41 |
+
|
| 42 |
+
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
| 43 |
+
echo "Applying preprocessing on evaluation and adaptation data."
|
| 44 |
+
for x in $enroll_scp $test_scp $indomain_scp;do
|
| 45 |
+
#new_x=$(echo $x | sed "s:\.scp:_proc\.ark,scp:")
|
| 46 |
+
new_x=$(echo $x | sed "s:\.scp:_proc_$preproc_name\.ark,scp:")
|
| 47 |
+
echo "Processing in: $x"
|
| 48 |
+
echo "Processing out: $new_x"
|
| 49 |
+
python wespeaker/bin/apply_embd_proc.py \
|
| 50 |
+
--path $preprocessing_path \
|
| 51 |
+
--input ${exp_dir}/embeddings/$x \
|
| 52 |
+
--output ${exp_dir}/embeddings/$new_x
|
| 53 |
+
done
|
| 54 |
+
fi
|
| 55 |
+
|
| 56 |
+
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
|
| 57 |
+
echo "adapt the plda model ..."
|
| 58 |
+
|
| 59 |
+
indomain_scp=$(echo $indomain_scp | sed "s:\.scp:_proc_$preproc_name\.scp:")
|
| 60 |
+
|
| 61 |
+
python wespeaker/bin/adapt_plda.py \
|
| 62 |
+
-mo ${exp_dir}/plda \
|
| 63 |
+
-ma ${exp_dir}/plda_adapt \
|
| 64 |
+
-ad ${exp_dir}/embeddings/$indomain_scp \
|
| 65 |
+
-ws 0.75 \
|
| 66 |
+
-as 0.25
|
| 67 |
+
echo "plda adapted finished"
|
| 68 |
+
fi
|
| 69 |
+
|
| 70 |
+
if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then
|
| 71 |
+
echo "apply plda scoring ..."
|
| 72 |
+
|
| 73 |
+
enroll_scp=$(echo $enroll_scp | sed "s:\.scp:_proc_$preproc_name\.scp:")
|
| 74 |
+
test_scp=$(echo $test_scp | sed "s:\.scp:_proc_$preproc_name\.scp:")
|
| 75 |
+
|
| 76 |
+
mkdir -p ${exp_dir}/scores
|
| 77 |
+
for x in $(echo $trials | tr "," " "); do
|
| 78 |
+
xx=$(basename $x)
|
| 79 |
+
echo "scoring on " $x
|
| 80 |
+
python wespeaker/bin/eval_plda.py \
|
| 81 |
+
--enroll_scp_path ${exp_dir}/embeddings/$enroll_scp \
|
| 82 |
+
--test_scp_path ${exp_dir}/embeddings/$test_scp \
|
| 83 |
+
--utt2spk $utt2spk \
|
| 84 |
+
--trial ${x} \
|
| 85 |
+
--score_path ${exp_dir}/scores/${xx}.proc_${preproc_name}_plda_adapt.score \
|
| 86 |
+
--model_path ${exp_dir}/plda_adapt
|
| 87 |
+
done
|
| 88 |
+
fi
|
| 89 |
+
#--indomain_scp ${exp_dir}/embeddings/$indomain_scp \ Note: This option was used before the new code for preprocessing.
|
| 90 |
+
# With this code, all preprocessing takes place in the preprocessing chain. So we don't include it in the above code anymore.
|
| 91 |
+
|
| 92 |
+
if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then
|
| 93 |
+
echo "compute metrics (EER/minDCF) ..."
|
| 94 |
+
scores_dir=${exp_dir}/scores
|
| 95 |
+
for x in $(echo $trials | tr "," " "); do
|
| 96 |
+
xx=$(basename $x)
|
| 97 |
+
python wespeaker/bin/compute_metrics.py \
|
| 98 |
+
--p_target 0.01 \
|
| 99 |
+
--c_fa 1 \
|
| 100 |
+
--c_miss 1 \
|
| 101 |
+
${scores_dir}/${xx}.proc_${preproc_name}_plda_adapt.score \
|
| 102 |
+
2>&1 | tee ${scores_dir}/${xx}.proc_${preproc_name}_plda_adapt.result
|
| 103 |
+
#2>&1 | tee -a ${scores_dir}/${xx}_plda_adapt_result
|
| 104 |
+
|
| 105 |
+
echo "compute DET curve ..."
|
| 106 |
+
python wespeaker/bin/compute_det.py \
|
| 107 |
+
${scores_dir}/${xx}.proc_${preproc_name}_plda_adapt.score
|
| 108 |
+
done
|
| 109 |
+
fi
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/score_plda_org.sh
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2023 Shuai Wang (wsstriving@gmail.com)
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
exp_dir=
|
| 17 |
+
data=data
|
| 18 |
+
trials="${data}/sre16/eval/trials ${data}/sre16/eval/trials_tgl ${data}/sre16/eval/trials_yue"
|
| 19 |
+
aug_plda_data=0
|
| 20 |
+
|
| 21 |
+
enroll_scp=sre16/eval/enrollment/xvector.scp
|
| 22 |
+
test_scp=sre16/eval/test/xvector.scp
|
| 23 |
+
indomain_scp=sre16/major/xvector.scp # For mean subtraction
|
| 24 |
+
utt2spk=data/sre16/eval/enrollment/utt2spk
|
| 25 |
+
|
| 26 |
+
stage=-1
|
| 27 |
+
stop_stage=-1
|
| 28 |
+
|
| 29 |
+
. tools/parse_options.sh
|
| 30 |
+
. path.sh
|
| 31 |
+
|
| 32 |
+
if [ $aug_plda_data = 0 ];then
|
| 33 |
+
sre_plda_data=cts
|
| 34 |
+
else
|
| 35 |
+
sre_plda_data=cts_aug
|
| 36 |
+
fi
|
| 37 |
+
|
| 38 |
+
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
| 39 |
+
echo "train the plda model ..."
|
| 40 |
+
python wespeaker/bin/train_plda.py \
|
| 41 |
+
--exp_dir ${exp_dir} \
|
| 42 |
+
--scp_path ${exp_dir}/embeddings/${sre_plda_data}/xvector.scp \
|
| 43 |
+
--utt2spk ${data}/${sre_plda_data}/utt2spk \
|
| 44 |
+
--indim 256 \
|
| 45 |
+
--iter 200
|
| 46 |
+
echo "plda training finished"
|
| 47 |
+
fi
|
| 48 |
+
|
| 49 |
+
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
|
| 50 |
+
echo "apply plda scoring ..."
|
| 51 |
+
mkdir -p ${exp_dir}/scores
|
| 52 |
+
for x in $(echo $trials | tr "," " "); do
|
| 53 |
+
xx=$(basename $x)
|
| 54 |
+
echo "scoring on " $x
|
| 55 |
+
python wespeaker/bin/eval_plda.py \
|
| 56 |
+
--enroll_scp_path ${exp_dir}/embeddings/$enroll_scp \
|
| 57 |
+
--test_scp_path ${exp_dir}/embeddings/$test_scp \
|
| 58 |
+
--indomain_scp ${exp_dir}/embeddings/$indomain_scp \
|
| 59 |
+
--utt2spk $utt2spk \
|
| 60 |
+
--trial ${x} \
|
| 61 |
+
--score_path ${exp_dir}/scores/${xx}.pldascore \
|
| 62 |
+
--model_path ${exp_dir}/plda
|
| 63 |
+
done
|
| 64 |
+
fi
|
| 65 |
+
|
| 66 |
+
if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then
|
| 67 |
+
echo "compute metrics (EER/minDCF) ..."
|
| 68 |
+
scores_dir=${exp_dir}/scores
|
| 69 |
+
for x in $(echo $trials | tr "," " "); do
|
| 70 |
+
xx=$(basename $x)
|
| 71 |
+
python wespeaker/bin/compute_metrics.py \
|
| 72 |
+
--p_target 0.01 \
|
| 73 |
+
--c_fa 1 \
|
| 74 |
+
--c_miss 1 \
|
| 75 |
+
${scores_dir}/${xx}.pldascore \
|
| 76 |
+
2>&1 | tee -a ${scores_dir}/${xx}_plda_result
|
| 77 |
+
|
| 78 |
+
echo "compute DET curve ..."
|
| 79 |
+
python wespeaker/bin/compute_det.py \
|
| 80 |
+
${scores_dir}/${xx}.pldascore
|
| 81 |
+
done
|
| 82 |
+
fi
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/local/utt2voice_duration.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2023 Zhengyang Chen
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
import fire
|
| 16 |
+
from collections import OrderedDict
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def main(vad_file, utt2voice_dur):
|
| 20 |
+
utt2voice_dur_dict = OrderedDict()
|
| 21 |
+
|
| 22 |
+
with open(vad_file, 'r') as f:
|
| 23 |
+
for line in f.readlines():
|
| 24 |
+
segs = line.strip().split()
|
| 25 |
+
utt, start, end = segs[-3], float(segs[-2]), float(segs[-1])
|
| 26 |
+
if utt not in utt2voice_dur_dict:
|
| 27 |
+
utt2voice_dur_dict[utt] = 0.0
|
| 28 |
+
utt2voice_dur_dict[utt] += end - start
|
| 29 |
+
|
| 30 |
+
with open(utt2voice_dur, 'w') as f:
|
| 31 |
+
for utt, duration in utt2voice_dur_dict.items():
|
| 32 |
+
f.write('{} {}\n'.format(utt, duration))
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
if __name__ == "__main__":
|
| 36 |
+
fire.Fire(main)
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/path.sh
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export PATH=$PWD:$PATH
|
| 2 |
+
|
| 3 |
+
# NOTE(kan-bayashi): Use UTF-8 in Python to avoid UnicodeDecodeError when LC_ALL=C
|
| 4 |
+
export PYTHONIOENCODING=UTF-8
|
| 5 |
+
export PYTHONPATH=../../../:$PYTHONPATH
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/qsub_extract.sh
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
#
|
| 3 |
+
#$ -cwd
|
| 4 |
+
#$ -V
|
| 5 |
+
#$ -N extract_embd
|
| 6 |
+
#$ -o extract_embd.out
|
| 7 |
+
#$ -e extract_embd.err
|
| 8 |
+
#$ -l gpu=4,ram_free=10G,mem_free=10G,core=2,matylda6=2,scratch=0.5,gpu_ram=16G
|
| 9 |
+
#$ -q long.q@@gpu
|
| 10 |
+
|
| 11 |
+
cd /mnt/matylda6/rohdin/expts/wespeaker/wespeaker_private_test2/examples/sre/v3
|
| 12 |
+
unset PYTHONPATH
|
| 13 |
+
unset PYTHONHOME
|
| 14 |
+
|
| 15 |
+
# >>> conda initialize >>>
|
| 16 |
+
# !! Contents within this block are managed by 'conda init' !!
|
| 17 |
+
__conda_setup="$('/mnt/matylda5/iplchot/python_public/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
|
| 18 |
+
if [ $? -eq 0 ]; then
|
| 19 |
+
eval "$__conda_setup"
|
| 20 |
+
else
|
| 21 |
+
if [ -f "/mnt/matylda5/iplchot/python_public/anaconda3/etc/profile.d/conda.sh" ]; then
|
| 22 |
+
. "/mnt/matylda5/iplchot/python_public/anaconda3/etc/profile.d/conda.sh"
|
| 23 |
+
else
|
| 24 |
+
export PATH="$PATH:/mnt/matylda5/iplchot/python_public/anaconda3/bin"
|
| 25 |
+
fi
|
| 26 |
+
fi
|
| 27 |
+
unset __conda_setup
|
| 28 |
+
# <<< conda initialize <<<
|
| 29 |
+
|
| 30 |
+
conda activate /mnt/matylda6/rohdin/conda/wespeaker_20240220/
|
| 31 |
+
which python
|
| 32 |
+
export PATH=$PATH:/mnt/matylda6/rohdin/software/kaldi_20210625/tools/sph2pipe/
|
| 33 |
+
|
| 34 |
+
./run.sh > logs/run.sh.stage4.log.1 2>&1
|
| 35 |
+
|
| 36 |
+
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/qsub_train.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
#
|
| 3 |
+
#$ -cwd
|
| 4 |
+
#$ -V
|
| 5 |
+
#$ -N train_xvec
|
| 6 |
+
#$ -o train_xvec.out
|
| 7 |
+
#$ -e train_xvec.err
|
| 8 |
+
#$ -pe smp 16
|
| 9 |
+
#$ -l gpu=0.125,ram_free=1.25G,mem_free=1.25G,matylda6=0.625,gpu_ram=16G
|
| 10 |
+
#$ -q long.q@@gpu
|
| 11 |
+
cd /mnt/matylda6/rohdin/expts/wespeaker/wespeaker_private_test2/examples/sre/v3/ # Need to change your training directory.
|
| 12 |
+
|
| 13 |
+
unset PYTHONPATH
|
| 14 |
+
unset PYTHONHOME
|
| 15 |
+
|
| 16 |
+
# >>> conda initialize >>>
|
| 17 |
+
# !! Contents within this block are managed by 'conda init' !!
|
| 18 |
+
__conda_setup="$('/mnt/matylda5/iplchot/python_public/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
|
| 19 |
+
if [ $? -eq 0 ]; then
|
| 20 |
+
eval "$__conda_setup"
|
| 21 |
+
else
|
| 22 |
+
if [ -f "/mnt/matylda5/iplchot/python_public/anaconda3/etc/profile.d/conda.sh" ]; then
|
| 23 |
+
. "/mnt/matylda5/iplchot/python_public/anaconda3/etc/profile.d/conda.sh"
|
| 24 |
+
else
|
| 25 |
+
export PATH="$PATH:/mnt/matylda5/iplchot/python_public/anaconda3/bin"
|
| 26 |
+
fi
|
| 27 |
+
fi
|
| 28 |
+
unset __conda_setup
|
| 29 |
+
# <<< conda initialize <<<
|
| 30 |
+
|
| 31 |
+
conda activate /mnt/matylda6/rohdin/conda/wespeaker_20240220/
|
| 32 |
+
./run.sh > logs/run.sh.stage3.log.1 2>&1
|
| 33 |
+
|
| 34 |
+
|
MOSS_Speaker-RoPE/wespeaker/examples/sre/v3/run.sh
ADDED
|
@@ -0,0 +1,542 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright 2022 Hongji Wang (jijijiang77@gmail.com)
|
| 4 |
+
# 2022 Chengdong Liang (liangchengdong@mail.nwpu.edu.cn)
|
| 5 |
+
# 2023 Zhengyang Chen (chenzhengyang117@gmail.com)
|
| 6 |
+
# 2024 Johan Rohdin (rohdin@fit.vutbr.cz)
|
| 7 |
+
|
| 8 |
+
. ./path.sh || exit 1
|
| 9 |
+
|
| 10 |
+
# Stages
|
| 11 |
+
# 1. Data preparation
|
| 12 |
+
# 2. Shard / raw list creation
|
| 13 |
+
# 3. Training
|
| 14 |
+
# 4. Model averaging, embedding extraction
|
| 15 |
+
# 5. Export model
|
| 16 |
+
# 6. Cosine scoring using cts_aug, sre16_major, sre18_dev_unlabeled for mean subtraction but no other embedding processing
|
| 17 |
+
# 7. PLDA scoring, including length-norm, lda and subtraction of the above mentioned sets. See details at the stage.
|
| 18 |
+
# 8. Adapted PLDA scoring. Same embedding processing as above.
|
| 19 |
+
# 9. Cosine scoring with same embedding processing as above.
|
| 20 |
+
# 10. Summarization of results.
|
| 21 |
+
|
| 22 |
+
stage=1
|
| 23 |
+
stop_stage=1
|
| 24 |
+
|
| 25 |
+
HOST_NODE_ADDR="localhost:29400"
|
| 26 |
+
num_nodes=1
|
| 27 |
+
job_id=2024
|
| 28 |
+
|
| 29 |
+
data=data
|
| 30 |
+
data_type="shard" # shard/raw
|
| 31 |
+
|
| 32 |
+
# whether augment the PLDA data
|
| 33 |
+
aug_plda_data=1
|
| 34 |
+
|
| 35 |
+
config=conf/resnet.yaml
|
| 36 |
+
exp_dir=exp/ResNet34-TSTP-emb256-fbank64-num_frms200-aug0.6-spFalse-saFalse-Softmax-SGD-epoch10
|
| 37 |
+
|
| 38 |
+
# gpus="[0,1]" # For slurm, just specify this according to the number of GPUs you have.
|
| 39 |
+
num_gpus_train=2 # If this variable is defined, safe_gpu will be used to select the free GPUs.
|
| 40 |
+
# If so, it will override whatever may have been specified in gpus="[x,...]
|
| 41 |
+
# Typically, you would want to use this option for SGE.
|
| 42 |
+
# If this variable is not set, or set to '', the script will assume that
|
| 43 |
+
# the GPUs to use are specified in the variable "gpus" as above.
|
| 44 |
+
|
| 45 |
+
num_gpus_extract=4 # We may want to use a different value for extraction.
|
| 46 |
+
|
| 47 |
+
num_avg=10
|
| 48 |
+
checkpoint=
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
. tools/parse_options.sh || exit 1
|
| 52 |
+
|
| 53 |
+
############################################################################################
|
| 54 |
+
# The names of various lists are not consistent across sets. Therefore we need some mappings.
|
| 55 |
+
|
| 56 |
+
# Different sets may use different backend adaptation sets, therefore we need several trial
|
| 57 |
+
# lists. Using "," instead of space as separator is a bit ugly but it seems parse_options.sh
|
| 58 |
+
# cannot process an argument with space properly.
|
| 59 |
+
declare -A trials=( ["sre16_eval"]='data/sre16/eval/trials,data/sre16/eval/trials_yue,data/sre16/eval/trials_tgl'
|
| 60 |
+
["sre18_dev"]="data/sre18/dev/sre18_dev_trials"
|
| 61 |
+
["sre18_eval"]="data/sre18/eval/sre18_eval_trials"
|
| 62 |
+
["sre21_dev"]="data/sre21/dev/sre21_dev_trials"
|
| 63 |
+
["sre21_eval"]="data/sre21/eval/sre21_eval_trials" )
|
| 64 |
+
|
| 65 |
+
declare -A enr_scp=( ["sre16_eval"]='sre16/eval/enrollment/xvector.scp'
|
| 66 |
+
["sre18_dev"]="sre18/dev/enrollment/xvector.scp"
|
| 67 |
+
["sre18_eval"]="sre18/eval/enrollment/xvector.scp"
|
| 68 |
+
["sre21_dev"]="sre21/dev/enrollment/xvector.scp"
|
| 69 |
+
["sre21_eval"]="sre21/eval/enrollment/xvector.scp" )
|
| 70 |
+
|
| 71 |
+
declare -A test_scp=( ["sre16_eval"]='sre16/eval/test/xvector.scp'
|
| 72 |
+
["sre18_dev"]="sre18/dev/test/xvector.scp"
|
| 73 |
+
["sre18_eval"]="sre18/eval/test/xvector.scp"
|
| 74 |
+
["sre21_dev"]="sre21/dev/test/xvector.scp"
|
| 75 |
+
["sre21_eval"]="sre21/eval/test/xvector.scp" )
|
| 76 |
+
|
| 77 |
+
declare -A utt2mdl=( ["sre16_eval"]='data/sre16/eval/enrollment/utt2spk'
|
| 78 |
+
["sre18_dev"]="data/sre18/dev/enrollment/utt2mdl_id"
|
| 79 |
+
["sre18_eval"]="data/sre18/eval/enrollment/utt2mdl_id"
|
| 80 |
+
["sre21_dev"]="data/sre21/dev/enrollment/utt2mdl_id"
|
| 81 |
+
["sre21_eval"]="data/sre21/eval/enrollment/utt2mdl_id" )
|
| 82 |
+
|
| 83 |
+
declare -A mdl2utt=( ["sre16_eval"]='data/sre16/eval/enrollment/spk2utt'
|
| 84 |
+
["sre18_dev"]="data/sre18/dev/enrollment/mdl_id2utt"
|
| 85 |
+
["sre18_eval"]="data/sre18/eval/enrollment/mdl_id2utt"
|
| 86 |
+
["sre21_dev"]="data/sre21/dev/enrollment/mdl_id2utt"
|
| 87 |
+
["sre21_eval"]="data/sre21/eval/enrollment/mdl_id2utt" )
|
| 88 |
+
|
| 89 |
+
declare -A xvectors=( ["sre16_eval"]="sre16/eval/xvector.scp"
|
| 90 |
+
["sre18_dev"]="sre18/dev/xvector.scp"
|
| 91 |
+
["sre18_eval"]="sre18/eval/xvector.scp"
|
| 92 |
+
["sre21_dev"]="sre21/dev/xvector.scp"
|
| 93 |
+
["sre21_eval"]="sre21/eval/xvector.scp" )
|
| 94 |
+
############################################################################################
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
| 98 |
+
echo "Prepare datasets ..."
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
######################################################################################
|
| 102 |
+
### Test sets. Please specify paths
|
| 103 |
+
# SRE16 should be prepared by the Kaldi recipe and the path should be specified here:
|
| 104 |
+
#sre_data_dir=/mnt/matylda4/burget/kaldi-trunk/kaldi/egs/sre16/v2/data/
|
| 105 |
+
# Will be used by ./local/prepare_data.sh below. (only wav.scp, utt2spk and spk2utt files are needed.)
|
| 106 |
+
sre16_unlab_dir=/mnt/matylda2/data/NIST/sre16/LDC2016E46_SRE16_Call_My_Net_Training_Data
|
| 107 |
+
sre16_evalset_dir=/mnt/matylda2/data/NIST/sre16/R149_0_1
|
| 108 |
+
# Eval keys are not in the above directory since they were distributed after the evaluation.
|
| 109 |
+
sre16_evalset_keys=/mnt/matylda2/data/NIST/sre16/download/sre16_evaluation_key.tar.bz2
|
| 110 |
+
|
| 111 |
+
# SRE18
|
| 112 |
+
sre18_devset_dir=/mnt/matylda2/data/NIST/sre18/LDC2018E46_2018_NIST_Speaker_Recognition_Evaluation_Development_Set
|
| 113 |
+
sre18_evalset_dir=/mnt/matylda2/data/LDC/LDC2018E51_2018_NIST_Speaker_Recognition_Evaluation_Test_Set/
|
| 114 |
+
# Eval keys are not in the above directory since they were distributed after the evaluation.
|
| 115 |
+
sre18_evalset_keys=/mnt/matylda2/data/NIST/sre18/LDC2018E51_eval_segment_key.tbz2
|
| 116 |
+
|
| 117 |
+
# SRE21
|
| 118 |
+
sre21_devset_dir=/mnt/matylda2/data/LDC/LDC2021E09_sre21_dev_set/
|
| 119 |
+
sre21_evalset_dir=/mnt/matylda2/data/LDC/LDC2021E10_sre21_eval_set/
|
| 120 |
+
# Eval keys are not in the above directory since they were distributed after the evaluation.
|
| 121 |
+
sre21_evalset_keys=/mnt/matylda2/data/NIST/sre21/download/sre21_test_key.tgz
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
######################################################################################
|
| 125 |
+
### Training sets
|
| 126 |
+
# CTS
|
| 127 |
+
cts_superset_dir=/mnt/matylda2/data/LDC/LDC2021E08_SRE-CTS-Superset/
|
| 128 |
+
|
| 129 |
+
# VoxCeleb
|
| 130 |
+
voxceleb_dir="/mnt/matylda6/rohdin/expts/wespeaker/wespeaker/examples/voxceleb/v2/data/"
|
| 131 |
+
|
| 132 |
+
# This script is based on ../v2/local/prepare_data.sh
|
| 133 |
+
# Copies SRE16 relevant files, extracts VAD for all files, does some pruning of the training set.
|
| 134 |
+
./local/prepare_data.sh --stage 1 --stop_stage 10 --data ${data} \
|
| 135 |
+
--sre16_unlab_dir ${sre16_unlab_dir} --sre16_evalset_dir ${sre16_evalset_dir} --sre16_evalset_keys ${sre16_evalset_keys} \
|
| 136 |
+
--sre18_devset_dir ${sre18_devset_dir} --sre18_evalset_dir ${sre18_evalset_dir} --sre18_evalset_keys ${sre18_evalset_keys} \
|
| 137 |
+
--sre21_devset_dir ${sre21_devset_dir} --sre21_evalset_dir ${sre21_evalset_dir} --sre21_evalset_keys ${sre21_evalset_keys} \
|
| 138 |
+
--cts_superset_dir ${cts_superset_dir} --voxceleb_dir ${voxceleb_dir}
|
| 139 |
+
fi
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
|
| 143 |
+
|
| 144 |
+
true && {
|
| 145 |
+
echo "Convert train data to ${data_type}..."
|
| 146 |
+
for dset in cts_vox; do
|
| 147 |
+
python tools/make_shard_list.py --num_utts_per_shard 1000 \
|
| 148 |
+
--num_threads 12 \
|
| 149 |
+
--prefix shards \
|
| 150 |
+
--shuffle \
|
| 151 |
+
--vad_file ${data}/$dset/vad \
|
| 152 |
+
${data}/$dset/wav.scp ${data}/$dset/utt2spk \
|
| 153 |
+
${data}/$dset/shards ${data}/$dset/shard.list
|
| 154 |
+
done
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
true && {
|
| 158 |
+
echo "Convert data for PLDA backend training and evaluation to raw format..."
|
| 159 |
+
if [ $aug_plda_data = 0 ];then
|
| 160 |
+
sre_plda_data=cts
|
| 161 |
+
else
|
| 162 |
+
sre_plda_data=cts_aug
|
| 163 |
+
fi
|
| 164 |
+
|
| 165 |
+
# Raw format for backend and evaluation data
|
| 166 |
+
for dset in ${sre_plda_data} sre16/major sre16/eval/enrollment sre16/eval/test \
|
| 167 |
+
sre18/dev/enrollment sre18/dev/test sre18/dev/unlabeled sre18/eval/enrollment sre18/eval/test \
|
| 168 |
+
sre21/dev/enrollment sre21/dev/test sre21/eval/enrollment sre21/eval/test;do
|
| 169 |
+
|
| 170 |
+
# The below requires utt2spk to be present. So create a "dummy" one if we don't have it.
|
| 171 |
+
# This is for example the case with sre21 eval data.
|
| 172 |
+
if [ ! -f $data/$dset/utt2spk ];then
|
| 173 |
+
awk '{print $1 " unk"}' ${data}/${dset}/wav.scp > ${data}/${dset}/utt2spk
|
| 174 |
+
fi
|
| 175 |
+
|
| 176 |
+
python tools/make_raw_list.py --vad_file ${data}/$dset/vad \
|
| 177 |
+
${data}/$dset/wav.scp \
|
| 178 |
+
${data}/$dset/utt2spk ${data}/$dset/raw.list
|
| 179 |
+
done
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
true && {
|
| 183 |
+
# Convert all musan and rirs data to LMDB if they don't already exist.
|
| 184 |
+
for x in rirs musan;do
|
| 185 |
+
if [ ! -d $data/$x/lmdb ];then
|
| 186 |
+
python tools/make_lmdb.py ${data}/$x/wav.scp ${data}/$x/lmdb
|
| 187 |
+
fi
|
| 188 |
+
done
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
fi
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then
|
| 195 |
+
echo "Start training ..."
|
| 196 |
+
if [ ! -z $num_gpus_train ];then
|
| 197 |
+
gpus=$(python -c "from sys import argv; from safe_gpu import safe_gpu; safe_gpu.claim_gpus(int(argv[1])); print( safe_gpu.gpu_owner.devices_taken )" $num_gpus_train | sed "s: ::g")
|
| 198 |
+
else
|
| 199 |
+
num_gpus=$(echo $gpus | awk -F ',' '{print NF}')
|
| 200 |
+
fi
|
| 201 |
+
echo "$0: num_nodes is $num_nodes, proc_per_node is $num_gpus"
|
| 202 |
+
torchrun --nnodes=$num_nodes --nproc_per_node=$num_gpus \
|
| 203 |
+
--rdzv_id=$job_id --rdzv_backend="c10d" --rdzv_endpoint=$HOST_NODE_ADDR \
|
| 204 |
+
wespeaker/bin/train.py --config $config \
|
| 205 |
+
--exp_dir ${exp_dir} \
|
| 206 |
+
--gpus $gpus \
|
| 207 |
+
--num_avg ${num_avg} \
|
| 208 |
+
--data_type "${data_type}" \
|
| 209 |
+
--train_data ${data}/cts_vox/${data_type}.list \
|
| 210 |
+
--train_label ${data}/cts_vox/utt2spk \
|
| 211 |
+
--reverb_data ${data}/rirs/lmdb \
|
| 212 |
+
--noise_data ${data}/musan/lmdb \
|
| 213 |
+
${checkpoint:+--checkpoint $checkpoint}
|
| 214 |
+
fi
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then
|
| 218 |
+
|
| 219 |
+
false && {
|
| 220 |
+
echo "Do model average ..."
|
| 221 |
+
avg_model=$exp_dir/models/avg_model.pt
|
| 222 |
+
python wespeaker/bin/average_model.py \
|
| 223 |
+
--dst_model $avg_model \
|
| 224 |
+
--src_path $exp_dir/models \
|
| 225 |
+
--num ${num_avg}
|
| 226 |
+
|
| 227 |
+
model_path=$avg_model
|
| 228 |
+
if [[ $config == *repvgg*.yaml ]]; then
|
| 229 |
+
echo "convert repvgg model ..."
|
| 230 |
+
python wespeaker/models/convert_repvgg.py \
|
| 231 |
+
--config $exp_dir/config.yaml \
|
| 232 |
+
--load $avg_model \
|
| 233 |
+
--save $exp_dir/models/convert_model.pt
|
| 234 |
+
model_path=$exp_dir/models/convert_model.pt
|
| 235 |
+
fi
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
avg_model=$exp_dir/models/avg_model.pt
|
| 239 |
+
model_path=$avg_model
|
| 240 |
+
|
| 241 |
+
echo "Extract embeddings ..."
|
| 242 |
+
avg_model=$exp_dir/models/avg_model.pt
|
| 243 |
+
model_path=$avg_model
|
| 244 |
+
gpus=$(python -c "from sys import argv; from safe_gpu import safe_gpu; safe_gpu.claim_gpus(int(argv[1])); print( safe_gpu.gpu_owner.devices_taken )" $num_gpus_extract | sed "s: ::g" )
|
| 245 |
+
echo $gpus
|
| 246 |
+
local/extract_sre.sh \
|
| 247 |
+
--exp_dir $exp_dir --model_path $model_path \
|
| 248 |
+
--nj $num_gpus_extract --gpus $gpus --data_type raw --data ${data} \
|
| 249 |
+
--reverb_data ${data}/rirs/lmdb \
|
| 250 |
+
--noise_data ${data}/musan/lmdb \
|
| 251 |
+
--aug_plda_data ${aug_plda_data}
|
| 252 |
+
fi
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then
|
| 256 |
+
echo "Export the final model ..."
|
| 257 |
+
python wespeaker/bin/export_jit.py \
|
| 258 |
+
--config $exp_dir/config.yaml \
|
| 259 |
+
--checkpoint $exp_dir/models/avg_model.pt \
|
| 260 |
+
--output_file $exp_dir/models/final.zip
|
| 261 |
+
fi
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
if [ ${stage} -le 6 ] && [ ${stop_stage} -ge 6 ]; then
|
| 265 |
+
echo "### --- Score using Cosine Distance --- ###"
|
| 266 |
+
|
| 267 |
+
# Use SRE16 unlabeled data for mean subraction
|
| 268 |
+
echo "### --- Mean: SRE16 unlabeled ("SRE16 Major") --- ###"
|
| 269 |
+
true && {
|
| 270 |
+
for dset in sre16_eval;do
|
| 271 |
+
echo " * $dset"
|
| 272 |
+
local/score.sh \
|
| 273 |
+
--stage 1 --stop-stage 2 \
|
| 274 |
+
--trials ${trials[$dset]} \
|
| 275 |
+
--xvectors $exp_dir/embeddings/${xvectors[$dset]} \
|
| 276 |
+
--cal_mean_dir ${exp_dir}/embeddings/sre16/major \
|
| 277 |
+
--exp_dir $exp_dir
|
| 278 |
+
done
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
# Use SRE18 unlabeled data for mean subraction
|
| 282 |
+
echo "### --- Mean: SRE18 Unlabeled --- ###"
|
| 283 |
+
true && {
|
| 284 |
+
for dset in sre18_eval sre18_dev;do
|
| 285 |
+
echo " * $dset"
|
| 286 |
+
local/score.sh \
|
| 287 |
+
--stage 1 --stop-stage 2 \
|
| 288 |
+
--trials ${trials[$dset]} \
|
| 289 |
+
--xvectors $exp_dir/embeddings/${xvectors[$dset]} \
|
| 290 |
+
--cal_mean_dir ${exp_dir}/embeddings/sre18/dev/unlabeled \
|
| 291 |
+
--exp_dir $exp_dir
|
| 292 |
+
done
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
# Use backend training data for mean subraction
|
| 296 |
+
echo "### --- Mean: SRE --- ###"
|
| 297 |
+
true && {
|
| 298 |
+
for dset in sre16_eval sre18_eval sre18_dev sre21_eval sre21_dev;do
|
| 299 |
+
echo " * $dset"
|
| 300 |
+
local/score.sh \
|
| 301 |
+
--stage 1 --stop-stage 2 \
|
| 302 |
+
--trials ${trials[$dset]} \
|
| 303 |
+
--xvectors $exp_dir/embeddings/${xvectors[$dset]} \
|
| 304 |
+
--cal_mean_dir ${exp_dir}/embeddings/cts_aug \
|
| 305 |
+
--exp_dir $exp_dir
|
| 306 |
+
done
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
fi
|
| 310 |
+
|
| 311 |
+
|
| 312 |
+
if [ ${stage} -le 7 ] && [ ${stop_stage} -ge 7 ]; then
|
| 313 |
+
echo "### --- Score with PLDA --- ###"
|
| 314 |
+
echo "### --- Mean: PLDA training set (cts_aug) --- ###"
|
| 315 |
+
|
| 316 |
+
# Here we specify the embedding preprocessing to be used before backend modelling/scoring.
|
| 317 |
+
mean1_scp=${exp_dir}/embeddings/${sre_plda_data}/cts_aug/xvector.scp
|
| 318 |
+
lda_scp=${exp_dir}/embeddings/${sre_plda_data}/cts_aug/xvector.scp
|
| 319 |
+
utt2spk=${data}/cts_aug/utt2spk
|
| 320 |
+
lda_dim=100
|
| 321 |
+
preprocessing_chain="mean-subtract --scp $mean1_scp | length-norm | lda --scp $lda_scp --utt2spk $utt2spk --dim $lda_dim | length-norm"
|
| 322 |
+
preprocessing_path_cts_aug=${exp_dir}/embd_proc_cts_aug.pkl
|
| 323 |
+
|
| 324 |
+
# Run stage 1-6 here to train the embedding preprocessing chain and the PLDA model as well
|
| 325 |
+
# as to evaluate SRE16 which is the default set to evaluate if no eval set is provided.
|
| 326 |
+
true && {
|
| 327 |
+
local/score_plda.sh \
|
| 328 |
+
--stage 1 --stop-stage 6 \
|
| 329 |
+
--data ${data} \
|
| 330 |
+
--exp_dir $exp_dir \
|
| 331 |
+
--aug_plda_data ${aug_plda_data} \
|
| 332 |
+
--preprocessing_chain "$preprocessing_chain" \
|
| 333 |
+
--preprocessing_path "$preprocessing_path_cts_aug"
|
| 334 |
+
}
|
| 335 |
+
# Score the other sets. We need only stage 4-6 for this.
|
| 336 |
+
true && {
|
| 337 |
+
for dset in sre18_eval sre18_dev sre21_eval sre21_dev;do
|
| 338 |
+
local/score_plda.sh \
|
| 339 |
+
--stage 4 --stop-stage 6 \
|
| 340 |
+
--data ${data} \
|
| 341 |
+
--exp_dir $exp_dir \
|
| 342 |
+
--enroll_scp ${enr_scp[$dset]} \
|
| 343 |
+
--test_scp ${test_scp[$dset]} \
|
| 344 |
+
--aug_plda_data ${aug_plda_data} \
|
| 345 |
+
--preprocessing_path "$preprocessing_path" \
|
| 346 |
+
--preprocessing_path "$preprocessing_path_cts_aug" \
|
| 347 |
+
--utt2spk ${utt2mdl[$dset]} \
|
| 348 |
+
--trials ${trials[$dset]}
|
| 349 |
+
done
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
# Score using SRE 16 unlab mean. We should not retrain the backend again, i.e. stage 2-3
|
| 353 |
+
# but we do need to update the embedding preprocessing chain.
|
| 354 |
+
mean1_scp=${exp_dir}/embeddings/sre16/major/xvector.scp
|
| 355 |
+
new_link="mean-subtract --scp $mean1_scp "
|
| 356 |
+
preprocessing_path_sre16_major=${exp_dir}/embd_proc_sre16_major.pkl
|
| 357 |
+
|
| 358 |
+
# The following command replaces link 0 (cts_aug mean subtraction) with a new link (sre16 major mean subtraction)
|
| 359 |
+
python wespeaker/bin/update_embd_proc.py --in_path $preprocessing_path_cts_aug --out_path $preprocessing_path_sre16_major --link_no_to_remove 0 --new_link "$new_link"
|
| 360 |
+
|
| 361 |
+
echo "### --- Mean: SRE16 Major --- ###"
|
| 362 |
+
true && {
|
| 363 |
+
local/score_plda.sh \
|
| 364 |
+
--stage 4 --stop-stage 6 \
|
| 365 |
+
--data ${data} \
|
| 366 |
+
--exp_dir $exp_dir \
|
| 367 |
+
--preprocessing_path "$preprocessing_path_sre16_major"
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
# Similarly for SRE18
|
| 371 |
+
mean1_scp=${exp_dir}/embeddings/sre18/dev/unlabeled/xvector.scp
|
| 372 |
+
new_link="mean-subtract --scp $mean1_scp "
|
| 373 |
+
preprocessing_path_sre18_unlab=${exp_dir}/embd_proc_sre18_dev_unlabeled.pkl
|
| 374 |
+
|
| 375 |
+
python wespeaker/bin/update_embd_proc.py --in_path $preprocessing_path_cts_aug --out_path $preprocessing_path_sre18_unlab --link_no_to_remove 0 --new_link "$new_link"
|
| 376 |
+
|
| 377 |
+
echo "### --- Mean: SRE18 Unlabeled --- ###"
|
| 378 |
+
true && {
|
| 379 |
+
for dset in sre18_eval sre18_dev;do
|
| 380 |
+
local/score_plda.sh \
|
| 381 |
+
--stage 4 --stop-stage 6 \
|
| 382 |
+
--data ${data} \
|
| 383 |
+
--exp_dir $exp_dir \
|
| 384 |
+
--preprocessing_path "$preprocessing_path_sre18_unlab" \
|
| 385 |
+
--enroll_scp ${enr_scp[$dset]} \
|
| 386 |
+
--test_scp ${test_scp[$dset]} \
|
| 387 |
+
--utt2spk ${utt2mdl[$dset]} \
|
| 388 |
+
--trials ${trials[$dset]}
|
| 389 |
+
done
|
| 390 |
+
}
|
| 391 |
+
fi
|
| 392 |
+
|
| 393 |
+
|
| 394 |
+
if [ ${stage} -le 8 ] && [ ${stop_stage} -ge 8 ]; then
|
| 395 |
+
|
| 396 |
+
echo "Score with adapted PLDA ..."
|
| 397 |
+
|
| 398 |
+
# --indomain_scp is by default sre16/major/xvector.scp in local/score_plda_adapt.sh.
|
| 399 |
+
# It is used for adaptation. Note that in other recipes, indomain_scp is passed to
|
| 400 |
+
# wespeaker/bin/eval_plda.py insdide local/score_plda_adapt.sh in which case it will
|
| 401 |
+
# be used for mean subtraction before scoring. In this recipe, mean subtraction is,
|
| 402 |
+
# however, part of the backend preprocessing chain and is therefore not used in
|
| 403 |
+
# wespeaker/bin/eval_plda.py.
|
| 404 |
+
|
| 405 |
+
echo "### --- Mean: SRE16 Major --- ###"
|
| 406 |
+
true && {
|
| 407 |
+
local/score_plda_adapt.sh \
|
| 408 |
+
--stage 1 --stop-stage 4 \
|
| 409 |
+
--data ${data} \
|
| 410 |
+
--exp_dir $exp_dir \
|
| 411 |
+
--preprocessing_path ${exp_dir}/embd_proc_sre16_major.pkl \
|
| 412 |
+
--aug_plda_data ${aug_plda_data}
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
preprocessing_path_sre18_unlab=${exp_dir}/embd_proc_sre18_dev_unlabeled.pkl
|
| 416 |
+
echo "### --- Mean: SRE18 Unlabeled --- ###"
|
| 417 |
+
# Stage 1 is only needed to be run once per domain so we could have set stage 1-4 for
|
| 418 |
+
# sre18_eval and stage 1,3,4 for sre18_dev but since stage 2 is very fast we keep it
|
| 419 |
+
# in order to keep the script clean.
|
| 420 |
+
true && {
|
| 421 |
+
for dset in sre18_eval sre18_dev;do
|
| 422 |
+
|
| 423 |
+
local/score_plda_adapt.sh \
|
| 424 |
+
--stage 1 --stop-stage 4 \
|
| 425 |
+
--data ${data} \
|
| 426 |
+
--exp_dir $exp_dir \
|
| 427 |
+
--aug_plda_data ${aug_plda_data} \
|
| 428 |
+
--enroll_scp ${enr_scp[$dset]} \
|
| 429 |
+
--test_scp ${test_scp[$dset]} \
|
| 430 |
+
--preprocessing_path "$preprocessing_path_sre18_unlab" \
|
| 431 |
+
--indomain_scp sre18/dev/unlabeled/xvector.scp \
|
| 432 |
+
--utt2spk ${utt2mdl[$dset]} \
|
| 433 |
+
--trials ${trials[$dset]}
|
| 434 |
+
done
|
| 435 |
+
}
|
| 436 |
+
fi
|
| 437 |
+
|
| 438 |
+
|
| 439 |
+
if [ ${stage} -le 9 ] && [ ${stop_stage} -ge 9 ]; then
|
| 440 |
+
echo "### --- Score using Cosine Distance --- ###"
|
| 441 |
+
|
| 442 |
+
# The preprocessed embeddings are already stored but we need to create the lists as
|
| 443 |
+
# score.sh wants them. This is a bit messy and therefore kept in a separate script.
|
| 444 |
+
./local/create_preproc_embd_lists.sh $exp_dir
|
| 445 |
+
|
| 446 |
+
# Note that cal_mean_dir should not be provided since the embedding preprocessing includes mean subtration.
|
| 447 |
+
|
| 448 |
+
# Use SRE16 unlabeled data for mean subraction
|
| 449 |
+
echo "### --- Mean: SRE16 unlabeled ("SRE16 Major") --- ###"
|
| 450 |
+
true && {
|
| 451 |
+
preproc_name=embd_proc_sre16_major
|
| 452 |
+
for dset in sre16_eval;do
|
| 453 |
+
# The xvector list for the relevant preprocessing chain.
|
| 454 |
+
new_xvectors=$(echo $exp_dir/embeddings/${xvectors[$dset]} | sed "s:\.scp:_proc_$preproc_name\.scp:")
|
| 455 |
+
echo " * $new_xvectors"
|
| 456 |
+
local/score.sh \
|
| 457 |
+
--stage 1 --stop-stage 2 \
|
| 458 |
+
--trials ${trials[$dset]} \
|
| 459 |
+
--xvectors $new_xvectors \
|
| 460 |
+
--exp_dir $exp_dir
|
| 461 |
+
done
|
| 462 |
+
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
# Use SRE18 unlabeled data for mean subraction
|
| 466 |
+
echo "### --- Mean: SRE18 Unlabeled --- ###"
|
| 467 |
+
true && {
|
| 468 |
+
preproc_name=embd_proc_sre18_dev_unlabeled
|
| 469 |
+
for dset in sre18_eval sre18_dev;do
|
| 470 |
+
new_xvectors=$(echo $exp_dir/embeddings/${xvectors[$dset]} | sed "s:\.scp:_proc_$preproc_name\.scp:")
|
| 471 |
+
echo " * $new_xvectors"
|
| 472 |
+
local/score.sh \
|
| 473 |
+
--stage 1 --stop-stage 2 \
|
| 474 |
+
--trials ${trials[$dset]} \
|
| 475 |
+
--xvectors $new_xvectors \
|
| 476 |
+
--exp_dir $exp_dir
|
| 477 |
+
done
|
| 478 |
+
}
|
| 479 |
+
|
| 480 |
+
# Use backend training data for mean subraction
|
| 481 |
+
echo "### --- Mean: SRE --- ###"
|
| 482 |
+
true && {
|
| 483 |
+
preproc_name=embd_proc_cts_aug
|
| 484 |
+
for dset in sre16_eval sre18_eval sre18_dev sre21_eval sre21_dev;do
|
| 485 |
+
new_xvectors=$(echo $exp_dir/embeddings/${xvectors[$dset]} | sed "s:\.scp:_proc_$preproc_name\.scp:")
|
| 486 |
+
echo " * $new_xvectors"
|
| 487 |
+
local/score.sh \
|
| 488 |
+
--stage 1 --stop-stage 2 \
|
| 489 |
+
--trials ${trials[$dset]} \
|
| 490 |
+
--xvectors $new_xvectors \
|
| 491 |
+
--exp_dir $exp_dir
|
| 492 |
+
done
|
| 493 |
+
}
|
| 494 |
+
|
| 495 |
+
fi
|
| 496 |
+
|
| 497 |
+
|
| 498 |
+
|
| 499 |
+
if [ ${stage} -le 10 ] && [ ${stop_stage} -ge 10 ]; then
|
| 500 |
+
# Summarize results
|
| 501 |
+
echo ""
|
| 502 |
+
echo "----------------------------------------------------"
|
| 503 |
+
echo "### --- Summary of results (EER / minDCF0.01)--- ###"
|
| 504 |
+
echo "----------------------------------------------------"
|
| 505 |
+
# Make the header
|
| 506 |
+
eval_data='system'
|
| 507 |
+
for dset in sre16_eval sre18_dev sre18_eval sre21_dev sre21_eval;do
|
| 508 |
+
for x in $(echo ${trials[$dset]} | tr "," " "); do
|
| 509 |
+
xx=$(basename $x)
|
| 510 |
+
eval_data="$eval_data, $xx "
|
| 511 |
+
done
|
| 512 |
+
done
|
| 513 |
+
echo $eval_data > results_summary.txt
|
| 514 |
+
# Collect the results
|
| 515 |
+
for sys in mean_cts_aug_cos mean_sre16_major_cos mean_sre18_dev_unlabeled_cos \
|
| 516 |
+
proc_embd_proc_cts_aug_cos proc_embd_proc_sre16_major_cos proc_embd_proc_sre18_dev_unlabeled_cos \
|
| 517 |
+
proc_embd_proc_cts_aug_plda proc_embd_proc_sre16_major_plda proc_embd_proc_sre18_dev_unlabeled_plda \
|
| 518 |
+
proc_embd_proc_sre16_major_plda_adapt proc_embd_proc_sre18_dev_unlabeled_plda_adapt;do
|
| 519 |
+
res="$sys,"
|
| 520 |
+
for dset in sre16_eval sre18_dev sre18_eval sre21_dev sre21_eval;do
|
| 521 |
+
for x in $(echo ${trials[$dset]} | tr "," " "); do
|
| 522 |
+
xx=$(basename $x)
|
| 523 |
+
eval_data="$eval_data $xx "
|
| 524 |
+
if [ -e ${exp_dir}/scores/${xx}.${sys}.result ];then
|
| 525 |
+
res="$res $(grep EER ${exp_dir}/scores/${xx}.${sys}.result | sed 's:.* = ::')"
|
| 526 |
+
res="$res / $(grep minDCF ${exp_dir}/scores/${xx}.${sys}.result | sed 's:.* = ::'),"
|
| 527 |
+
else
|
| 528 |
+
res="$res - -,"
|
| 529 |
+
fi
|
| 530 |
+
done
|
| 531 |
+
done
|
| 532 |
+
echo -e $res >> results_summary.txt
|
| 533 |
+
done
|
| 534 |
+
column -t -s"," results_summary.txt
|
| 535 |
+
echo ""
|
| 536 |
+
echo "-------------------------------------------------------"
|
| 537 |
+
echo "### --- CSV for copy-paste to google sheet etc. --- ###"
|
| 538 |
+
echo "-------------------------------------------------------"
|
| 539 |
+
tail -n+2 results_summary.txt | sed "s:/:,:g" | sed "s: :,:g"| sed -r "s:,+:,:g"
|
| 540 |
+
|
| 541 |
+
|
| 542 |
+
fi
|
MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
This is a **WeSpeaker** recipe for the Voxceleb 1&2 dataset. VoxCeleb is an audio-visual dataset consisting of short clips of human speech, extracted from interview videos uploaded to YouTube. See https://www.robots.ox.ac.uk/~vgg/data/voxceleb/ for more detailed information.
|
| 2 |
+
|
| 3 |
+
The following recipes are provided:
|
| 4 |
+
* v1: **Fully-Supervised** train on Voxceleb 1 development set and evaluate on Voxceleb1-O trials.
|
| 5 |
+
|
| 6 |
+
* v2: **Fully-Supervised** train on Voxceleb 2 development set and evaluate on three official trials.
|
| 7 |
+
|
| 8 |
+
* v2_deprecated: Deprecated version of fully-supervised train on Voxceleb dataset (deprecated IO).
|
| 9 |
+
|
| 10 |
+
* v3: **Self-Supervised** train on Voxceleb 2 development set and evaluate on three official trials, including SimCLR, MoCo and DINO.
|
MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Results
|
| 2 |
+
|
| 3 |
+
* Setup: mel80, num_frms500, epoch8, ArcMargin, aug_prob0.6, speed_perturb (no spec_aug)
|
| 4 |
+
|
| 5 |
+
* Scoring: cosine (sub mean of vox1_dev), AS-Norm
|
| 6 |
+
|
| 7 |
+
* Metric: EER(%)
|
| 8 |
+
|
| 9 |
+
* 🔥 UPDATE 2024.08: We support Whisper based speaker verification framework Whisper-PMFA. Related papers:
|
| 10 |
+
|
| 11 |
+
* [Whisper-PMFA: Partial Multi-Scale Feature Aggregation for Speaker Verification using Whisper Models ](https://arxiv.org/pdf/2408.15585)
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
| Model | AS-Norm | Params | vox1-O-clean |
|
| 16 |
+
| :----------------------------------- | ------- | ------ | :----------: |
|
| 17 |
+
| ECAPA_TDNN_GLOB_c512-ASTP-emb192 | × | 6.19M | 2.23 |
|
| 18 |
+
| | √ | 6.19M | 2.00 |
|
| 19 |
+
| ResNet34-TSTP-emb256 | × | 6.63M | 1.99 |
|
| 20 |
+
| | √ | 6.63M | 1.88 |
|
| 21 |
+
| Whisper-PMFA | × | 478.7M | 1.62 |
|
| 22 |
+
| | √ | 478.7M | **1.42** |
|
| 23 |
+
| Whisper-PMFA with LoRA (Coming soon) | √ | 10.9M | 1.62 |
|
| 24 |
+
|
MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/conf/whisper_PMFA_stage0.yaml
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### train configuraton
|
| 2 |
+
|
| 3 |
+
exp_dir: exp/Whisper_PMFA_large_v2_voxceleb1_mel_5s
|
| 4 |
+
gpus: "[0,1]"
|
| 5 |
+
num_avg: 1
|
| 6 |
+
enable_amp: False # whether enable automatic mixed precision training
|
| 7 |
+
|
| 8 |
+
seed: 42
|
| 9 |
+
num_epochs: 4
|
| 10 |
+
save_epoch_interval: 1 # save model every 5 epochs
|
| 11 |
+
log_batch_interval: 100 # log every 100 batchs
|
| 12 |
+
|
| 13 |
+
dataloader_args:
|
| 14 |
+
batch_size: 70
|
| 15 |
+
num_workers: 12
|
| 16 |
+
pin_memory: False
|
| 17 |
+
prefetch_factor: 8
|
| 18 |
+
drop_last: True
|
| 19 |
+
|
| 20 |
+
dataset_args:
|
| 21 |
+
shuffle: True
|
| 22 |
+
shuffle_args:
|
| 23 |
+
shuffle_size: 2500
|
| 24 |
+
resample_rate: 16000
|
| 25 |
+
speed_perturb: True
|
| 26 |
+
num_frms: 500
|
| 27 |
+
aug_prob: 0.6 # prob to add reverb & noise aug per sample
|
| 28 |
+
frontend: whisper_encoder
|
| 29 |
+
whisper_encoder_args:
|
| 30 |
+
frozen: True
|
| 31 |
+
n_mels: 80
|
| 32 |
+
num_blocks: 24
|
| 33 |
+
output_size: 1280
|
| 34 |
+
n_head: 20
|
| 35 |
+
layer_st: 16
|
| 36 |
+
layer_ed: 23
|
| 37 |
+
model_path: whisper_hub/large-v2.pt
|
| 38 |
+
spec_aug: False
|
| 39 |
+
spec_aug_args:
|
| 40 |
+
num_t_mask: 1
|
| 41 |
+
num_f_mask: 1
|
| 42 |
+
max_t: 10
|
| 43 |
+
max_f: 8
|
| 44 |
+
prob: 0.6
|
| 45 |
+
|
| 46 |
+
model: Whisper_PMFA_large_v2
|
| 47 |
+
model_init: null
|
| 48 |
+
model_args:
|
| 49 |
+
embed_dim: 192
|
| 50 |
+
projection_args:
|
| 51 |
+
project_type: "arc_margin" # add_margin, arc_margin, sphere, softmax
|
| 52 |
+
scale: 32.0
|
| 53 |
+
easy_margin: False
|
| 54 |
+
|
| 55 |
+
margin_scheduler: MarginScheduler
|
| 56 |
+
margin_update:
|
| 57 |
+
initial_margin: 0.2
|
| 58 |
+
final_margin: 0.2
|
| 59 |
+
increase_start_epoch: 0
|
| 60 |
+
fix_start_epoch: 4
|
| 61 |
+
update_margin: True
|
| 62 |
+
increase_type: "exp" # exp, linear
|
| 63 |
+
|
| 64 |
+
loss: CrossEntropyLoss
|
| 65 |
+
loss_args: {}
|
| 66 |
+
|
| 67 |
+
optimizer: SGD
|
| 68 |
+
optimizer_args:
|
| 69 |
+
momentum: 0.9
|
| 70 |
+
nesterov: True
|
| 71 |
+
weight_decay: 0.0001
|
| 72 |
+
|
| 73 |
+
scheduler: ExponentialDecrease
|
| 74 |
+
scheduler_args:
|
| 75 |
+
initial_lr: 0.0025
|
| 76 |
+
final_lr: 0.00113
|
| 77 |
+
warm_up_epoch: 0
|
| 78 |
+
warm_from_zero: False
|
MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/conf/whisper_PMFA_stage1.yaml
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### train configuraton
|
| 2 |
+
|
| 3 |
+
exp_dir: exp/Whisper_PMFA_large_v2_voxceleb1_mel_5s
|
| 4 |
+
gpus: "[0,1]"
|
| 5 |
+
num_avg: 1
|
| 6 |
+
enable_amp: False # whether enable automatic mixed precision training
|
| 7 |
+
|
| 8 |
+
seed: 42
|
| 9 |
+
num_epochs: 8
|
| 10 |
+
save_epoch_interval: 1 # save model every 5 epochs
|
| 11 |
+
log_batch_interval: 100 # log every 100 batchs
|
| 12 |
+
|
| 13 |
+
dataloader_args:
|
| 14 |
+
batch_size: 15
|
| 15 |
+
num_workers: 12
|
| 16 |
+
pin_memory: False
|
| 17 |
+
prefetch_factor: 8
|
| 18 |
+
drop_last: True
|
| 19 |
+
|
| 20 |
+
dataset_args:
|
| 21 |
+
shuffle: True
|
| 22 |
+
shuffle_args:
|
| 23 |
+
shuffle_size: 2500
|
| 24 |
+
resample_rate: 16000
|
| 25 |
+
speed_perturb: True
|
| 26 |
+
num_frms: 500
|
| 27 |
+
aug_prob: 0.6 # prob to add reverb & noise aug per sample
|
| 28 |
+
frontend: whisper_encoder
|
| 29 |
+
whisper_encoder_args:
|
| 30 |
+
frozen: False
|
| 31 |
+
n_mels: 80
|
| 32 |
+
num_blocks: 24
|
| 33 |
+
output_size: 1280
|
| 34 |
+
n_head: 20
|
| 35 |
+
layer_st: 16
|
| 36 |
+
layer_ed: 23
|
| 37 |
+
spec_aug: False
|
| 38 |
+
spec_aug_args:
|
| 39 |
+
num_t_mask: 1
|
| 40 |
+
num_f_mask: 1
|
| 41 |
+
max_t: 10
|
| 42 |
+
max_f: 8
|
| 43 |
+
prob: 0.6
|
| 44 |
+
|
| 45 |
+
model: Whisper_PMFA_large_v2
|
| 46 |
+
model_init: null
|
| 47 |
+
model_args:
|
| 48 |
+
embed_dim: 192
|
| 49 |
+
projection_args:
|
| 50 |
+
project_type: "arc_margin" # add_margin, arc_margin, sphere, softmax
|
| 51 |
+
scale: 32.0
|
| 52 |
+
easy_margin: False
|
| 53 |
+
|
| 54 |
+
margin_scheduler: MarginScheduler
|
| 55 |
+
margin_update:
|
| 56 |
+
initial_margin: 0.2
|
| 57 |
+
final_margin: 0.2
|
| 58 |
+
increase_start_epoch: 0
|
| 59 |
+
fix_start_epoch: 8
|
| 60 |
+
update_margin: True
|
| 61 |
+
increase_type: "exp" # exp, linear
|
| 62 |
+
|
| 63 |
+
loss: CrossEntropyLoss
|
| 64 |
+
loss_args: {}
|
| 65 |
+
|
| 66 |
+
optimizer: SGD
|
| 67 |
+
optimizer_args:
|
| 68 |
+
momentum: 0.9
|
| 69 |
+
nesterov: True
|
| 70 |
+
weight_decay: 0.0001
|
| 71 |
+
|
| 72 |
+
scheduler: ExponentialDecrease
|
| 73 |
+
scheduler_args:
|
| 74 |
+
initial_lr: 0.0025
|
| 75 |
+
final_lr: 0.00073
|
| 76 |
+
warm_up_epoch: 0
|
| 77 |
+
warm_from_zero: False
|
MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/local/download_data.sh
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2022 Hongji Wang (jijijiang77@gmail.com)
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
|
| 17 |
+
download_dir=data/download_data
|
| 18 |
+
|
| 19 |
+
. tools/parse_options.sh || exit 1
|
| 20 |
+
|
| 21 |
+
[ ! -d ${download_dir} ] && mkdir -p ${download_dir}
|
| 22 |
+
|
| 23 |
+
if [ ! -f ${download_dir}/musan.tar.gz ]; then
|
| 24 |
+
echo "Downloading musan.tar.gz ..."
|
| 25 |
+
wget --no-check-certificate https://openslr.elda.org/resources/17/musan.tar.gz -P ${download_dir}
|
| 26 |
+
md5=$(md5sum ${download_dir}/musan.tar.gz | awk '{print $1}')
|
| 27 |
+
[ $md5 != "0c472d4fc0c5141eca47ad1ffeb2a7df" ] && echo "Wrong md5sum of musan.tar.gz" && exit 1
|
| 28 |
+
fi
|
| 29 |
+
|
| 30 |
+
if [ ! -f ${download_dir}/rirs_noises.zip ]; then
|
| 31 |
+
echo "Downloading rirs_noises.zip ..."
|
| 32 |
+
wget --no-check-certificate https://us.openslr.org/resources/28/rirs_noises.zip -P ${download_dir}
|
| 33 |
+
md5=$(md5sum ${download_dir}/rirs_noises.zip | awk '{print $1}')
|
| 34 |
+
[ $md5 != "e6f48e257286e05de56413b4779d8ffb" ] && echo "Wrong md5sum of rirs_noises.zip" && exit 1
|
| 35 |
+
fi
|
| 36 |
+
|
| 37 |
+
if [ ! -f ${download_dir}/vox1_test_wav.zip ]; then
|
| 38 |
+
echo "Downloading vox1_test_wav.zip ..."
|
| 39 |
+
wget --no-check-certificate https://thor.robots.ox.ac.uk/~vgg/data/voxceleb/vox1a/vox1_test_wav.zip -P ${download_dir}
|
| 40 |
+
md5=$(md5sum ${download_dir}/vox1_test_wav.zip | awk '{print $1}')
|
| 41 |
+
[ $md5 != "185fdc63c3c739954633d50379a3d102" ] && echo "Wrong md5sum of vox1_test_wav.zip" && exit 1
|
| 42 |
+
fi
|
| 43 |
+
|
| 44 |
+
if [ ! -f ${download_dir}/vox1_dev_wav.zip ]; then
|
| 45 |
+
echo "Downloading vox1_dev_wav.zip ..."
|
| 46 |
+
for part in a b c d; do
|
| 47 |
+
wget --no-check-certificate https://thor.robots.ox.ac.uk/~vgg/data/voxceleb/vox1a/vox1_dev_wav_parta${part} -P ${download_dir} &
|
| 48 |
+
done
|
| 49 |
+
wait
|
| 50 |
+
cat ${download_dir}/vox1_dev* >${download_dir}/vox1_dev_wav.zip
|
| 51 |
+
md5=$(md5sum ${download_dir}/vox1_dev_wav.zip | awk '{print $1}')
|
| 52 |
+
[ $md5 != "ae63e55b951748cc486645f532ba230b" ] && echo "Wrong md5sum of vox1_dev_wav.zip" && exit 1
|
| 53 |
+
fi
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
echo "Download success !!!"
|
MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/local/download_whisper.sh
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
download_dir=data/whisper_pretrained_model
|
| 2 |
+
|
| 3 |
+
. tools/parse_options.sh || exit 1
|
| 4 |
+
|
| 5 |
+
[ ! -d ${download_dir} ] && mkdir -p ${download_dir}
|
| 6 |
+
|
| 7 |
+
if [ ! -f ${download_dir}/large-v2.pt ]; then
|
| 8 |
+
echo "Downloading large-v2.pt ..."
|
| 9 |
+
wget --no-check-certificate https://openaipublic.azureedge.net/main/whisper/models/81f7c96c852ee8fc832187b0132e569d6c3065a3252ed18e56effd0b6a73e524/large-v2.pt -P ${download_dir}
|
| 10 |
+
md5=$(md5sum ${download_dir}/large-v2.pt | awk '{print $1}')
|
| 11 |
+
[ $md5 != "668764447eeda98eeba5ef7bfcb4cc3d" ] && echo "Wrong md5sum of musan.tar.gz" && exit 1
|
| 12 |
+
fi
|
| 13 |
+
|
MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/local/extract_vox.sh
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2022 Hongji Wang (jijijiang77@gmail.com)
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
|
| 17 |
+
exp_dir=''
|
| 18 |
+
model_path=''
|
| 19 |
+
nj=4
|
| 20 |
+
gpus="[0,1]"
|
| 21 |
+
data_type="shard" # shard/raw/feat
|
| 22 |
+
data=data
|
| 23 |
+
|
| 24 |
+
. tools/parse_options.sh
|
| 25 |
+
set -e
|
| 26 |
+
|
| 27 |
+
data_name_array=("vox1_dev" "vox1_test")
|
| 28 |
+
data_list_path_array=("${data}/vox1_dev/${data_type}.list" "${data}/vox1_test/${data_type}.list")
|
| 29 |
+
data_scp_path_array=("${data}/vox1_dev/wav.scp" "${data}/vox1_test/wav.scp") # to count the number of wavs
|
| 30 |
+
nj_array=($nj $nj)
|
| 31 |
+
batch_size_array=(16 1) # batch_size of test set must be 1 !!!
|
| 32 |
+
num_workers_array=(4 1)
|
| 33 |
+
count=${#data_name_array[@]}
|
| 34 |
+
|
| 35 |
+
for i in $(seq 0 $(($count - 1))); do
|
| 36 |
+
wavs_num=$(wc -l ${data_scp_path_array[$i]} | awk '{print $1}')
|
| 37 |
+
bash tools/extract_embedding.sh --exp_dir ${exp_dir} \
|
| 38 |
+
--model_path $model_path \
|
| 39 |
+
--data_type ${data_type} \
|
| 40 |
+
--data_list ${data_list_path_array[$i]} \
|
| 41 |
+
--wavs_num ${wavs_num} \
|
| 42 |
+
--store_dir ${data_name_array[$i]} \
|
| 43 |
+
--batch_size ${batch_size_array[$i]} \
|
| 44 |
+
--num_workers ${num_workers_array[$i]} \
|
| 45 |
+
--nj ${nj_array[$i]} \
|
| 46 |
+
--gpus $gpus &
|
| 47 |
+
done
|
| 48 |
+
|
| 49 |
+
wait
|
| 50 |
+
|
| 51 |
+
echo "Embedding dir is (${exp_dir}/embeddings)."
|
MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/local/prepare_data.sh
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2022 Hongji Wang (jijijiang77@gmail.com)
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
|
| 17 |
+
stage=-1
|
| 18 |
+
stop_stage=-1
|
| 19 |
+
data=data
|
| 20 |
+
|
| 21 |
+
. tools/parse_options.sh || exit 1
|
| 22 |
+
|
| 23 |
+
data=`realpath ${data}`
|
| 24 |
+
download_dir=${data}/download_data
|
| 25 |
+
rawdata_dir=${data}/raw_data
|
| 26 |
+
|
| 27 |
+
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
| 28 |
+
echo "Download musan.tar.gz, rirs_noises.zip, vox1_test_wav.zip, and vox1_dev_wav.zip."
|
| 29 |
+
echo "This may take a long time. Thus we recommand you to download all archives above in your own way first."
|
| 30 |
+
|
| 31 |
+
./local/download_data.sh --download_dir ${download_dir}
|
| 32 |
+
fi
|
| 33 |
+
|
| 34 |
+
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
|
| 35 |
+
echo "Decompress all archives ..."
|
| 36 |
+
echo "This could take some time ..."
|
| 37 |
+
|
| 38 |
+
for archive in musan.tar.gz rirs_noises.zip vox1_test_wav.zip vox1_dev_wav.zip; do
|
| 39 |
+
[ ! -f ${download_dir}/$archive ] && echo "Archive $archive not exists !!!" && exit 1
|
| 40 |
+
done
|
| 41 |
+
[ ! -d ${rawdata_dir} ] && mkdir -p ${rawdata_dir}
|
| 42 |
+
|
| 43 |
+
if [ ! -d ${rawdata_dir}/musan ]; then
|
| 44 |
+
tar -xzvf ${download_dir}/musan.tar.gz -C ${rawdata_dir}
|
| 45 |
+
fi
|
| 46 |
+
|
| 47 |
+
if [ ! -d ${rawdata_dir}/RIRS_NOISES ]; then
|
| 48 |
+
unzip ${download_dir}/rirs_noises.zip -d ${rawdata_dir}
|
| 49 |
+
fi
|
| 50 |
+
|
| 51 |
+
if [ ! -d ${rawdata_dir}/voxceleb1 ]; then
|
| 52 |
+
mkdir -p ${rawdata_dir}/voxceleb1/test ${rawdata_dir}/voxceleb1/dev
|
| 53 |
+
unzip ${download_dir}/vox1_test_wav.zip -d ${rawdata_dir}/voxceleb1/test
|
| 54 |
+
unzip ${download_dir}/vox1_dev_wav.zip -d ${rawdata_dir}/voxceleb1/dev
|
| 55 |
+
fi
|
| 56 |
+
|
| 57 |
+
echo "Decompress success !!!"
|
| 58 |
+
fi
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then
|
| 62 |
+
echo "Prepare wav.scp for each dataset ..."
|
| 63 |
+
export LC_ALL=C # kaldi config
|
| 64 |
+
|
| 65 |
+
mkdir -p ${data}/musan ${data}/rirs ${data}/vox1_dev ${data}/vox1_test
|
| 66 |
+
# musan
|
| 67 |
+
find ${rawdata_dir}/musan -name "*.wav" | awk -F"/" '{print $(NF-2)"/"$(NF-1)"/"$NF,$0}' >${data}/musan/wav.scp
|
| 68 |
+
# rirs
|
| 69 |
+
find ${rawdata_dir}/RIRS_NOISES/simulated_rirs -name "*.wav" | awk -F"/" '{print $(NF-2)"/"$(NF-1)"/"$NF,$0}' >${data}/rirs/wav.scp
|
| 70 |
+
# vox1 dev
|
| 71 |
+
find ${rawdata_dir}/voxceleb1/dev -name "*.wav" | awk -F"/" '{print $(NF-2)"/"$(NF-1)"/"$NF,$0}' | sort >${data}/vox1_dev/wav.scp
|
| 72 |
+
awk '{print $1}' ${data}/vox1_dev/wav.scp | awk -F "/" '{print $0,$1}' >${data}/vox1_dev/utt2spk
|
| 73 |
+
./tools/utt2spk_to_spk2utt.pl ${data}/vox1_dev/utt2spk >${data}/vox1_dev/spk2utt
|
| 74 |
+
# vox1 test
|
| 75 |
+
find ${rawdata_dir}/voxceleb1/test -name "*.wav" | awk -F"/" '{print $(NF-2)"/"$(NF-1)"/"$NF,$0}' | sort >${data}/vox1_test/wav.scp
|
| 76 |
+
awk '{print $1}' ${data}/vox1_test/wav.scp | awk -F "/" '{print $0,$1}' >${data}/vox1_test/utt2spk
|
| 77 |
+
./tools/utt2spk_to_spk2utt.pl ${data}/vox1_test/utt2spk >${data}/vox1_test/spk2utt
|
| 78 |
+
|
| 79 |
+
if [ ! -d ${data}/vox1_test/trials ]; then
|
| 80 |
+
echo "Download trials for vox1_test ..."
|
| 81 |
+
mkdir -p ${data}/vox1_test/trials
|
| 82 |
+
#wget --no-check-certificate https://www.robots.ox.ac.uk/~vgg/data/voxceleb/meta/veri_test.txt -O ${data}/vox1_test/trials/vox1-O.txt
|
| 83 |
+
wget --no-check-certificate https://www.robots.ox.ac.uk/~vgg/data/voxceleb/meta/veri_test2.txt -O ${data}/vox1_test/trials/vox1-O\(cleaned\).txt
|
| 84 |
+
# transform them into kaldi trial format
|
| 85 |
+
awk '{if($1==0)label="nontarget";else{label="target"}; print $2,$3,label}' ${data}/vox1_test/trials/vox1-O\(cleaned\).txt >${data}/vox1_test/trials/vox1_O_cleaned.kaldi
|
| 86 |
+
fi
|
| 87 |
+
|
| 88 |
+
echo "Success !!!"
|
| 89 |
+
fi
|
MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/local/score.sh
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2022 Chengdong Liang (liangchengdong@mail.nwpu.edu.cn)
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
|
| 17 |
+
exp_dir=
|
| 18 |
+
trials="vox1_O_cleaned.kaldi vox1_E_cleaned.kaldi vox1_H_cleaned.kaldi"
|
| 19 |
+
data=data
|
| 20 |
+
|
| 21 |
+
stage=-1
|
| 22 |
+
stop_stage=-1
|
| 23 |
+
|
| 24 |
+
. tools/parse_options.sh
|
| 25 |
+
. path.sh
|
| 26 |
+
|
| 27 |
+
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
| 28 |
+
echo "apply cosine scoring ..."
|
| 29 |
+
mkdir -p ${exp_dir}/scores
|
| 30 |
+
trials_dir=${data}/vox1_test/trials
|
| 31 |
+
for x in $trials; do
|
| 32 |
+
echo $x
|
| 33 |
+
python wespeaker/bin/score.py \
|
| 34 |
+
--exp_dir ${exp_dir} \
|
| 35 |
+
--eval_scp_path ${exp_dir}/embeddings/vox1_test/xvector.scp \
|
| 36 |
+
--cal_mean True \
|
| 37 |
+
--cal_mean_dir ${exp_dir}/embeddings/vox1_dev \
|
| 38 |
+
${trials_dir}/${x}
|
| 39 |
+
done
|
| 40 |
+
fi
|
| 41 |
+
|
| 42 |
+
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
|
| 43 |
+
echo "compute metrics (EER/minDCF) ..."
|
| 44 |
+
scores_dir=${exp_dir}/scores
|
| 45 |
+
for x in $trials; do
|
| 46 |
+
python wespeaker/bin/compute_metrics.py \
|
| 47 |
+
--p_target 0.05 \
|
| 48 |
+
--c_fa 1 \
|
| 49 |
+
--c_miss 1 \
|
| 50 |
+
${scores_dir}/${x}.score \
|
| 51 |
+
2>&1 | tee -a ${scores_dir}/vox1_cos_result
|
| 52 |
+
|
| 53 |
+
echo "compute DET curve ..."
|
| 54 |
+
python wespeaker/bin/compute_det.py \
|
| 55 |
+
${scores_dir}/${x}.score
|
| 56 |
+
done
|
| 57 |
+
fi
|
MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/local/score_norm.sh
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright (c) 2022 Chengdong Liang (liangchengdong@mail.nwpu.edu.cn)
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
|
| 17 |
+
score_norm_method="asnorm" # asnorm/snorm
|
| 18 |
+
cohort_set=vox2_dev
|
| 19 |
+
top_n=100
|
| 20 |
+
exp_dir=
|
| 21 |
+
trials="vox1_O_cleaned.kaldi vox1_E_cleaned.kaldi vox1_H_cleaned.kaldi"
|
| 22 |
+
data=data
|
| 23 |
+
|
| 24 |
+
stage=-1
|
| 25 |
+
stop_stage=-1
|
| 26 |
+
|
| 27 |
+
. tools/parse_options.sh
|
| 28 |
+
. path.sh
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
if [ $stage -le 1 ] && [ $stop_stage -ge 1 ]; then
|
| 32 |
+
echo "compute mean xvector"
|
| 33 |
+
python tools/vector_mean.py \
|
| 34 |
+
--spk2utt ${data}/${cohort_set}/spk2utt \
|
| 35 |
+
--xvector_scp $exp_dir/embeddings/${cohort_set}/xvector.scp \
|
| 36 |
+
--spk_xvector_ark $exp_dir/embeddings/${cohort_set}/spk_xvector.ark
|
| 37 |
+
fi
|
| 38 |
+
|
| 39 |
+
output_name=${cohort_set}_${score_norm_method}
|
| 40 |
+
[ "${score_norm_method}" == "asnorm" ] && output_name=${output_name}${top_n}
|
| 41 |
+
if [ $stage -le 2 ] && [ $stop_stage -ge 2 ]; then
|
| 42 |
+
echo "compute norm score"
|
| 43 |
+
for x in $trials; do
|
| 44 |
+
python wespeaker/bin/score_norm.py \
|
| 45 |
+
--score_norm_method $score_norm_method \
|
| 46 |
+
--top_n $top_n \
|
| 47 |
+
--trial_score_file $exp_dir/scores/${x}.score \
|
| 48 |
+
--score_norm_file $exp_dir/scores/${output_name}_${x}.score \
|
| 49 |
+
--cohort_emb_scp ${exp_dir}/embeddings/${cohort_set}/spk_xvector.scp \
|
| 50 |
+
--eval_emb_scp ${exp_dir}/embeddings/vox1_test/xvector.scp \
|
| 51 |
+
--mean_vec_path ${exp_dir}/embeddings/vox1_dev/mean_vec.npy
|
| 52 |
+
done
|
| 53 |
+
fi
|
| 54 |
+
|
| 55 |
+
if [ $stage -le 3 ] && [ $stop_stage -ge 3 ]; then
|
| 56 |
+
echo "compute metrics"
|
| 57 |
+
for x in ${trials}; do
|
| 58 |
+
scores_dir=${exp_dir}/scores
|
| 59 |
+
python wespeaker/bin/compute_metrics.py \
|
| 60 |
+
--p_target 0.05 \
|
| 61 |
+
--c_fa 1 \
|
| 62 |
+
--c_miss 1 \
|
| 63 |
+
${scores_dir}/${output_name}_${x}.score \
|
| 64 |
+
2>&1 | tee -a ${scores_dir}/vox1_${score_norm_method}${top_n}_result
|
| 65 |
+
|
| 66 |
+
python wespeaker/bin/compute_det.py \
|
| 67 |
+
${scores_dir}/${output_name}_${x}.score
|
| 68 |
+
done
|
| 69 |
+
fi
|
MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/path.sh
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export PATH=$PWD:$PATH
|
| 2 |
+
|
| 3 |
+
# NOTE(kan-bayashi): Use UTF-8 in Python to avoid UnicodeDecodeError when LC_ALL=C
|
| 4 |
+
export PYTHONIOENCODING=UTF-8
|
| 5 |
+
export PYTHONPATH=../../../:$PWD:$PYTHONPATH
|
MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v1/Whisper-PMFA/run.sh
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright 2024 Yiyang Zhao (zhaoyy22@mails.tsinghua.edu.cn)
|
| 4 |
+
# 2024 Hongji Wang (jijijiang77@gmail.com)
|
| 5 |
+
|
| 6 |
+
. ./path.sh || exit 1
|
| 7 |
+
|
| 8 |
+
stage=-1
|
| 9 |
+
stop_stage=-1
|
| 10 |
+
|
| 11 |
+
HOST_NODE_ADDR="localhost:29400"
|
| 12 |
+
num_nodes=1
|
| 13 |
+
job_id=2024
|
| 14 |
+
|
| 15 |
+
data=data
|
| 16 |
+
data_type="raw" # shard/raw
|
| 17 |
+
model=whisper_PMFA_large_v2
|
| 18 |
+
|
| 19 |
+
exp_dir=exp/Whisper_PMFA_large_v2_voxceleb1_mel_5s
|
| 20 |
+
gpus="[0,1]"
|
| 21 |
+
num_avg=1
|
| 22 |
+
checkpoint=
|
| 23 |
+
|
| 24 |
+
trials="vox1_O_cleaned.kaldi"
|
| 25 |
+
|
| 26 |
+
score_norm_method="asnorm" # asnorm/snorm
|
| 27 |
+
top_n=300
|
| 28 |
+
|
| 29 |
+
. tools/parse_options.sh || exit 1
|
| 30 |
+
if ! pip show openai-whisper > /dev/null 2>&1; then
|
| 31 |
+
pip install openai-whisper==20231117
|
| 32 |
+
fi
|
| 33 |
+
|
| 34 |
+
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
| 35 |
+
echo "Preparing datasets ..."
|
| 36 |
+
./local/prepare_data.sh --stage 1 --stop_stage 3 --data ${data}
|
| 37 |
+
fi
|
| 38 |
+
|
| 39 |
+
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
|
| 40 |
+
echo "Covert train and test data to ${data_type}..."
|
| 41 |
+
for dset in vox1_dev vox1_test; do
|
| 42 |
+
if [ $data_type == "shard" ]; then
|
| 43 |
+
python tools/make_shard_list.py --num_utts_per_shard 1000 \
|
| 44 |
+
--num_threads 16 \
|
| 45 |
+
--prefix shards \
|
| 46 |
+
--shuffle \
|
| 47 |
+
${data}/$dset/wav.scp ${data}/$dset/utt2spk \
|
| 48 |
+
${data}/$dset/shards ${data}/$dset/shard.list
|
| 49 |
+
else
|
| 50 |
+
python tools/make_raw_list.py ${data}/$dset/wav.scp \
|
| 51 |
+
${data}/$dset/utt2spk ${data}/$dset/raw.list
|
| 52 |
+
fi
|
| 53 |
+
done
|
| 54 |
+
# Convert all musan data to LMDB
|
| 55 |
+
python tools/make_lmdb.py ${data}/musan/wav.scp ${data}/musan/lmdb
|
| 56 |
+
# Convert all rirs data to LMDB
|
| 57 |
+
python tools/make_lmdb.py ${data}/rirs/wav.scp ${data}/rirs/lmdb
|
| 58 |
+
fi
|
| 59 |
+
|
| 60 |
+
if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then
|
| 61 |
+
echo "Start training with frozen whisper parameter..."
|
| 62 |
+
config=conf/whisper_PMFA_stage0.yaml
|
| 63 |
+
num_gpus=$(echo $gpus | awk -F ',' '{print NF}')
|
| 64 |
+
echo "$0: num_nodes is $num_nodes, proc_per_node is $num_gpus"
|
| 65 |
+
torchrun --nnodes=$num_nodes --nproc_per_node=$num_gpus \
|
| 66 |
+
--rdzv_id=$job_id --rdzv_backend="c10d" --rdzv_endpoint=$HOST_NODE_ADDR \
|
| 67 |
+
wespeaker/bin/train.py --config $config \
|
| 68 |
+
--exp_dir ${exp_dir} \
|
| 69 |
+
--gpus $gpus \
|
| 70 |
+
--num_avg ${num_avg} \
|
| 71 |
+
--data_type "${data_type}" \
|
| 72 |
+
--train_data ${data}/vox1_dev/${data_type}.list \
|
| 73 |
+
--train_label ${data}/vox1_dev/utt2spk \
|
| 74 |
+
--reverb_data ${data}/rirs/lmdb \
|
| 75 |
+
--noise_data ${data}/musan/lmdb \
|
| 76 |
+
--model ${model}
|
| 77 |
+
fi
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then
|
| 81 |
+
echo "Start training with all parameter..."
|
| 82 |
+
|
| 83 |
+
if [ -f ${exp_dir}/"config.yaml" ]; then
|
| 84 |
+
mv ${exp_dir}/"config.yaml" ${exp_dir}/"config_stage0.yaml"
|
| 85 |
+
fi
|
| 86 |
+
if [ -f ${exp_dir}/models/"final_model.pt" ]; then
|
| 87 |
+
mv ${exp_dir}/models/"final_model.pt" ${exp_dir}/models/"final_model_stage0.pt"
|
| 88 |
+
fi
|
| 89 |
+
|
| 90 |
+
config=conf/whisper_PMFA_stage1.yaml
|
| 91 |
+
num_gpus=$(echo $gpus | awk -F ',' '{print NF}')
|
| 92 |
+
checkpoint=${exp_dir}/models/model_4.pt
|
| 93 |
+
echo "$0: num_nodes is $num_nodes, proc_per_node is $num_gpus"
|
| 94 |
+
torchrun --nnodes=$num_nodes --nproc_per_node=$num_gpus \
|
| 95 |
+
--rdzv_id=$job_id --rdzv_backend="c10d" --rdzv_endpoint=$HOST_NODE_ADDR \
|
| 96 |
+
wespeaker/bin/train.py --config $config \
|
| 97 |
+
--exp_dir ${exp_dir} \
|
| 98 |
+
--gpus $gpus \
|
| 99 |
+
--num_avg ${num_avg} \
|
| 100 |
+
--data_type "${data_type}" \
|
| 101 |
+
--train_data ${data}/vox1_dev/${data_type}.list \
|
| 102 |
+
--train_label ${data}/vox1_dev/utt2spk \
|
| 103 |
+
--reverb_data ${data}/rirs/lmdb \
|
| 104 |
+
--noise_data ${data}/musan/lmdb \
|
| 105 |
+
--model ${model} \
|
| 106 |
+
--checkpoint ${checkpoint}
|
| 107 |
+
fi
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then
|
| 111 |
+
model_path=$exp_dir/models/final_model.pt
|
| 112 |
+
echo "Extract embeddings ..."
|
| 113 |
+
local/extract_vox.sh \
|
| 114 |
+
--exp_dir $exp_dir --model_path $model_path \
|
| 115 |
+
--nj 2 --gpus $gpus --data_type raw --data ${data}
|
| 116 |
+
fi
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
if [ ${stage} -le 6 ] && [ ${stop_stage} -ge 6 ]; then
|
| 120 |
+
echo "Score ..."
|
| 121 |
+
local/score.sh \
|
| 122 |
+
--stage 1 --stop-stage 2 \
|
| 123 |
+
--exp_dir $exp_dir \
|
| 124 |
+
--data ${data} \
|
| 125 |
+
--trials "$trials"
|
| 126 |
+
fi
|
| 127 |
+
|
| 128 |
+
if [ ${stage} -le 7 ] && [ ${stop_stage} -ge 7 ]; then
|
| 129 |
+
echo "Score norm ..."
|
| 130 |
+
local/score_norm.sh \
|
| 131 |
+
--stage 1 --stop-stage 3 \
|
| 132 |
+
--score_norm_method $score_norm_method \
|
| 133 |
+
--cohort_set vox1_dev \
|
| 134 |
+
--top_n $top_n \
|
| 135 |
+
--exp_dir $exp_dir \
|
| 136 |
+
--data ${data} \
|
| 137 |
+
--trials "$trials"
|
| 138 |
+
fi
|
MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v2/README.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Results
|
| 2 |
+
|
| 3 |
+
* Setup: fbank80, num_frms200, epoch150, ArcMargin, aug_prob0.6, speed_perturb (no spec_aug)
|
| 4 |
+
* Scoring: cosine (sub mean of vox2_dev), AS-Norm, [QMF](https://arxiv.org/pdf/2010.11255)
|
| 5 |
+
* Metric: EER(%)
|
| 6 |
+
* 🔥 UPDATE 2024.09.03: We support the SimAM_ResNet pretrained on VoxBlink2 and Finetuned on Voxceleb2!
|
| 7 |
+
* 🔥 UPDATE 2024.08.27: We support SSL models as the feature front-end, take a look at the WavLM recipe!
|
| 8 |
+
* UPDATE 2022.07.19: We apply the same setups as the winning system of CNSRC 2022 (see [cnceleb](https://github.com/wenet-e2e/wespeaker/tree/master/examples/cnceleb/v2) recipe for details), and obtain significant performance improvement.
|
| 9 |
+
* LR scheduler warmup from 0
|
| 10 |
+
* Remove one embedding layer in ResNet models
|
| 11 |
+
* Add large margin fine-tuning strategy (LM)
|
| 12 |
+
|
| 13 |
+
| Model | Params | Flops | LM | AS-Norm | QMF | vox1-O-clean | vox1-E-clean | vox1-H-clean |
|
| 14 |
+
|:------|:------:|:------|:--:|:-------:|:---:|:------------:|:------------:|:------------:|
|
| 15 |
+
| XVEC-TSTP-emb512 | 4.61M | 0.53G | × | × | × | 1.989 | 1.950 | 3.412 |
|
| 16 |
+
| | | | × | √ | × | 1.834 | 1.846 | 3.124 |
|
| 17 |
+
| | | | √ | × | × | 1.749 | 1.721 | 2.944 |
|
| 18 |
+
| | | | √ | √ | × | 1.590 | 1.641 | 2.726 |
|
| 19 |
+
| ECAPA_TDNN_GLOB_c512-ASTP-emb192 | 6.19M | 1.04G | × | × | × | 1.069 | 1.209 | 2.310 |
|
| 20 |
+
| | | | × | √ | × | 0.957 | 1.128 | 2.105 |
|
| 21 |
+
| | | | √ | × | × | 0.878 | 1.072 | 2.007 |
|
| 22 |
+
| | | | √ | √ | × | 0.782 | 1.005 | 1.824 |
|
| 23 |
+
| ECAPA_TDNN_GLOB_c1024-ASTP-emb192 | 14.65M | 2.65G | × | × | × | 0.856 | 1.072 | 2.059 |
|
| 24 |
+
| | | | × | √ | × | 0.808 | 0.990 | 1.874 |
|
| 25 |
+
| | | | √ | × | × | 0.798 | 0.993 | 1.883 |
|
| 26 |
+
| | | | √ | √ | × | 0.728 | 0.929 | 1.721 |
|
| 27 |
+
| | | | √ | √ | √ | 0.707 | 0.894 | 1.615 |
|
| 28 |
+
| ResNet34-TSTP-emb256 | 6.63M | 4.55G | × | × | × | 0.867 | 1.049 | 1.959 |
|
| 29 |
+
| | | | × | √ | × | 0.787 | 0.964 | 1.726 |
|
| 30 |
+
| | | | × | √ | √ | 0.718 | 0.911 | 1.606 |
|
| 31 |
+
| | | | √ | × | × | 0.797 | 0.937 | 1.695 |
|
| 32 |
+
| | | | √ | √ | × | 0.723 | 0.867 | 1.532 |
|
| 33 |
+
| | | | √ | √ | √ | 0.659 | 0.821 | 1.437 |
|
| 34 |
+
| ResNet221-TSTP-emb256 | 23.79M | 21.29G | × | × | × | 0.569 | 0.774 | 1.464 |
|
| 35 |
+
| | | | × | √ | × | 0.479 | 0.707 | 1.290 |
|
| 36 |
+
| | | | √ | × | × | 0.580 | 0.729 | 1.351 |
|
| 37 |
+
| | | | √ | √ | × | 0.505 | 0.676 | 1.213 |
|
| 38 |
+
| ResNet293-TSTP-emb256 | 28.62M | 28.10G | × | × | × | 0.595 | 0.756 | 1.433 |
|
| 39 |
+
| | | | × | √ | × | 0.537 | 0.701 | 1.276 |
|
| 40 |
+
| | | | √ | × | × | 0.532 | 0.707 | 1.311 |
|
| 41 |
+
| | | | √ | √ | × | 0.447 | 0.657 | 1.183 |
|
| 42 |
+
| | | | √ | √ | √ | **0.425** | **0.641** | **1.146** |
|
| 43 |
+
| RepVGG_TINY_A0 | 6.26M | 4.65G | × | × | × | 0.909 | 1.034 | 1.943 |
|
| 44 |
+
| | | | × | √ | × | 0.824 | 0.953 | 1.709 |
|
| 45 |
+
| CAM++ | 7.18M | 1.15G | × | × | × | 0.803 | 0.932 | 1.860 |
|
| 46 |
+
| | | | × | √ | × | 0.718 | 0.879 | 1.735 |
|
| 47 |
+
| | | | √ | x | × | 0.707 | 0.845 | 1.664 |
|
| 48 |
+
| | | | √ | √ | × | 0.659 | 0.803 | 1.569 |
|
| 49 |
+
| ERes2Net34_Base | 7.88M | 3.43G | × | × | × | 0.914 | 1.065 | 1.986 |
|
| 50 |
+
| | | | × | √ | × | 0.803 | 0.976 | 1.787 |
|
| 51 |
+
| | | | √ | x | × | 0.824 | 0.968 | 1.776 |
|
| 52 |
+
| | | | √ | √ | × | 0.744 | 0.896 | 1.603 |
|
| 53 |
+
| Res2Net34_Base | 4.68M | 1.77G | × | × | × | 1.351 | 1.347 | 2.478 |
|
| 54 |
+
| | | | × | √ | × | 1.234 | 1.232 | 2.162 |
|
| 55 |
+
| Gemini_DFResNet114 | 6.53M | 5.42G | × | × | × | 0.787 | 0.963 | 1.760 |
|
| 56 |
+
| | | | × | √ | × | 0.707 | 0.889 | 1.546 |
|
| 57 |
+
| | | | √ | x | × | 0.771 | 0.906 | 1.599 |
|
| 58 |
+
| | | | √ | √ | × | 0.638 | 0.839 | 1.427 |
|
| 59 |
+
| SimAM_ResNet34 (VoxBlink2 Pretrain) | 25.2M | | √ | x | × | 0.415 | 0.615 | 1.121 |
|
| 60 |
+
| | | | √ | √ | × | 0.372 | 0.581 | 1.049 |
|
| 61 |
+
| | | | √ | √ | √ | 0.372 | 0.559 | 0.997 |
|
| 62 |
+
| SimAM_ResNet100 (VoxBlink2 Pretrain) | 50.2M | | √ | x | × | 0.229 | 0.458 | 0.868 |
|
| 63 |
+
| | | | √ | √ | × | 0.207 | 0.424 | 0.804 |
|
| 64 |
+
| | | | √ | √ | √ | 0.202 | 0.421 | 0.795 |
|
| 65 |
+
| XI_VEC_ECAPA_TDNN_c512 | 5.9M | 1.04G | x | x | × | 0.995 | 1.130 | 2.169 |
|
| 66 |
+
| | | | × | √ | × | 0.883 | 1.056 | 1.976 |
|
| 67 |
+
| | | | √ | × | × | 0.909 | 1.000 | 1.855 |
|
| 68 |
+
| | | | √ | √ | × | 0.787 | 0.930 | 1.693 |
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
## PLDA results
|
| 72 |
+
If you are interested in the PLDA scoring (which is inferior to the simple cosine scoring under the margin based setting), simply run:
|
| 73 |
+
|
| 74 |
+
```bash
|
| 75 |
+
local/score_plda.sh --stage 1 --stop-stage 3 --exp_dir exp_name
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
The results on ResNet34 (large margin, no asnorm) are:
|
| 79 |
+
|
| 80 |
+
| Scoring method | vox1-O-clean | vox1-E-clean | vox1-H-clean |
|
| 81 |
+
|:--------------:|:------------:|:------------:|:------------:|
|
| 82 |
+
| PLDA | 1.207 | 1.350 | 2.528 |
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
## WavLM results
|
| 86 |
+
|
| 87 |
+
* Pre-trained frontend: the [WavLM](https://arxiv.org/abs/2110.13900) Large model, multilayer features are used
|
| 88 |
+
* Speaker model: ECAPA_TDNN_GLOB_c512-ASTP-emb192
|
| 89 |
+
* Training strategy: Frozen => Joint ft => Joint lmft
|
| 90 |
+
|
| 91 |
+
```bash
|
| 92 |
+
bash run_wavlm.sh --stage 3 --stop_stage 9
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
| Training strategy | AS-Norm | QMF | vox1-O-clean | vox1-E-clean | vox1-H-clean |
|
| 96 |
+
|:------------------|:-------:|:---:|:------------:|:------------:|:------------:|
|
| 97 |
+
| Frozen | × | × | 0.595 | 0.719 | 1.501 |
|
| 98 |
+
| | √ | × | 0.548 | 0.656 | 1.355 |
|
| 99 |
+
| | √ | √ | 0.489 | 0.619 | 1.224 |
|
| 100 |
+
| Frozen => Joint ft | × | × | 0.542 | 0.635 | 1.355 |
|
| 101 |
+
| | √ | × | 0.521 | 0.594 | 1.237 |
|
| 102 |
+
| | √ | √ | 0.494 | 0.576 | 1.205 |
|
| 103 |
+
| Frozen => Joint ft => Joint lmft | × | × | 0.521 | 0.626 | 1.344 |
|
| 104 |
+
| | √ | × | 0.495 | 0.588 | 1.247 |
|
| 105 |
+
| | √ | √ | **0.415** | **0.551** | **1.118** |
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
### W2V-BERT 2.0 Results
|
| 111 |
+
|
| 112 |
+
* Pre-trained frontend: the [W2V-BERT 2.0](https://arxiv.org/abs/2108.06209) model
|
| 113 |
+
* Speaker model: w2v-bert2-LoRA-adapter-MFA
|
| 114 |
+
* Training strategy: Frozen (LoRA) =\> Joint ft =\> Joint lmft
|
| 115 |
+
|
| 116 |
+
<!-- end list -->
|
| 117 |
+
|
| 118 |
+
```bash
|
| 119 |
+
bash run_w2v.sh --stage 3 --stop_stage 9
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
| Training strategy | vox1-O-clean | vox1-E-clean | vox1-H-clean |
|
| 123 |
+
|:------------------|:------------:|:------------:|:------------:|
|
| 124 |
+
| Frozen (LoRA) | 0.335 | 0.509 | 1.062 |
|
| 125 |
+
| Frozen (LoRA) =\> Joint ft | 0.319 | 0.492 | 1.036 |
|
| 126 |
+
| Frozen (LoRA) =\> Joint ft =\> Joint lmft | **0.250** | **0.398** | **0.838** |
|
| 127 |
+
|
| 128 |
+
> **Note:** The results above are reproduced on **VoxCeleb** only.
|
| 129 |
+
> They use whole-utterance cosine scoring with Vox2-dev mean normalization, without AS-Norm, QMF, or calibration.
|
| 130 |
+
>
|
| 131 |
+
> We also verified our implementation by loading the author's official checkpoint (trained on **VoxCeleb + VoxBlink**) and performing inference. The comparison below confirms that our inference pipeline matches the official performance.
|
| 132 |
+
|
| 133 |
+
| Source | Strategy | vox1-O-clean | vox1-E-clean | vox1-H-clean |
|
| 134 |
+
|:-------|:--------:|:------------:|:------------:|:------------:|
|
| 135 |
+
| Author's GitHub | LMFT | 0.14 | 0.31 | 0.73 |
|
| 136 |
+
| **This PR** (w/ Author's Ckpt) | LMFT (w/ AS-Norm & QMF) | **0.138** | **0.285** | **0.625** |
|
| 137 |
+
|
| 138 |
+
## HAM-Softmax Results
|
| 139 |
+
|
| 140 |
+
HAM-Softmax is an additive margin softmax based on Poincare ball hyperbolic distance. See the [paper](https://arxiv.org/abs/2601.19709) and [official implementation](https://github.com/PunkMale/HAM-Softmax).
|
| 141 |
+
|
| 142 |
+
All results use margin warmup 0.0 -> 0.2, speed perturb, aug_prob=0.6, no spec_aug, model averaging, AS-Norm + calibration.
|
| 143 |
+
|
| 144 |
+
| Model | Loss | Curvature | vox1-O-clean | vox1-E-clean | vox1-H-clean |
|
| 145 |
+
|:------|:----:|:---------:|:------------:|:------------:|:------------:|
|
| 146 |
+
| ECAPA_TDNN_GLOB_c512-ASTP-emb192 | AAM-Softmax | - | 0.909 | 1.075 | 1.976 |
|
| 147 |
+
| ECAPA_TDNN_GLOB_c512-ASTP-emb192 | HAM-Softmax | 3.0 | 0.872 | 1.040 | 1.856 |
|
| 148 |
+
| ResNet34-TSTP-emb256 | AAM-Softmax | - | 0.691 | 0.895 | 1.596 |
|
| 149 |
+
| ResNet34-TSTP-emb256 | HAM-Softmax | 3.0 | 0.702 | 0.886 | 1.547 |
|
| 150 |
+
|
| 151 |
+
## ReDimNet2 Results
|
| 152 |
+
|
| 153 |
+
* See the [Paper](https://arxiv.org/abs/2603.11841) and [Official Implementation](https://github.com/PalabraAI/redimnet2)
|
| 154 |
+
* Model: ReDimNet2B6
|
| 155 |
+
* Frontend: TFMel (n_mels=72, hop_length=160, win_length=400, ...)
|
| 156 |
+
* Training strategy: SphereFace2 => Large margin fine-tuning
|
| 157 |
+
* Note: batch size significantly affects performance; a large batch size is recommended
|
| 158 |
+
|
| 159 |
+
| Source | LM | vox1-O-clean | vox1-E-clean | vox1-H-clean |
|
| 160 |
+
|:-------|:--:|:------------:|:------------:|:------------:|
|
| 161 |
+
| Author's GitHub | √ | 0.29 | 0.52 | 0.99 |
|
| 162 |
+
| This PR (w/ Official Ckpt) | √ | **0.276** | 0.518 | 1.003 |
|
| 163 |
+
| This PR (trained from scratch) | √ | 0.330 | **0.502** | **0.985** |
|
MOSS_Speaker-RoPE/wespeaker/examples/voxceleb/v2/conf/campplus.yaml
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### train configuraton
|
| 2 |
+
|
| 3 |
+
exp_dir: exp/CAMPPlus-TSTP-emb512-fbank80-num_frms200-aug0.6-spTrue-saFalse-ArcMargin-SGD-epoch150
|
| 4 |
+
gpus: "[0,1]"
|
| 5 |
+
num_avg: 10
|
| 6 |
+
enable_amp: False # whether enable automatic mixed precision training
|
| 7 |
+
|
| 8 |
+
seed: 42
|
| 9 |
+
num_epochs: 150
|
| 10 |
+
save_epoch_interval: 5 # save model every 5 epochs
|
| 11 |
+
log_batch_interval: 100 # log every 100 batchs
|
| 12 |
+
|
| 13 |
+
dataloader_args:
|
| 14 |
+
batch_size: 128
|
| 15 |
+
num_workers: 16
|
| 16 |
+
pin_memory: False
|
| 17 |
+
prefetch_factor: 8
|
| 18 |
+
drop_last: True
|
| 19 |
+
|
| 20 |
+
dataset_args:
|
| 21 |
+
# the sample number which will be traversed within one epoch, if the value equals to 0,
|
| 22 |
+
# the utterance number in the dataset will be used as the sample_num_per_epoch.
|
| 23 |
+
sample_num_per_epoch: 0
|
| 24 |
+
shuffle: True
|
| 25 |
+
shuffle_args:
|
| 26 |
+
shuffle_size: 2500
|
| 27 |
+
filter: True
|
| 28 |
+
filter_args:
|
| 29 |
+
min_num_frames: 100
|
| 30 |
+
max_num_frames: 800
|
| 31 |
+
resample_rate: 16000
|
| 32 |
+
speed_perturb: True
|
| 33 |
+
num_frms: 200
|
| 34 |
+
aug_prob: 0.6 # prob to add reverb & noise aug per sample
|
| 35 |
+
fbank_args:
|
| 36 |
+
num_mel_bins: 80
|
| 37 |
+
frame_shift: 10
|
| 38 |
+
frame_length: 25
|
| 39 |
+
dither: 1.0
|
| 40 |
+
spec_aug: False
|
| 41 |
+
spec_aug_args:
|
| 42 |
+
num_t_mask: 1
|
| 43 |
+
num_f_mask: 1
|
| 44 |
+
max_t: 10
|
| 45 |
+
max_f: 8
|
| 46 |
+
prob: 0.6
|
| 47 |
+
|
| 48 |
+
model: CAMPPlus
|
| 49 |
+
model_init: null
|
| 50 |
+
model_args:
|
| 51 |
+
feat_dim: 80
|
| 52 |
+
embed_dim: 512
|
| 53 |
+
pooling_func: "TSTP" # the default pooling_func in CAM++ is TSTP
|
| 54 |
+
projection_args:
|
| 55 |
+
project_type: "arc_margin" # add_margin, arc_margin, sphere, softmax
|
| 56 |
+
scale: 32.0
|
| 57 |
+
easy_margin: False
|
| 58 |
+
|
| 59 |
+
margin_scheduler: MarginScheduler
|
| 60 |
+
margin_update:
|
| 61 |
+
initial_margin: 0.0
|
| 62 |
+
final_margin: 0.2
|
| 63 |
+
increase_start_epoch: 20
|
| 64 |
+
fix_start_epoch: 40
|
| 65 |
+
update_margin: True
|
| 66 |
+
increase_type: "exp" # exp, linear
|
| 67 |
+
|
| 68 |
+
loss: CrossEntropyLoss
|
| 69 |
+
loss_args: {}
|
| 70 |
+
|
| 71 |
+
optimizer: SGD
|
| 72 |
+
optimizer_args:
|
| 73 |
+
momentum: 0.9
|
| 74 |
+
nesterov: True
|
| 75 |
+
weight_decay: 0.0001
|
| 76 |
+
|
| 77 |
+
scheduler: ExponentialDecrease
|
| 78 |
+
scheduler_args:
|
| 79 |
+
initial_lr: 0.1
|
| 80 |
+
final_lr: 0.00005
|
| 81 |
+
warm_up_epoch: 6
|
| 82 |
+
warm_from_zero: True
|