【问题标题】:Converting Mozilla DeepSpeech model to use in tensorflow.js environment将 Mozilla DeepSpeech 模型转换为在 tensorflow.js 环境中使用
【发布时间】:2020-06-14 06:54:46
【问题描述】:

我一直在尝试在 ml5.js soundClassifier 层中转换 Mozilla Deepspeech 训练模型以用于 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 兼容,如果是,我缺少什么才能让这个东西正常工作。

【问题讨论】:

  • 注意:致 S.O.社区,我知道这在技术上不是一个编程问题。请注意,我之所以在此处发帖,是因为这是 TensorFlow 社区页面上指向的线程,用于在此页面上找到技术问题的答案(“获取帮助 => 技术问题”):tensorflow.org/community。请善待:-)。

标签: tensorflow tensorflow.js mozilla-deepspeech


【解决方案1】:

我相信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, AudioSpectrogram

TensorFlow.js 目前不支持BlockLSTMMfccAudioSpectrogram 操作,因此转换将失败:

【讨论】:

    猜你喜欢
    • 2020-01-15
    • 2021-11-28
    • 1970-01-01
    • 2020-10-29
    • 2021-09-12
    • 2018-11-08
    • 1970-01-01
    • 2021-02-15
    • 2020-04-17
    相关资源
    最近更新 更多