我正在尝试在 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”
。
有人知道我该如何解决这个问题吗?谢谢!
我相信您使用的是 Cocopods 的预构建 Tensorflow?它可能没有那种 op 类型,所以你应该从最新的源代码自己构建它。
来自 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/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |