Fra*_*Boi 1 android kotlin android-studio tensorflow tensorflow-lite
我正在尝试运行这个应用程序,它是一个对象检测应用程序。该应用程序使用 Tensorflow-Lite。
尝试运行此应用程序时出现错误
Unresolved reference: setUseNNAPI
Run Code Online (Sandbox Code Playgroud)
对于这些线路
override fun setUseNNAPI(isChecked: Boolean) {
if (tfLite != null) tfLite!!.setUseNNAPI(isChecked)
}
Run Code Online (Sandbox Code Playgroud)
它找不到 的参考tfLite!!.setUseNNAPI(isChecked)。这个函数应该以某种方式连接到Interpreter选项,但这些是在create方法中设置的:
@Throws(IOException::class)
fun create(
assetManager: AssetManager,
modelFilename: String,
labelFilename: String,
inputSize: Int,
isQuantized: Boolean): Classifier {
...
try {
val options = Interpreter.Options()
options.setNumThreads(4)
options.setUseNNAPI(false)
d.tfLite = Interpreter(loadModelFile(assetManager, modelFilename), options)
} catch (e: Exception) {
throw RuntimeException(e)
}
Run Code Online (Sandbox Code Playgroud)
有没有人知道发生了什么?
小智 5
请检查应用程序的 build.gradle 文件。如果您看到以下行或版本低于 2.3.0 将其更新到最新版本
实现 'org.tensorflow:tensorflow-lite:0.0.0-nightly'
将其更改为
实现 'org.tensorflow:tensorflow-lite:2.3.0'
它不是在为 android 下载最新的 tensorflow-lite 版本。
希望这能解决您的问题
| 归档时间: |
|
| 查看次数: |
791 次 |
| 最近记录: |