[英]Tensorflow Lite Custom Object detection Model Error in Android app
could you please help to solve this error?你能帮忙解决这个错误吗?
I am testing a custom Object Detection model using TensorFlow Lite in Android App according to the documentation, but I have an error when the library tries to recognize an image. I am testing a custom Object Detection model using TensorFlow Lite in Android App according to the documentation, but I have an error when the library tries to recognize an image.
I am using the Tensorflow lite sample app: https://github.com/tensorflow/examples/tree/master/lite/examples/object_detection/android我正在使用 Tensorflow lite 示例应用程序: https://github.com/tensorflow/examples/tree/master/lite/examples/object_detection/android
Using Task Library: https://www.tensorflow.org/lite/inference_with_metadata/task_library/object_detector
使用任务库: https://www.tensorflow.org/lite/inference_with_metadata/task_library/object_detector
dependency version implementation 'org.tensorflow:tensorflow-lite-task-vision:0.1.0'
依赖版本implementation 'org.tensorflow:tensorflow-lite-task-vision:0.1.0'
When this method is executed, this error is obtained:执行此方法时,会出现此错误:
method List<Detection> results = objectDetector.detect(TensorImage.fromBitmap(bitmap));
方法List<Detection> results = objectDetector.detect(TensorImage.fromBitmap(bitmap));
error错误
Abort message: 'JNI DETECTED ERROR IN APPLICATION: JNI NewStringUTF called with pending exception java.lang.NoSuchMethodError: no static method Lorg/tensorflow/lite/support/label/Category;.create(Ljava/lang/String;Ljava/lang/String;F)Lorg/tensorflow/lite/support/label/Category;"
at java.util.List org.tensorflow.lite.task.vision.detector.ObjectDetector.detectNative(long, java.nio.ByteBuffer, int, int, int) (ObjectDetector.java:-2)
at java.util.List org.tensorflow.lite.task.vision.detector.ObjectDetector.detect(org.tensorflow.lite.support.image.TensorImage, org.tensorflow.lite.task.core.vision.ImageProcessingOptions) (ObjectDetector.java:312)
at java.util.List org.tensorflow.lite.task.vision.detector.ObjectDetector.detect(org.tensorflow.lite.support.image.TensorImage) (ObjectDetector.java:292)
at java.util.List org.tensorflow.lite.examples.detection.tflite.TFLiteObjectDetectionAPIModel.recognizeImage(android.graphics.Bitmap) (TFLiteObjectDetectionAPIModel.java:87)
at void org.tensorflow.lite.examples.detection.DetectorActivity$2.run() (DetectorActivity.java:187)
at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:938)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:99)
at void android.os.Looper.loop() (Looper.java:223)
at void android.os.HandlerThread.run() (HandlerThread.java:67)
in call to NewStringUTF
from java.util.List org.tensorflow.lite.task.vision.detector.ObjectDetector.detectNative(long, java.nio.ByteBuffer, int, int, int)'```
This issue has been fixed in the Jan, 2021, which is not included in 0.1.0.此问题已在 2021 年 1 月修复,不包含在 0.1.0 中。 Please try the nightly version from Jcenter (not Maven), and see if it works.请尝试 Jcenter(不是 Maven)的夜间版本,看看它是否有效。
org.tensorflow:tensorflow-lite-task-vision:0.0.0-nightly-SNAPSHOT
And we'll release a new stable version very soon in April.我们很快就会在四月发布一个新的稳定版本。 Please stay tuned!敬请期待!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.