3

I have been attempting to convert a Mozilla Deepspeech trained model for use in tensorflow.js, in ml5.js soundClassifier layer. My understanding is that Mozilla DeepSpeech uses TensorFlow. I have been trying to follow the hints found here:

https://www.tensorflow.org/js/tutorials/conversion/import_saved_model

https://www.tensorflow.org/js/guide/conversion

tensorflowjs_converter --help

I have downloaded the DeepSpeech model from here:

https://github.com/mozilla/DeepSpeech/releases/download/v0.6.1/deepspeech-0.6.1-models.tar.gz

and after unpacking, the following files are found:

lm.binary output_graph.pb output_graph.pbmm output_graph.tflite trie

I have attempted to run commands such as:

tensorflowjs_converter --output_format=tfjs_graph_model --saved_model_tags=serve deep/ tensorflow.js/

and variations to do the conversion. tensorflow.js/ is a directory I created, deep/ is the directory containing the DeepSpeech model files (which are listed above.)

I get error:

SavedModel file does not exist at: deep/saved_model.pb/{saved_model.pbtxt|saved_model.pb}

I renamed, eg, output_graph.pb to saved_model.pb.

Firstly, I would like to know if the DeepSpeech model is even compatible with the tensorflowjs_converter, and if so, what am I missing to get this thing working.

KevinHJ
  • 1,014
  • 11
  • 24
  • NOTE: To the S.O. community, I know that this is not technically a programming question. Please note that I am only posting here because this is the thread pointed to on the TensorFlow community page for getting technical questions answered ("Get Help => Technical Questions") found on this page: https://www.tensorflow.org/community. Please be kind :-). – KevinHJ Mar 02 '20 at 00:22

1 Answers1

2

i believe the output_graph.pb is a frozen model. in which case, you would need to run the converter like such:

tensorflowjs_converter \
    --input_format=tf_frozen_model \
    --output_node_names='logits' \
    deepspeech/output_graph.pb \
    tensorflowjs

however, doing this results in the following error:

ValueError: Unsupported Ops in the model before optimization
BlockLSTM, Mfcc, AudioSpectrogram

the operations BlockLSTM, Mfcc, and AudioSpectrogram are currently not supported by TensorFlow.js so the conversion will fail:

vabarbosa
  • 706
  • 1
  • 4
  • 9