android - TFlite 和 Android Studio - 使用浮点模型进行推理
问题描述
我想将一个非量化的 TFlite 模型(数据类型为 float32)部署到 android studio,但我不知道如何定义 de bytebuffer 进行推理。当我在 Android Studio 中加载模型时,我得到以下建议:
val model = Model.newInstance(context)
// Creates inputs for reference.
val inputFeature0 = TensorBuffer.createFixedSize(intArrayOf(1, 256, 256, 3), DataType.FLOAT32)
inputFeature0.loadBuffer(byteBuffer)
// Runs model inference and gets result.
val outputs = model.process(inputFeature0)
val outputFeature0 = outputs.outputFeature0AsTensorBuffer
// Releases model resources if no longer used.
model.close()
但是,没有定义 bytebuffer,我也不知道怎么做。目前我只看到人们直接为 Int8 模型定义它。
非常感谢。
解决方案
推荐阅读
- angular - Angular Google Maps 模块在本地渲染,但不在生产环境中
- java -
要么被声明为抽象,要么在中实现抽象方法 onBindViewHolder(VH,int) - node.js - 为什么会发生这种情况,res.redirect() 方法的范围仅限于 express 中的 findByIdAndRemove 方法
- spring-boot - Spring boot千分尺datadog套接字连接错误
- node.js - 使用 res.redirect() 时,带有 Express 的 Node.js 不会重定向到外部 URL
- selenium - selenium 错误 WebDriverException:未知错误:asp 核心中没有 chrome 二进制文件
- r - 与其他方法相比,使用 Caret 包的 KNN 给出了不好的结果
- javascript - .bind this 在类方法中
- java - Java JFrame 意外地奇怪地删除组件
- r - 在 Google Colab 中,您如何在 Google Drive 中找到文件的路径。我正在使用 R