-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathvalid_vb.sh
More file actions
executable file
·64 lines (49 loc) · 1.91 KB
/
valid_vb.sh
File metadata and controls
executable file
·64 lines (49 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
../../valid_vb.shstage=$1
ckp=$2
task="vocoder" #"vocoder" or "se"
model_name="voicebank_model_vocoder"
. ./path.sh
voicebank_noisy="${voicebank}/noisy_trainset_28spk_wav_16k"
voicebank_clean="${voicebank}/clean_trainset_28spk_wav_16k"
if [[ ! " se vocoder " =~ " $task " ]]; then
echo "Error: \$task must be either se or vocoder: ${task}"
exit 1;
fi
if [[ "$task" == "se" ]]; then
wav_root=${voicebank_noisy}
spec_root=${diffwave}/spec/voicebank_Noisy/valid
spec_type="noisy spectrum"
elif [[ "$task" == "vocoder" ]]; then
wav_root=${voicebank_clean}
spec_root=${diffwave}/spec/voicebank_Clean/valid
spec_type="clean Mel-spectrum"
fi
# if [ ${stage} -le 1 ]; then
# echo "stage 1 : preparing testing data"
# spec_path=${spec_root}
# wave_path=${wav_root}
# echo "create ${spec_type} from ${wave_path} to ${spec_path}"
# rm -r ${spec_path} 2>/dev/null
# mkdir -p ${spec_path}
# python src/diffwave/preprocess.py ${wave_path} ${spec_path} --${task} --test --voicebank
# fi
if [ ${stage} -le 2 ]; then
echo "stage 2 : inference model"
target_wav_root=${voicebank_clean}
test_spec_list=${spec_root}
enhanced_path=${diffwave}/Enhanced/${model_name}/model${ckp}/
rm -r ${enhanced_path} 2>/dev/null
mkdir -p ${enhanced_path}
echo "inference enhanced wav file from ${spec_root} to ${enhanced_path}"
python src/diffwave/inference.py ${diffwave}/${model_name}/weights-${ckp}.pt ${test_spec_list} ${voicebank_noisy} -o ${enhanced_path} --${task} --voicebank
fi
if [ ${stage} -le 3 ]; then
echo "stage 3 : scoring"
score_file=${diffwave}/Enhanced/${model_name}/scores.csv
clean_wav=${diffwave}/clean_dev/
enhanced_result=${diffwave}/Enhanced/${model_name}/model${ckp}/valid
echo "save the score to ${score_file}"
cd pesq/speech-metrics/
python main.py ${clean_wav} ${enhanced_result} ${score_file} model${ckp}
cd -
fi