I'm developing a sign language realtime object detection using Tensorflow and Flutter. I trained the model by following this tutorial with ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8. I've converted the model from saved_model to tflite using the export_tflite_graph_tf2.py and this comment here for the tflite conversion. I implemented the model using the flutter tflite plugin and when I ran the app, it showed this error.
Caused by: java.lang.IllegalArgumentException: Cannot copy from a TensorFlowLite tensor (StatefulPartitionedCall:1) with shape [1, 10] to a Java object with shape [1, 10, 4].
E/AndroidRuntime( 5724): at org.tensorflow.lite.TensorImpl.throwIfDstShapeIsIncompatible(TensorImpl.java:456)
E/AndroidRuntime( 5724): at org.tensorflow.lite.TensorImpl.copyTo(TensorImpl.java:215)
E/AndroidRuntime( 5724): at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:250)
E/AndroidRuntime( 5724): at org.tensorflow.lite.InterpreterImpl.runForMultipleInputsOutputs(InterpreterImpl.java:135)
E/AndroidRuntime( 5724): at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:80)
E/AndroidRuntime( 5724): at sq.flutter.tflite.TflitePlugin$RunSSDMobileNet.runTflite(TflitePlugin.java:674)
E/AndroidRuntime( 5724): at sq.flutter.tflite.TflitePlugin$TfliteTask.doInBackground(TflitePlugin.java:471)
E/AndroidRuntime( 5724): at sq.flutter.tflite.TflitePlugin$TfliteTask.doInBackground(TflitePlugin.java:445)
E/AndroidRuntime( 5724): at android.os.AsyncTask$2.call(AsyncTask.java:333)
E/AndroidRuntime( 5724): at java.util.concurrent.FutureTask.run(FutureTask.java:266)
E/AndroidRuntime( 5724): ... 4 more
I've been having the same problem for a week and I really need it done. I haven't found anything that can fix it. The solution others provided were changing the input tensors and I don't know how to change it.
If anyone need the model, please do comment. I'll update the question with the link for the tflite model.