理解wav2letter++ tutorial

2019-01-05  本文已影响215人  乘瓠散人

Step1 Data preparation

下载完数据后我们需要预处理数据使其格式能被wav2letter++处理:
cd wav2letter/tutorials/1-librispeech_clean
python3 prepare_data.py --src $W2LDIR/LibriSpeech/ --dst $W2LDIR
python3 prepare_lm.py --dst $W2LDIR
此时生成的data文件夹里存放着预处理后的数据。
prepare_data.py prepares the dataset and tokens file
prepare_lm.py prepares lexicon and language model data
预处理后的每条音频数据都会有四个对应的文件:

Step 2: Training the Acoustic Model

首先将train.cfg文件中的[...]替换成正确的路径

--datadir=/home/zd/W2Ldemo/
--tokensdir=/home/zd/W2Ldemo/
--rundir=/home/zd/W2Ldemo/saved_models
--archdir=/data/zd/wav2letter/tutorials/1-librispeech_clean/

然后执行:
/data/zd/wav2letter/build/Train train --flagsfile /data/zd/wav2letter/tutorials/1-librispeech_clean/train.cfg
训练后的logs保存在你设置的rundir目录下。

Step3 Decoding

首先将decode.cfg文件中的[...]替换成正确的路径

--datadir=/home/zd/W2Ldemo/
--lexicon=/home/zd/W2Ldemo/lm/lexicon.txt
--lm=/home/zd/W2Ldemo/lm/3-gram.arpa
--am=/home/zd/W2Ldemo/saved_models/librispeech_clean_trainlogs/001_model_data#dev-clean.bin
--sclite=/home/zd/W2Ldemo/decode_logs

然后执行:
/data/zd/wav2letter/build/Decoder --flagsfile /data/zd/wav2letter/tutorials/1-librispeech_clean/decode.cfg
解码后的logs保存在你设置的sclite目录下,查看最后5行log:
tail -n 5 data#test-clean.log

|T|: then i long tried by natural ills received the comfort fast while budding at thy sight my pilgrim's staff gave out green leaves with morning dews impearled 
|P|: then i long tried by natural walls were seized the comfort fast while buying at thy sight my pilgrim staff gave out relies with morning dew impearled 
[sample: 2616, WER: 29.6296%, LER: 12.2581%, slice WER: 18.6255%, slice LER: 8.84388%, progress: 100%]
------
[Decode data/test-clean (2620 samples) in 113.572s (actual decoding time 0.205s/sample) -- WER: 18.6872, LER: 9.02497]

|T| - True transcription
|P| - predicted transcription.
WER - Word Error Rate for current sample.
slice-WER - Overall Word Error Rate in the current thread. (Note that for decoding they divide the work using a ThreadPool)
最后一行显示最终的结果WER: 18.6872, LER: 9.02497

上一篇下一篇

猜你喜欢

热点阅读