【发布时间】:2020-05-26 15:03:34
【问题描述】:
尝试在 TensorFlow Lite's Object Detection Android Demo 上运行 tiny-yolov3 模型时遇到错误。 当我尝试在手机上运行应用程序时,应用程序崩溃并出现以下错误
E/AndroidRuntime: FATAL EXCEPTION: inference
Process: org.tensorflow.lite.examples.detection, PID: 5535
java.lang.IllegalArgumentException: Invalid output Tensor index: 1
at org.tensorflow.lite.NativeInterpreterWrapper.getOutputTensor(NativeInterpreterWrapper.java:292)
at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:166)
at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:314)
at org.tensorflow.lite.examples.detection.tflite.TFLiteObjectDetectionAPIModel.recognizeImage(TFLiteObjectDetectionAPIModel.java:204)
at org.tensorflow.lite.examples.detection.DetectorActivity$2.run(DetectorActivity.java:181)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.os.HandlerThread.run(HandlerThread.java:65)
Here 是我的 tflite 和标签文件。
我在 DetectorActivity.java 上更改了以下内容以避免出现this 错误
TF_OD_API_INPUT_SIZE from 300 to 416
TF_OD_API_IS_QUANTIZED from true to false
然后我在 TFLiteObjectDetectionAPIModel.java 上更改了以下内容
NUM_DETECTIONS from 10 to 2535
d.outputLocations = new float[1][NUM_DETECTIONS][4] to d.outputLocations = new float[1][NUM_DETECTIONS][7];
Here是我使用的 DetectorActivity.java 和 TFLiteObjectDetectionAPIModel.java
Here 是我的模型 .weight、cfg 和 .pb(如果需要)
任何帮助将不胜感激
【问题讨论】:
标签: android tensorflow tensorflow-lite