cloud-annotations / object-detection-android

📱 Custom Object Detection with TensorFlow Lite (not Real-Time)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

App Crashed showing this on logcat when i was trying to detect the image .

shivangipandey06 opened this issue · comments

Please help as i am new to this .

2020-05-26 13:24:56.935 11203-11203/android.example.com.tflitecamerademo E/AndroidRuntime: FATAL EXCEPTION: main
Process: android.example.com.tflitecamerademo, PID: 11203
java.lang.IllegalArgumentException: Cannot copy between a TensorFlowLite tensor with shape [1, 1917, 4] and a Java object with shape [1, 1917, 1, 4].
at org.tensorflow.lite.Tensor.throwIfShapeIsIncompatible(Tensor.java:412)
at org.tensorflow.lite.Tensor.throwIfDataIsIncompatible(Tensor.java:369)
at org.tensorflow.lite.Tensor.copyTo(Tensor.java:247)
at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:166)
at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:314)
at com.example.android.tflitecamerademo.ImageClassifier.classifyFrame(ImageClassifier.java:107)
at com.example.android.tflitecamerademo.CustomCameraFragment.lambda$new$0(CustomCameraFragment.java:109)
at com.example.android.tflitecamerademo.-$$Lambda$CustomCameraFragment$I_thQX2Vv8tCIzJNCQ28EJmbkMY.onClick(Unknown Source:2)
at android.view.View.performClick(View.java:6608)
at android.view.View.performClickInternal(View.java:6585)
at android.view.View.access$3100(View.java:785)
at android.view.View$PerformClick.run(View.java:25921)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6864)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)

Hmm looks like a bug on my end after an update, let me look into it

Does the error change if you update this line:

float[][][][] _boxPredictionsPointer_ = new float[1][NUM_ANCHORS][1][4];

To:


float[][][] _boxPredictionsPointer_ = new float[1][NUM_ANCHORS][4];

You’ll probably need to change other stuff too, but this should let me know if this is the underlying issue

i changed it but some more errors are coming related to it . Because of the errors i am unable to run the app.

I changed the line u said and i also changed some of the things and it worked fine . Thanks for the help

Great! Do you mind making a pull request with the changes?