A.I. based Embedded Speech to Text Using Deepspeech

02/25/2020 ∙ by Muhammad Hafidh Firmansyah, et al. ∙ EPFL KYUNGPOOK NATIONAL UNIVERSITY 0

Deepspeech was very useful for development IoT devices that need voice recognition. One of the voice recognition systems is deepspeech from Mozilla. Deepspeech is an open-source voice recognition that was using a neural network to convert speech spectrogram into a text transcript. This paper shows the implementation process of speech recognition on a low-end computational device. Development of English-language speech recognition that has many datasets become a good point for starting. The model that used results from pre-trained model that provide by each version of deepspeech, without change of the model that already released, furthermore the benefit of using raspberry pi as a media end-to-end speech recognition device become a good thing, user can change and modify of the speech recognition, and also deepspeech can be standalone device without need continuously internet connection to process speech recognition, and even this paper show the power of Tensorflow Lite can make a significant difference on inference by deepspeech rather than using Tensorflow non-Lite.This paper shows the experiment using Deepspeech version 0.1.0, 0.1.1, and 0.6.0, and there is some improvement on Deepspeech version 0.6.0, faster while processing speech-to-text on old hardware raspberry pi 3 b+.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 5

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

ASR

( Automatic Speech Recognition ) are directly mapped audio as input and the output as character using neural network

[Baskar et al.2019].Nowadays, voice recognition service needs a user to pay for using the service, and users need pay with a range from four U.S. Dollar until one hundred and fifty U.S. Dollar for every four thousand requests. Google Assistant, Amazon Alexa are led on ASR system for various application [Dumpala et al.2019]. Moreover, for another aspect need always connected with internet to process voice recognition, where ASR ( Automatic Speech Recognition ) provider using API (Application Program Interface ) for processing voice recognition, also user can’t modified what they need. Then, we choose deepspeech by Mozilla, which open-source voice recognition. That has excellent performance, also can use a big dataset using the English language for starting point, and also have many accents for the dataset, this paper based on [Hannun et al.2014] Baidu research paper that publishes in 2016. This paper shows the performance deepspeech from the first version until latest version (0.6.0 version ) using raspberry pi three b+, as a device for implementation deepspeech which have low computational power will show advantages and disadvantages of each deepspeech version. This paper we will show the deepspeech sctructure on ”Deepspeech Neural Network Structure” section, for details information deepseech model . advantages and disadvantages of each deepspeech version is show on ”Pre-trained data details” section. Device details information that will be used on experiment will show on ”Device details” section. For ”Experiment” section provide data and result of the experiment on each deepspeech version. Final conclusion of the experiment section will explain on ”Conclusion” section.

2 Deepspeech Neural Network Structure

Neural network are very important on deepspeech, neural network are work immitate human brain [Islam et al.2019].

Figure 1:

Single Flow Graph Neuron

Figure 1 shows a single graph of the neuron on a picture, and formula its show on formula (1) section, where of

and activation function that denotes by

will become a part of a neuron. From the simple neuron, it can be more complex neuron for processing input data.

(1)

Deepspeech using RNN

( Recurrent Neural Network ), RNN will process process spectogram as input sequence into final transcript as a readable text

[Amodei et al.2015].On neural network of deepspeech structure to ingest speech spectrogram for generating text transcript, have five hidden layers with three non-recurrent layers.Input denotes as , where hidden units for layer denotes with , as a time for sequence.The three layers using formula (2) to extract feature from the spectrogram.

(2)

Using ReLU

(Rectified Linear Unit ) for activation function, where ReLU

[Dittmer et al.2019], and are the bias and weight for layer [Iakushkin et al.2018] , and layer four is a bidirectional recurrent layer, with have two parts, that is forward formula (3).

(3)

Backward formula on fourth layer denotes on formula (4).

(4)

for fifth layer will take forward and backward part as input using formula (5) and (6):

(5)
(6)

Output layer is standard softmax function for each time slice t and character k , using formula (7) and (8)

(7)
(8)

3 Pre-trained data details

For pre-trained data, we didn’t training process again, but using same model that provide by deepspeech on each ver-sion, also using same one audio file for testing in each ver-sion deepspeech, the different only on environmtment where deepspeech are running like python version are matched by compability of each deepspeech version.

