Pun*_*nny 14 android kotlin tensorflow-lite
所以我尝试在 Android 应用程序上使用 Tensorflow Lite。相机拍摄图像时调用以下代码:
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
val bitmap = data!!.extras!!.get("data") as Bitmap
val tensorImage = imageProcessor.process(TensorImage(DataType.UINT8).apply { load(bitmap) })
val outputs = model.process(tensorImage.tensorBuffer)
val buffer = outputs.outputFeature0AsTensorBuffer
val prediction = buffer.floatArray
debug { "$prediction" }
}
}
Run Code Online (Sandbox Code Playgroud)
但是,执行该行后val outputs = model.process(tensorImage.tensorBuffer),出现错误消息
E/libc: Access denied finding property "ro.hardware.chipname"
弹出。我不知道该消息的含义(即使在谷歌搜索之后),而且我似乎找不到合适的权限来允许这样做。非常感谢任何提前的帮助。
小智 1
当我尝试在小米红米 K30 Pro(Snapdragon 865)上使用 NNAPI 时,我在 flutter/dart 项目中确实遇到了同样的问题。到目前为止,还没有这方面的具体信息。我发现的几页可能与它有关:
https://github.com/tensorflow/models/issues/7887
https://github.com/tensorflow/tensorflow/issues/45847
| 归档时间: |
|
| 查看次数: |
4337 次 |
| 最近记录: |