菜鸟教程小白 发表于 2022-12-11 19:19:43

ios - TensorFlow-Lite Swift 设置(bridge-header/includes/root 文件夹)


                                            <p><p>TensorFlow Lite 最近发布了。代码库带有 <a href="https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/examples/ios/simple" rel="noreferrer noopener nofollow">demo ios application</a> .</p>

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

<p> <a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/g3doc/ios.md#using-in-your-own-application" rel="noreferrer noopener nofollow">https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/g3doc/ios.md#using-in-your-own-application</a> </p>

<p>这还不够。</p>

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

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

<pre><code>#include &#34;tensorflow/contrib/lite/kernels/register.h&#34;
#include &#34;tensorflow/contrib/lite/model.h&#34;
#include &#34;tensorflow/contrib/lite/string_util.h&#34;
#include &#34;tensorflow/contrib/lite/tools/mutable_op_resolver.h&#34;
</code></pre>

<p>3) 打包好的ios app必须要包含TensorFlow根目录(200+mb)吗?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>目前,您需要从 Objective-C++ 调用 TFLite C++ API。您可以制作一个精简的 Objective-C++ 类来调用 TFLite,并在 Swift 中使用它。</p>

<p> future 可能会提供更多语言支持。 </p>

<p>对于问题(3),编译后的库只有几百字节。查看 <code>tensorflow/contrib/lite/build_ios_universal_lib.sh</code> 构建的库。 </p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - TensorFlow-Lite Swift 设置(bridge-header/includes/root 文件夹),我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/47355595/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/47355595/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - TensorFlow-Lite Swift 设置(bridge-header/includes/root 文件夹)