代码的相关路径:./egs/gop_speechocean762/s5/run.sh
#!/usr/bin/env bash
data=/DATA/disk1/ASR/en
# Base url for downloads.
data_url=www.openslr.org/resources/101
stage=1
nj=25
# You might not want to do this for interactive shells.
set -e
. ./cmd.sh
. ./path.sh
. parse_options.sh
# This recipe depends on the model trained in the librispeech recipe.
# For training it:
# cd $KALDI_ROOT/egs/librispeech/s5
# ./run.sh && local/nnet3/run_tdnn.sh
# Check librispeech's models
librispeech_eg=../../librispeech/s5
model=${librispeech_eg}/exp/nnet3_cleaned/tdnn_sp
ivector_extractor=${librispeech_eg}/exp/nnet3_cleaned/extractor
lang=${librispeech_eg}/data/lang
for d in ${model} ${ivector_extractor} ${lang}; do
[ ! -d $d ] && echo "$0: no such path $d" && exit 1;
done
if [ $stage -le 1 ]; then
echo "[stage:1] ================================================="
# Download data and untar
local/download_and_untar.sh ${data_url} ${data}
fi
if [ $stage -le 2 ]; then
echo "[stage:2] ================================================="
# Prepare data
for part in train test; do
local/data_prep.sh ${data}/speechocean762/${part} data/${part}
done
mkdir -p data/local
cp ${data}/speechocean762/resource/* data/local
fi
if [ $stage -le 3 ]; then
echo "[stage:3] ================================================="
# Create high-resolution MFCC features, 创建高分辨率的MFCC特征
for part in train test; do
steps/make_mfcc.sh --nj ${nj} --mfcc-config conf/mfcc_hires.conf \
--cmd "$cmd" data/${part} || exit 1;
steps/compute_cmvn_stats.sh data/${part} || exit 1;
utils/fix_data_dir.sh data/${part}
done
【补充说明】查看输出的MFCC特征数据的指令:
copy-feats "scp:data/test/feats.scp" "ark,t:-" | head -n 2
输出的是二维的特征, 如00010001特征的shape: (227, 40), 40是MFCC特征的长度,227是帧的数量,和stage11输出长度一致,即后续一个帧会对齐到每一个音素上,具体如下:
00010001
[ 91.30648 -31.38977 -25.5386 19.90364 10.10932 10.89336 22.00128 -10.71933 9.506165 12.86325 11.02181 -0.08815002 0.5899773 5.1927 -25.60454 6.712193 13.7061 -6.3731 4.019569 3.178125 -0.726505 3.870902 1.200065 -0.04117173 0.5181007 1.772697 1.246345 -7.817516 -4.15204 1.693407 -2.601602 -2.346337 0.329442 4.211855 4.422906 -3.039072 0.1500187 -3.960899 -2.57319 0.07763124
...
96.19428 -34.43648 -35.24254 17.51788 17.41017 -14.78151 3.162067 1.489887 17.02568 6.297318 13.17063 14.1692 5.918406 31.34877 -10.7795 9.928806 8.721313 -2.614691 -2.994031 10.68437 3.951502 1.490264 -0.9215031 0.2555852 -4.241319 1.922091 -2.687001 3.918316 0.03298759 -1.90785 3.622477 -5.009537 3.519498 2.943741 12.91074 7.866814 3.041382 -5.893824 4.80205 -0.3113484 ]
00010002
[ 32.75534 -48.70062 -16.49558 -26.19669 -20.90786 -19.52123 -19.58907 -8.990177 -8.515429 3.417076 -9.601532 -13.45203 1.152281 4.773994 -4.776098 0.1982174 -10.14483-9.169753 -9.467003 -2.585409 -1.738791 -1.260978 0.4241405 0.2740594 1.086525 -0.3220506 2.999166 5.143687 4.901542 -2.560283 -7.946997 -2.811001 1.152698 1.244672 2.276928 -4.70488 -4.969048 -3.587363 -2.910727 -0.5382481
...
fi
if [ $stage -le 4 ]; then
echo "[stage:4] ================================================="