Configuration v0.1.0 v0.1.1 v0.2.0 v0.3.0 v0.4.0 v0.5.1 v0.6.0
train_file - LibriSpeech LibriSpeech LibriSpeech LibriSpeech LibriSpeech LibriSpeech
dev_file - LibriSpeech LibriSpeech LibriSpeech LibriSpeech LibriSpeech LibriSpeech
test_file - LibriSpeech LibriSpeech LibriSpeech LibriSpeech LibriSpeech LibriSpeech
train_batch - 12 24 24 24 24 128
dev_batch - 8 48 48 48 48 128
test_batch - 8 48 48 48 48 128
epoch - 13 30 30 30 75 75
learning_rate - 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001
dropout_rate - 0.2367 0.2 0.2 0.15 0.15 0.20
n_hidden - 2048 2048 2048 2048 2048 2048
Table 1: Comparison table on each version

3.1 Deepspeech v0.1.0

On deepspeech v0.1.0 didnt show the parameter that us-ing on training process, then user must use their own con-figuration for training process, deepspeech v0.1.0 only pro-vide pre-trained data that contain lm.binary and trie file also alphabet list. Deepspeech v0.1.0 have some advantages , the advantages are :

  • The code is simple

  • Can run on raspberry pi

  • Provide model for testing

And also, there is some disadvantages on deepspeech v0.1.0 when running on production system, the disadvantages are :

  • Didn’t provide checkpoint to continue training

  • Prediction still not good

Deepspeech v0.1.0 accuracy also mention on [Zeng et al.2019] ,with the host transcript is ”I wish you wouldn’t” but deepspeech v0.1.0 show the result ”A sight for sore eyes” , there is some miss on prediction text from an audio file.

3.2 Deepspeech v0.1.1

Deepspeech v0.1.1 show some information for training hyperparameter and also a changed that mention on the log information.There is only one change that happened on Deepspeech v0.1.1, initializing training run from the frozen graph. Deepspeech v0.1.1 provide model, alphabet list file and audio file. Deepspeech v0.1.1 also has some advantages :

  • Improvement on text prediction

  • Provide checkpoint for fine-tuning

  • Can run on raspberry pi

  • Deepspeech can run on python2.7 until the newest version

Besides the advantages of deepspeech v0.1.1, there are also some disadvantages on deepspeech v0.1.1,

  • Word Error Rate did not accurately

  • Using a huge amount of memory

  • Using a huge amount of CPU

Furthermore, for testing accuracy on deepspeech v0.1.1 already mention on [Zeng et al.2019] , the host transcript is ”I wish you would not”. Furthermore, the result from the inference is ”I wish you live”, there is some improvement, where deepspeech can predict the first two words from the host transcript.

3.3 Deepspeech v0.2.0

Deepspeech v0.2.0 didn’t have much change , for the result on word error rate, based on Table 2 , still show achieved 11% , but on deepspeech v0.2.0 itroduced new streaming API. Deepspeech v0.2.0 advantages

  • checkpoint for fine-tuning

  • V2 Trie still use memory around 600 MB

  • Support for Node.JS

Deepspeech v0.2.0 disadvantages :

  • Word error rate still high

  • Still use high amount of CPU and memory

3.4 Deepspeech v0.3.0

Deepspeech v0.3.0, based on Table 2, achieved word error rate 11% on trained American English with LibriSpeech. Also, there is some change than the previous version. The most important on change are they fixed on memory leak and change on trie format. the advantages of deepspeech v0.3.0 are :

  • Provide checkpoint for fine-tuning

  • Provide a model for testing

  • Support ARM64 device

  • Feature caching speed training

For disadvantages on deepspeech v0.3.0 are :

  • V2 Trie still use a huge amount of memory , around 600 MB

  • Feature caching speed training still use more memory

Deepspeech also can implement on many language [Ardila et al.2019] , some languages can be achieved until 15% for non-American English Language.

3.5 Deepspeech v0.4.0

Deepspeech v0.4.0 more stable than deepspeech v0.3.0 , it’s achieved 8.26% word error rate on Table 2 , word error rate on deepspeech v0.3.0 reduce by 2.74%. Deepspeech v0.4.0 become version that will be ready for using TFLite ready model. The advantages of deepspech v0.4.0 are ,

  • Feature caching speeds training

  • Have native client for Android

