gpt4 book ai didi

ios - 在 iOS 上使用 TensorFlow 音频识别模型

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:21:47 24 4
gpt4 key购买 nike

我正在尝试在 iOS 上使用 TensorFlow 音频识别模型(my_frozen_graph.pb,在此处生成:https://www.tensorflow.org/tutorials/audio_recognition)。

但 TensorFlow Mobile 的 tf_simple_example 项目中的 iOS 代码 NSString* network_path = FilePathForResourceName(@"my_frozen_graph", @"pb"); 输出此错误消息:无法创建 TensorFlow Graph:未找到:操作类型未注册“DecodeWav”

有人知道我该如何解决这个问题吗?谢谢!

最佳答案

我相信您使用的是 Cocapods 的预构建 Tensorflow?它可能没有那种操作类型,所以你应该从最新的源代码中自己构建它。

来自 documentation :

While Cocapods is the quickest and easiest way of getting started, you sometimes need more flexibility to determine which parts of TensorFlow your app should be shipped with. For such cases, you can build the iOS libraries from the sources. This guide contains detailed instructions on how to do that.

这也可能有帮助:[iOS] Add optional Selective Registration of Ops #14421

Optimization

The build_all_ios.sh script can take optional command-line arguments to selectively register only for the operators used in your graph.

tensorflow/contrib/makefile/build_all_ios.sh -a arm64 -g $HOME/graphs/inception/tensorflow_inception_graph.pb

Please note this is an aggresive optimization of the operators and the resulting library may not work with other graphs but will reduce the size of the final library.

构建完成后,您可以检查 /tensorflow/tensorflow/core/framework/ops_to_register.h 以查找已注册的操作。 (在构建过程中使用 -g 标志自动生成)

关于ios - 在 iOS 上使用 TensorFlow 音频识别模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47878659/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com