我一直在尝试转换一个经过Mozilla训练的模型,以便在ml5.js tensorflow.js层中使用。我的理解是Mozilla DeepSpeech使用TensorFlow。我一直在试图遵循以下提示:
https://www.tensorflow.org/js/tutorials/conversion/import_saved_model
https://www.tensorflow.org/js/guide/conversion
tensorflowjs_converter --help
我从这里下载了DeepSpeech模型:
https://github.com/mozilla/DeepSpeech/releases/download/v0.6.1/deepspeech-0.6.1-models.tar.gz
打开包装后,可以找到下列文件:
lm.binary output_graph.pb output_graph.pbmm output_graph.tflite trie
我尝试运行以下命令:
tensorflowjs_converter --output_format=tfjs_graph_model --saved_model_tags=serve deep/ tensorflow.js/
和变体来进行转换。tensorflow.js/是我创建的目录,deep/是包含DeepSpeech模型文件的目录(上面列出了这些文件)。
我得到了错误:
SavedModel file does not exist at: deep/saved_model.pb/{saved_model.pbtxt|saved_model.pb}
我把output_graph.pb改名为saved_model.pb。
首先,我想知道DeepSpeech模型是否与tensorflowjs_converter兼容,如果是的话,我缺少什么才能让这个东西正常工作。
发布于 2020-03-02 16:08:27
我相信output_graph.pb是一个冻结的模型。在这种情况下,您需要像这样运行转换器:
tensorflowjs_converter \
--input_format=tf_frozen_model \
--output_node_names='logits' \
deepspeech/output_graph.pb \
tensorflowjs但是,这样做会导致以下错误:
ValueError: Unsupported Ops in the model before optimization
BlockLSTM, Mfcc, AudioSpectrogramBlockLSTM、Mfcc和AudioSpectrogram操作目前不受TensorFlow.js支持,因此转换将失败:
https://stackoverflow.com/questions/60481035
复制相似问题