The disadvantages of deepspeech v0.4.0 are,

  • Caching speeds training still use huge of memory

  • V2 Trie still use memory around 600 MB

3.6 Deepspeech v0.5.1

Deepspeech v0.5.1 have more accurate for word error rate that only 8.22%, and deepspeech v0.5.1 have testing demo for android device using tflite, and for the model is trained on 467356 steps.Deepspeech have compatible for running from checkpoint on deepspeech v0.5.0. The advantages of deepspeech v0.5.1 :

  • Caching speeds training

  • Using TFLite

The disadvantages of deepspeech v0.5.1 :

  • Still consume huge of memory for using caching speeds training

  • Code still not yet thread safe

3.7 Deepspeech v0.6.0

Dee pspeech v0.6.0 show some information for training hyperparamter and also some changed that mention on the log information. The improvement that happened on deepspeech v0.6.0 are :

  • Change on data structure for language model trie file, can use memory mapped while loading.

  • Trie loading change become lazier , that reduce on memory usage and latency for first inference

And also on Deepspeech v0.6.0, they started using tensorflow lite for inference the process, it’s make more faster while doing the experiment on small raspberry pi 3 b+.

Deepspeech Version Word Eror Rate
0.1.0 -
0.1.1 -
0.2.0 11%
0.3.0 11%
0.4.0 8.26%
0.5.0 8.22%
0.6.0 7.50%
Table 2: Word Error Rate on Each Version of Deepspeech

On each version of Deepspeech, there is improvement quality on World Error Rate, it has shown by Table 2, for version 0.1.0 and 0.1.1 there is no precise information about the word error rate. For deepspeech version 0.3.0 the word error rate have same result with the previous version 11%, but it’s start going down again on next version of deepspeech, until it is reached version 0.6.0. From deepspeech version 0.2.0 the world error rate decreasing and become more accurate, it is indicated if the deepspeech have improved on accurate predicting text from the audio file.

4 Device details

On this section show what kind of device that using on the experiment, we use raspberry pi 3 b+ , we choose raspberry pi 3 b+ to implement pre-trained model data because raspberry can do computational processing without internet connection, and this is the detail of the device

