asus4 / tf-lite-unity-sample

TensorFlow Lite Samples on Unity
861 stars 252 forks source link

Accelerator compatibility issue on Android phones #308

Closed adfansong closed 1 year ago

adfansong commented 1 year ago

Environment:

Describe the bug Running the MoveNetMultiPoseSample on Android devices.

Accelerator=XNNPACK Best compatibility. But slow on some devices (Honor Play6T,android 11 ; Honor 9X pro,android 9..). When running on these devices, the invoke method costs 400MS at first. After I turn the app to background, and then resume to foreground, the invoke costs less than 200MS and it's OK. (Or just show permission dialogue, and close it.. same effect.)

I tried to call mUnityPlayer.pause and resume, but no effects.

Since there're no replies, I tried to believe the official libs must be right. And the author here is just using their libs. So I tried to set XNNPackDelegate.Options.numThreads from max to -1. It solved my issues, those slow devices ran fast now.

Accelerator=NNAPI incompatible device (can't open sample): MI 5X,android 8.1 (as NNAPI only supports >= android 8.1) init slow devices: Honor 70PRO (costs 10S to load the sample, TfLiteInterpreterCreate is too expensive)

Accelerator=GPU crash devices: MI 5X,android 8.1; Honor Play6T,android 11 I tried to add 'uses-native-library', but it still crashed.

I tried to run the official 'tensorflow\example\examples-lite-examples-pose_estimation', it says multipose does not support GPU.

Accelerator=NONE Best compatibility, but slow.

Expected behavior more compatible to be used in a production

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.