美文网首页
Cannot copy to a TensorFlowLite

Cannot copy to a TensorFlowLite

作者: XBruce | 来源:发表于2020-12-03 13:40 被阅读0次

    2020-07-12 18:03:05.160 14845-14883/? E/AndroidRuntime: FATAL EXCEPTION: inference
    Process: org.tensorflow.lite.examples.detection, PID: 14845
    java.lang.IllegalArgumentException: Cannot copy to a TensorFlowLite tensor (normalized_input_image_tensor) with 307200 bytes from a Java Buffer with 4320000 bytes.
    at org.tensorflow.lite.Tensor.throwIfSrcShapeIsIncompatible(Tensor.java:423)
    at org.tensorflow.lite.Tensor.setTo(Tensor.java:189)
    at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:154)
    at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:343)
    at org.tensorflow.lite.examples.detection.tflite.TFLiteObjectDetectionAPIModel.recognizeImage(TFLiteObjectDetectionAPIModel.java:197)
    at org.tensorflow.lite.examples.detection.DetectorActivity$2.run(DetectorActivity.java:182)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:214)
    at android.os.HandlerThread.run(HandlerThread.java:67)

    出现这一错误的原因是输入的数据格式,并不匹配model训练时要求的输入格式导致的,如果要查看model的格式,可以借助https://netron.app/

    相关文章

      网友评论

          本文标题:Cannot copy to a TensorFlowLite

          本文链接:https://www.haomeiwen.com/subject/sdemwktx.html