【发布时间】:2021-02-09 20:34:31
【问题描述】:
拜托,我急需帮助,已经尝试解决这个问题 10 天了。我训练的 TensorFlow lite 模型在这里。我运行了 python 推理测试并且它有效。但是,它无法在此处的 Android 示例对象检测应用程序上运行 https://github.com/tensorflow/examples/tree/master/lite/examples/object_detection/android
通过调试这么长的问题modelHandle = createModelWithBuffer(this.modelByteBuffer, errorHandle); specifically this part in NativeInterpreterWrapper.class
NativeInterpreterWrapper(ByteBuffer buffer, Options options) {
this.inferenceDurationNanoseconds = -1L;
this.isMemoryAllocated = false;
this.delegates = new ArrayList();
this.ownedDelegates = new ArrayList();
TensorFlowLite.init();
if (buffer != null && (buffer instanceof MappedByteBuffer || buffer.isDirect() && buffer.order() == ByteOrder.nativeOrder())) {
this.modelByteBuffer = buffer;
long errorHandle = createErrorReporter(512);
long modelHandle = createModelWithBuffer(this.modelByteBuffer, errorHandle);
this.init(errorHandle, modelHandle, options);
} else {
throw new IllegalArgumentException("Model ByteBuffer should be either a MappedByteBuffer of the model file, or a direct ByteBuffer using ByteOrder.nativeOrder() which contains bytes of model content.");
}
}
系统信息
我是否编写了自定义代码(而不是使用 TensorFlow 中提供的股票示例脚本): 操作系统平台 MACOS sieera 10.13 安卓工作室 4 我已经尝试了所有可能的解决方案并更新了 NDK 我在 Gradle 中使用过
buildscript {
repositories {
google()
jcenter()
mavenLocal()
}
aaptOptions {
noCompress "tflite"
noCompress "lite"
}
implementation 'org.tensorflow:tensorflow-lite-metadata:0.0.0-nightly'
implementation 'org.tensorflow:tensorflow-lite-select-tf-ops:0.0.0-nightly'
also tried
implementation 'org.tensorflow:tensorflow-lite-metadata:0.1.2-nightly' and no difference
请帮帮我,我不知道是文件本身还是android库。
【问题讨论】:
-
在此处发布错误。
标签: android gradle exception object-detection tensorflow-lite