Package: automatic-speech-recognition
Automatic Speech RecognitionThe project aim is to distill the Automatic Speech Recognition research.
At the beginning, you can load a ready-to-use pipeline with a pre-trained model.
Benefit from the eagerTensorFlow 2.0and freely monitor model weights, activations or gradients.importautomatic_speech_recognitionasasrfile='to/test/sample.wav'# sample rate 16 kHz, and 16 bit depthsample=asr.utils.read_audio(file)pipeline=asr.load('deepspeech2',lang='en')pipeline.model.summary()# TensorFlow modelsentences=pipeline.predict([sample])We support english (thanks toOpen Seq2Seq).
The evaluation results of the English benchmark LibriSpeech dev-clean are in the table.
To reference, the DeepSpeech (Mozilla) achieves around 7.5% WER, whereas the state-of-the-art (RWTH Aachen University) equals 2.3% WER
(recent evaluation results can be foundhere).
Both of them, use the external language model to boost results.
By comparison,humansachieve 5.83% WERhere(LibriSpeech dev-clean)Model NameDecoderWER-devdeepspeech2greedy6.71Shortly it turns out that you need to adjust pipeline a little bit.
Take a look at theCTC Pipeline.
The pipeline is responsible for connecting a neural network model
with all non-differential transformations (features extraction or prediction decoding).
Pipeline components are independent.
You can adjust them to your needs e.g. use more sophisticated feature extraction,
different data augmentation, or add the language model decoder (static n-grams or huge transformers).
You can do much more like distribute the training using theStrategy,
or experiment withmixed precisionpolicy.importnumpyasnpimporttensorflowastfimportautomatic_speech_recognitionasasrdataset=asr.dataset.Audio.from_csv('train.csv',batch_size=32)dev_dataset=asr.dataset.Audio.from_csv('dev.csv',batch_size=32)alphabet=asr.text.Alphabet(lang='en')features_extractor=asr.features.FilterBanks(features_num=160,winlen=0.02,winstep=0.01,winfunc=np.hanning)model=asr.model.get_deepspeech2(input_dim=160,output_dim=29,rnn_units=800,is_mixed_precision=False)optimizer=tf.optimizers.Adam(lr=1e-4,beta_1=0.9,beta_2=0.999,epsilon=1e-8)decoder=asr.decoder.GreedyDecoder()pipeline=asr.pipeline.CTCPipeline(alphabet,features_extractor,model,optimizer,decoder)pipeline.fit(dataset,dev_dataset,epochs=25)pipeline.save('/checkpoint')test_dataset=asr.dataset.Audio.from_csv('test.csv')wer,cer=asr.evaluate.calculate_error_rates(pipeline,test_dataset)print(f'WER:{wer}CER:{cer}')InstallationYou can use pip:pipinstallautomatic-speech-recognitionOtherwise clone the code and create a new environment viaconda:gitclonehttps://github.com/rolczynski/Automatic-Speech-Recognition.git
condaenvcreate-f=environment.yml# or use: environment-gpu.ymlcondaactivateAutomatic-Speech-RecognitionReferencesThe fundamental repositories:Baidu -DeepSpeech2 - A PaddlePaddle implementation of DeepSpeech2 architecture for ASRNVIDIA -Toolkit for efficient experimentation with Speech Recognition, Text2Speech and NLPRWTH Aachen University -The RWTH extensible training framework for universal recurrent neural networksTensorFlow -The implementation of DeepSpeech2 modelMozilla -DeepSpeech - A TensorFlow implementation of Baidu's DeepSpeech architectureEspnet -End-to-End Speech Processing ToolkitSean Naren -Speech Recognition using DeepSpeech2Moreover, you can explore the GitHub using key phrases likeASR,DeepSpeech, orSpeech-To-Text.
The listwer_are_we, an attempt at tracking states of the art,
can be helpful too.