Hi all,
I've trained a CTC model with keras and language model(TLG.fst, which is like the miao's work). Now I wanna use python script to calculate the output of the LSTM net, and then decode with latgen_faster_mapped (or latgen_faster from miao' project).
The problem is how to convert the numpy matrix from python script to the kaldi IO for the latgen_faster_mapped.
with the reference of keras-kaldi, my shell script is as following:
feats="ark,s,cs:nnet-forward.py exp/data/test_corpus.json exp/data/train_corpus.json exp/model_R7T9 |"
$cmd JOB=1:$nj $dir/log/decode.JOB.log \
latgen-faster --max-active=$max_active --beam=$beam --lattice-beam=$latbeam --acoustic-scale=$acwt --allow-partial=true --word-symbol-table=$graphdir/words.txt $graphdir/TLG.fst "$feats" "ark:|gzip -c > $dir/lat.JOB.gz" || exit 1;
for the nnet-forward.py:(with python 2.7)
arkOut = sys.stdout
encoding = sys.getdefaultencoding()
signal (SIGPIPE, SIG_DFL)
... ...
for audio_file in datagen.test_audio_paths:
uttId = audio_file.split("/")[-1]
uttId = uttId.split(".")[0]
featmat = datagen.featurize(audio_file)
featmat = datagen.normalize(featmat)
kaldiIO.writeUtterance(uttId, featmat, arkOut, encoding)
but with the code above, it lets to no ending running. How can I fixed it?
Many thanks
Xin.q.