I trained yolov4 on custom dataset containing two classes for object detection. I then saved the resulting weights to a tensorflow model ( the size of the model was 244.4 Mo) and converted it to tflite model ( the size decreased by half). When i tried implementing the tflite model in my flutter app, i got these error:
E/AndroidRuntime(12306): Caused by: java.lang.IllegalArgumentException: Cannot copy from a TensorFlowLite tensor (Identity) with shape [1, 10647, 4] to a Java object with shape [1, 13, 13, 35].
E/AndroidRuntime(12306): at org.tensorflow.lite.Tensor.throwIfDstShapeIsIncompatible(Tensor.java:485)
E/AndroidRuntime(12306): at org.tensorflow.lite.Tensor.copyTo(Tensor.java:255)
E/AndroidRuntime(12306): at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:216)
E/AndroidRuntime(12306): at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:374)
E/AndroidRuntime(12306): at org.tensorflow.lite.Interpreter.run(Interpreter.java:332)
E/AndroidRuntime(12306): at sq.flutter.tflite.TflitePlugin$RunYOLO.runTflite(TflitePlugin.java:759)
E/AndroidRuntime(12306): at sq.flutter.tflite.TflitePlugin$TfliteTask.doInBackground(TflitePlugin.java:471)
E/AndroidRuntime(12306): at sq.flutter.tflite.TflitePlugin$TfliteTask.doInBackground(TflitePlugin.java:445)
E/AndroidRuntime(12306): at android.os.AsyncTask$2.call(AsyncTask.java:305)
E/AndroidRuntime(12306): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
I don't really understand how to get the tensor shape ? and what is meant by java object with shape [1, 13, 13, 35] ? is it the detection result ?
I trained yolov4 on custom dataset containing two classes for object detection. I then saved the resulting weights to a tensorflow model ( the size of the model was 244.4 Mo) and converted it to tflite model ( the size decreased by half). When i tried implementing the tflite model in my flutter app, i got these error: E/AndroidRuntime(12306): Caused by: java.lang.IllegalArgumentException: Cannot copy from a TensorFlowLite tensor (Identity) with shape [1, 10647, 4] to a Java object with shape [1, 13, 13, 35]. E/AndroidRuntime(12306): at org.tensorflow.lite.Tensor.throwIfDstShapeIsIncompatible(Tensor.java:485) E/AndroidRuntime(12306): at org.tensorflow.lite.Tensor.copyTo(Tensor.java:255) E/AndroidRuntime(12306): at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:216) E/AndroidRuntime(12306): at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:374) E/AndroidRuntime(12306): at org.tensorflow.lite.Interpreter.run(Interpreter.java:332) E/AndroidRuntime(12306): at sq.flutter.tflite.TflitePlugin$RunYOLO.runTflite(TflitePlugin.java:759) E/AndroidRuntime(12306): at sq.flutter.tflite.TflitePlugin$TfliteTask.doInBackground(TflitePlugin.java:471) E/AndroidRuntime(12306): at sq.flutter.tflite.TflitePlugin$TfliteTask.doInBackground(TflitePlugin.java:445) E/AndroidRuntime(12306): at android.os.AsyncTask$2.call(AsyncTask.java:305) E/AndroidRuntime(12306): at java.util.concurrent.FutureTask.run(FutureTask.java:237) I don't really understand how to get the tensor shape ? and what is meant by java object with shape [1, 13, 13, 35] ? is it the detection result ?