TFLite Example app Crashes with Android NPU

Which version of system do you use? Khadas official images, self built images, or others?

I’m using an Android self built Images, with no changes, just a fresh sync and built Image.

Please describe your issue below:

I’m trying to run some TensorFlow Lite Examples, like Style Transfer, and I’m getting an error related to NN API Node.

Post a console log of your issue below:

FATAL EXCEPTION: main
    Process: org.tensorflow.lite.examples.styletransfer, PID: 4680
    java.lang.IllegalArgumentException: Internal error: Failed to run on the given Interpreter: NN API returned error ANEURALNETWORKS_OP_FAILED at line 5115 while running computation.
    
    Node number 295 (TfLiteNnapiDelegate) failed to invoke.
    	at org.tensorflow.lite.NativeInterpreterWrapper.run(Native Method)
    	at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:249)
    	at org.tensorflow.lite.InterpreterImpl.runForMultipleInputsOutputs(InterpreterImpl.java:133)
    	at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:80)
    	at org.tensorflow.lite.examples.styletransfer.StyleTransferHelper.transfer(StyleTransferHelper.kt:169)
    	at org.tensorflow.lite.examples.styletransfer.fragments.TransformationFragment.onViewCreated$lambda-5$lambda-4(TransformationFragment.kt:125)
    	at org.tensorflow.lite.examples.styletransfer.fragments.TransformationFragment.$r8$lambda$XvvVhA-miRNwMqzLN3PhXf30Y0g(Unknown Source:0)
    	at org.tensorflow.lite.examples.styletransfer.fragments.TransformationFragment$$ExternalSyntheticLambda0.onClick(Unknown Source:4)
    	at android.view.View.performClick(View.java:7448)
    	at android.view.View.performClickInternal(View.java:7425)
    	at android.view.View.access$3600(View.java:810)
    	at android.view.View$PerformClick.run(View.java:28305)
    	at android.os.Handler.handleCallback(Handler.java:938)
    	at android.os.Handler.dispatchMessage(Handler.java:99)
    	at android.os.Looper.loop(Looper.java:223)
    	at android.app.ActivityThread.main(ActivityThread.java:7664)
    	at java.lang.reflect.Method.invoke(Native Method)
    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)

hi @Gustavo_Ferreira_Pal
Can you share your project and generated APK?
I can’t compile the code I downloaded from github.

HI @william.lin, here is the compiled app and the source code.
For some reason the Gradle version used in this project is wrong, switching the project graddle version back to 7.3.3, it compiles without problems.

Appreciate your help.

Best,
Gustavo

HI @william.lin, I give you permission to access the repo, sorry, i forgot to do it yesterday. Thanks in advance for your help

We have modified the graddle version and it can compile normally now. The phenomenon is the same as what you said, an error occurred.
Perhaps our group needs some time to analyze.