-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_cnn.sh
executable file
·96 lines (83 loc) · 3.1 KB
/
run_cnn.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
#set -x;
#trap read debug;
### run: ./run_cnn.sh 1 # with number of stage
stage=$1
. ./path.sh
nj=20 # number of parallel jobs
###
# LRE15 dataset feature extraction
###
# root folder with audio files to scan
#dataset_dir=/data3/pums/LRE2015/LDC2015E87E88_LRE15_Training_Data
dataset_dir=/data3/pums/trungnt/LRE2017/LDC2017E22/data/
# subfolders to scan
#scan_sub_dir="spa-car spa-eur spa-lac por-brz"
scan_sub_dir="ara-acm ara-ary eng-gbr por-brz qsl-rus spa-eur zho-cmn"
scan_sub_dir+=" ara-apc ara-arz eng-usg qsl-pol spa-car spa-lac zho-nan"
# output folder for audio lists, fbanks, attribute scores ...
out_dir=/home1/ivan/projects_data/mulan_lre17/
# 0. prepare data
# scan Spanish cluster subfolders of LID dataset
if [ $stage -eq 0 ]; then
for sub in $scan_sub_dir; do
steps/data_prep.sh $dataset_dir/$sub "sph" $out_dir/$sub
done
fi
# 1. extract log mel-filter bank features, binary encoding
if [ $stage -eq 1 ]; then
for sub in $scan_sub_dir; do
lists_dir=$out_dir/$sub/lists
fbank_dir=$out_dir/$sub/cnn-fbank
steps/make_fbank_pitch.sh $nj $lists_dir $fbank_dir
steps/compute_cmvn_stats.sh $fbank_dir $fbank_dir
done
fi
# 2. forward data through the Neural Network and producing scores
if [ $stage -eq 2 ]; then
# NOTE: you can fix number of threads for calculate jobs at a time
echo "LRE dataset"
echo "*** Manner extraction ***"
for sub in $scan_sub_dir; do
fbank_dir=$out_dir/$sub/cnn-fbank
trans=model/manner/fbank_to_splice_cnn4c_128_3_uvz_mfom.trans
nnet=model/manner/cnn4c_128_3_uvz_mfom.nnet
manner_out=$out_dir/$sub/res/manner
steps/forward_cnn_parallel.sh $nj $fbank_dir $trans $nnet $manner_out
done
echo "*** Place extraction ***"
for sub in $scan_sub_dir; do
fbank_dir=$out_dir/$sub/cnn-fbank
trans=model/place/fbank_to_splice_cnn4c_128_7_uvz_mfom.trans
nnet=model/place/cnn4c_128_7_uvz_mfom.nnet
place_out=$out_dir/$sub/res/place
steps/forward_cnn_parallel.sh $nj $fbank_dir $trans $nnet $place_out
done
echo "*** Fusion extraction ***"
for sub in $scan_sub_dir; do
fbank_dir=$out_dir/$sub/cnn-fbank
trans=model/fusion/fbank_to_splice_cnn4c_128_5_uvz_mfom.trans
nnet=model/fusion/cnn4c_128_5_uvz_mfom.nnet
fusion_out=$out_dir/$sub/res/fusion
steps/forward_cnn_parallel.sh $nj $fbank_dir $trans $nnet $fusion_out
done
fi
# 3. split fusion on fusion_manner and fusion_place parts
if [ $stage -eq 3 ]; then
echo "*** Select MANNER part from FUSION scores ***"
feat_select="2,4,9,10,12,13,15,16" # with 'other' and 'sil'
for sub in $scan_sub_dir; do
fusion_in=$out_dir/$sub/res/fusion
fusion_out=$out_dir/$sub/res/fusion_manner
log=$fusion_out/log
steps/select_features.sh $nj $feat_select $fusion_in $fusion_out $log
done
echo "*** Select PLACE part from FUSION scores ***"
feat_select="0,1,3,5,6,7,8,10,11,12,14" # with 'other' and 'sil'
for sub in $scan_sub_dir; do
fusion_in=$out_dir/$sub/res/fusion
fusion_out=$out_dir/$sub/res/fusion_place
log=$fusion_out/log
steps/select_features.sh $nj $feat_select $fusion_in $fusion_out $log
done
fi