Feature Model
Model Pi 3 Model B+
RAM 1 GB LPDDR2 SDRAM
CPU Cortex-A53, SoC @ 1.4GHz
Ethernet Gigabit Ethernet over USB 2.0 (
WLAN 2.4GHz,Bluetooth 4.2
HDMI Full-size
USB 4 USB-2.0 ports
Micro SD default
Power 5V/2.5A DC
Table 3: Feature and Model on Raspberry Pi

The benefit for using Raspberry Pi is the device only use very small power consumtion that mention by [Bekaroo and Santokhee2016], but we can explore for many things on the raspberry using full linux command, and also is possible to use all of GPIO pins for project.

5 Experiments

We do some experiment using deepspeech v0.6.0, v0.1.0 and v0.1.1. However, we do not do the test on deepspeech v0.2.0 until deepspeech v0.5.0 because there is some issue on compatibility environment on raspberry pi, which new modules become incompatible with some of deepspeech version. Deepspeech v0.2.0 until v0.5.0 must running on python3.4 and python3.5, but the module that we installed refused to run, then we did not continue the running test on deepspeech version 0.2.0 until 0.5.0.On each test, we use a model that already provide on each deepspeech version, and for the device that we use, we explain on the device section. On the experiment, we show the difference in memory usage, CPU and inference time, also how good each deepspeech version can recognize speech to text. On this experiment, we use the waterfall method, which suitable with this experiment, and we already know about the process of this stage, on the waterfall it has six steps that need doing there are :

  1. Requirements, on the requirements we collect for the initial phase, like make requirements document

  2. Analysis, for this stage, we make model and logic for the experiment.

  3. Design, this stage make technical design requirements, design the environment that suitable with each version of deepspeech and what environment that cant run on the deepspeech

  4. Coding, on this step, we are building some script that can capture the result when the experiment on running,

  5. Testing, on this stage we test our system, to search a bug or check if the system on experiment already meet our requirements

  6. The operation, the application that ready for doing on the experiment, on the operation we will get the result of each deep-speech

Module v0.1.0 v0.1.1 v0.6.0
Tensorflow 1.14.0 1.14.0 1.14.0
Numpy 1.15.4 1.16.5 1.17.4
Scipy 0.19.1 1.2.2 -
H5py 2.10.0 2.10.0 2.10.0
Deepspeech 0.1.0 0.1.1 0.6.0
Python 2.7 2.7 3.7
Table 4: Comparison Module on Each Version

Table 4 shows the difference and similarity of the module that installed on each version of deepspeech, and only deepspeech version 0.1.0 and 0.1.1 that have same python environment

5.1 Experiment Deepspeech v0.1.0

Experiment for deepspeech v0.1.0 , using python2.7 as environmnet, because it’s only compatible with python2.7, will failed and show some errors if using python3 because the version build on python2.7 environment.

Figure 2: Resource usage on deepspeech v0.1.0

On that Figure 1, show cpu resource usage will highly increase on 20 second and will reduce until 50 second, then will highly increase again until 250% before 60 second and then stable on 200% until inference process already done, on memorry usage, there is increasing from 0 to 800 MB , but in first process there are some spike on some seconds on the range 600 until 800 MB, inference time for one time process audio file is 102 second for 2 second audio file.

Figure 3: Inference time on deepspeech v0.1.0

For the inference time, it’s showing on Figure 2 ,loading time for model need up to 21 second until the result come out, and inference time need 102 second for 2 second audio file.

5.2 Experiment Deepspeech v0.1.1

On deepspeech v0.1.1 using python2,7 because its working well when running om python2.7 rather than on python3.

Figure 4: Resource usage on deepspeech v0.1.1

On the Figure 3,the graph show cpu and memory usage on time scale (second), there are some increasing for memory usage from 200 MB until 800 MB , also there are some spike during 20 second until 40 second for memory usage , and then memory usage stable until the inference was done. For cpu usage there are some increasing usage until 100% on 20 second and going down again on below 60 second, but cpu usage get increasing again until 250% on 60 second and become stable on 200% cpu usage until the inference was complete, on deepspeech v0.1.1 more better than deepspeech v0.1.0 , where deepspeech v0.1.1 more stable than preverious version, and there are some decreasing for time consuming.

Figure 5: Inference time on deepspeech v0.1.1

For the inference time, it’s showing on Figure 4 ,for loading model need up to 21 second, and inference time need 89 second for 2 second sound, 13 second more faster for inference.

5.3 Experiment Deepspeech v0.6.0

On new version of deepspeech v0.6.0 , it’s need to use python3 ,because many dependencies of python3 more stable and better than python2.

Figure 6: Resource usage on deepspeech v0.6.0

Figure 5 show, the cpu and memory consuming on the graph, that graph show more stable on cpu and memory usage , on cpu usage from 0 second there is an increasing from 0 to 100% and become stable until the inference completed, for memory usage there is an increasing from 100 MB to 200 MB until the inference already done, and only need 5 second to complete an inference.

Figure 7: Inference time on deepspeech v0.6.0

For the inference time it’s showing on Figure 6 , for loading model only need 0,0036 second and for inference time need for 7 second.

6 Conclusion

Deepspeech v0.6.0 have very good implementation for embedded device like raspberry pi which didn’t have enough power to doing some complex computational, but the increasing performance of inference time from loading model until the result show deepspeech get increasing performance on embedded device like raspberry pi, the difference performance of each deepspeech version show on this table :

Resource v0.1.0 v0.1.1 v0.6.0
CPU Usage ( % ) 250 250 100
Memory Usage ( MB ) 800 800 200
Processing Time ( s ) 102 100 5
Loading Model ( s ) 21 21 0,0036
Inference Time ( s ) 102 89 7
Table 5: Comparison Resource Usage of Each Version

On the table for maximum of cpu usage, for deepspeech v0.1.0 and deepspeech v0.1.1 still have same value on 250 % , but for deepspeech v0.6.0 cpu usage going down until 150% , and deepspeech v0.6.0 become more faster for processing. For maximum memory usage, deepspeech v0.1.0 and deepspeech v0.1.1 have same value on 800 MB , it’s need a huge memory consume for processing small audio file, and deepspeech v0.6.0 only consume 200 MB on peak time for processing same audio file on deepspeech v0.1.0 and deepspeech v0.1.1. Deepspeech v0.6.0 using less processing time, only need around 5 second, while deepspeech v0.1.0 need 102 second and deepspeech v0.1.1 need 100 second, this become deepspeech using less time and more faster in time sector. Time for loading model on deepspeech v0.6.0 is very fastly, only need 0,0036 second, while deepspeech v0.1.0 need 21 second and deepspeech v0.1.1 need 21 second.For inference time deepspeech v0.1.0 need 102 second to process , and deepspeech v0.1.1 more better which need 89 second, but deepspeech v0.6.0 only need 7 second to process same file with another deepspeech version. Based on the table 5 result and experiment that already done on raspeberry pi 3 , it’s show deepspeech v0.6.0 more faster and can be used on any device that have small computational power but enough to run computational algorithm, and no need internet connection for processing end-to-end speech to text.

Deepspech Result
v0.1.0 She had ye duck so ingrecy wachwor all year
v0.1.1 She had er duc suot an gresy wahorer all year
v0.6.0 She had adored water or
Table 6: Comparison Result of Deepspeech

After processing using each model for deepspeech version, on table 6, it shows the different result on each version of deepspeech. The host transcript is ”She had your dark suit in greasy wash water all year”, commonly all of deepspeech version successfully to process ”she had” words, only deepspeech version v0.1.0 and version 0.1.1 have the result near of host transcript.

References

  • [Amodei et al.2015] Dario Amodei, Sundaram Ananthanarayanan, Rishita Anubhai, Jingliang Bai, Eric Battenberg, Carl Case, Jared Casper, Bryan Catanzaro, Qiang Cheng, Guoliang Chen, Jie Chen, Jingdong Chen, Zhijie Chen, Mike Chrzanowski, Adam Coates, Greg Diamos, Ke Ding, Niandong Du, Erich Elsen, and Zhenyao Zhu. Deep speech 2: End-to-end speech recognition in english and mandarin. 12 2015.
  • [Ardila et al.2019] Rosana Ardila, Megan Branson, Kelly Davis, Michael Henretty, Michael Kohler, Josh Meyer, Reuben Morais, Lindsay Saunders, Francis Tyers, and Gregor Weber. Common voice: A massively-multilingual speech corpus. 12 2019.
  • [Baskar et al.2019] Murali Karthick Baskar, Shinji Watanabe, Ramon Astudillo, Takaaki Hori, Lukas Burget, and Jan Černocký. Semi-supervised sequence-to-sequence asr using unpaired speech and text. pages 3790–3794, 09 2019.
  • [Bekaroo and Santokhee2016] Girish Bekaroo and Aditya Santokhee. Power consumption of the raspberry pi: A comparative analysis. pages 361–366, 08 2016.
  • [Dittmer et al.2019] Soren Dittmer, Emily J., and Peter Maass. Singular values for relu layers. IEEE Transactions on Neural Networks and Learning Systems, PP:1–12, 11 2019.
  • [Dumpala et al.2019] Sri Harsha Dumpala, Imran Sheikh, Rupayan Chakraborty, and Sunil Kumar Kopparapu. A cycle-gan approach to model natural perturbations in speech for asr applications. 12 2019.
  • [Hannun et al.2014] Awni Y. Hannun, Carl Case, Jared Casper, Bryan Catanzaro, Greg Diamos, Erich Elsen, Ryan Prenger, Sanjeev Satheesh, Shubho Sengupta, Adam Coates, and Andrew Y. Ng. Deep speech: Scaling up end-to-end speech recognition. CoRR, abs/1412.5567, 2014.
  • [Iakushkin et al.2018] Oleg Iakushkin, George Fedoseev, Anna Shaleva, Alexander Degtyarev, and Olga Sedova. Russian-language speech recognition system based on deepspeech. 12 2018.
  • [Islam et al.2019] Mohaiminul Islam, Guorong Chen, and Shangzhu Jin. An overview of neural network. 5:05, 06 2019.
  • [Zeng et al.2019] Qiang Zeng, Jianhai Su, Chenglong Fu, Golam Kayas, Lannan Luo, Xiaojiang Du, Chiu Tan, and Jie Wu. A multiversion programming inspired approach to detecting audio adversarial examples. pages 39–51, 06 2019.