OGeek|极客世界-中国程序员成长平台

标题: ios - TensorFlow-Lite Swift 设置(bridge-header/includes/root 文件夹) [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:19
标题: ios - TensorFlow-Lite Swift 设置(bridge-header/includes/root 文件夹)

TensorFlow Lite 最近发布了。代码库带有 demo ios application .

我想创建/运行相同的应用程序,但使用 Swift。我已按照以下步骤操作:

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/g3doc/ios.md#using-in-your-own-application

这还不够。

1) 我认为我现在缺少的是一些桥接头。

2) 我也不确定这些特定的 Obj-C 包含在 swift 中的外观:

#include "tensorflow/contrib/lite/kernels/register.h"
#include "tensorflow/contrib/lite/model.h"
#include "tensorflow/contrib/lite/string_util.h"
#include "tensorflow/contrib/lite/tools/mutable_op_resolver.h"

3) 打包好的ios app必须要包含TensorFlow根目录(200+mb)吗?



Best Answer-推荐答案


目前,您需要从 Objective-C++ 调用 TFLite C++ API。您可以制作一个精简的 Objective-C++ 类来调用 TFLite,并在 Swift 中使用它。

future 可能会提供更多语言支持。

对于问题(3),编译后的库只有几百字节。查看 tensorflow/contrib/lite/build_ios_universal_lib.sh 构建的库。

关于ios - TensorFlow-Lite Swift 设置(bridge-header/includes/root 文件夹),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47355595/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4