FilippoAleotti / mobilePydnet

Pydnet on mobile devices
Apache License 2.0
253 stars 40 forks source link

Crash Unexpected failure when preparing tensor allocations - Android 10 (Mi 9T) #27

Open onurays opened 4 years ago

onurays commented 4 years ago

Crashing at startup:

2020-08-23 14:01:54.068 3006-3124/unibo.cvlab.pydnet_tflite E/AndroidRuntime: FATAL EXCEPTION: inference
    Process: unibo.cvlab.pydnet_tflite, PID: 3006
    java.lang.IllegalStateException: Internal error: Unexpected failure when preparing tensor allocations: tensorflow/lite/kernels/conv.cc:313 input->dims->size != 4 (1 != 4)
    Node number 0 (CONV_2D) failed to prepare.

        at org.tensorflow.lite.NativeInterpreterWrapper.allocateTensors(Native Method)
        at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:149)
        at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:343)
        at org.tensorflow.lite.Interpreter.run(Interpreter.java:304)
        at unibo.cvlab.pydnet.Model.doInference(Model.java:89)
        at unibo.cvlab.pydnet.StreamActivity.doInference(StreamActivity.java:131)
        at unibo.cvlab.pydnet.StreamActivity.access$200(StreamActivity.java:26)
        at unibo.cvlab.pydnet.StreamActivity$2.run(StreamActivity.java:122)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:224)
        at android.os.HandlerThread.run(HandlerThread.java:67)
onurays commented 4 years ago

First of all, you need add:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

watchman94 commented 4 years ago

The problem still exists.

FilippoAleotti commented 4 years ago

Hi, I guess you are using the previous version of the code in this repo, have you tried to update the tf-interpreter version? Maybe it is too old

onurays commented 4 years ago

Hi, I guess you are using the previous version of the code in this repo, have you tried to update the tf-interpreter version? Maybe it is too old

I am using the latest version of the tflite branch. I both tried with several versions of tensorflow-lite including nightly. tf-interpreter is a part of tensorflow-lite, right?

FilippoAleotti commented 4 years ago

And about the code? I guess you are you using the android code from the previous version, but are you loading the new or the old checkpoint?

watchman94 commented 4 years ago

Yes, The master branch can work.

Filippo Aleotti notifications@github.com 于2020年8月25日周二 下午11:07写道:

And about the code? I guess you are you using the android code from the previous version, but are you loading the new or the old checkpoint?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/FilippoAleotti/mobilePydnet/issues/27#issuecomment-680083268, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP4AVDVTO7EQ4VP7PRUCFXTSCPHRTANCNFSM4QITK3EA .

FilippoAleotti commented 4 years ago

I mean, in the tflite branch which model are you trying to load? The pydnet++ (the one included in that branch) or the new one?

onurays commented 4 years ago

The tflite branch has already its own model. I both used it and tried to generate a new one with the script in the branch. I also tried to use scripts under the master branch and I did all of these tests with different tensorflow versions. Are you planning to update the model and scripts in this branch?