-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinf_vb_supportive.sh
executable file
·66 lines (49 loc) · 1.92 KB
/
inf_vb_supportive.sh
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
65
66
stage=$1
ckp=$2
task=$3 #"vocoder" or "se"
model_name=$4
schedule=$5 #"fast" or "full"
. ./path.sh
voicebank_noisy="${voicebank}/noisy_testset_wav_16k"
voicebank_clean="${voicebank}/clean_testset_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_Test
spec_type="noisy spectrum"
elif [[ "$task" == "vocoder" ]]; then
wav_root=${voicebank_clean}
spec_root=${diffwave}/spec/voicebank_Clean_Test
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"
test_spec_list=${spec_root}
enhanced_path=${diffwave}/Enhanced/${model_name}/model${ckp}_${schedule}_supportive/test
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_supportive.py --${schedule} ${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_test.csv
clean_wav=${voicebank_clean}
enhanced_result=${diffwave}/Enhanced/${model_name}/model${ckp}_${schedule}_supportive/test
echo "save the score to ${score_file}"
cd pesq/speech-metrics/
python main.py ${clean_wav} ${enhanced_result} ${score_file} model${ckp}_${schedule}_supportive
cd -
fi