tensorflow / hub

A library for transfer learning by reusing parts of TensorFlow models.
https://tensorflow.org/hub
Apache License 2.0
3.48k stars 1.66k forks source link

Movenet does not work with android gpu delegate on unity. #801

Closed Igniscode closed 3 years ago

Igniscode commented 3 years ago

Movenet does not work with android gpu delegate on unity.

hello. I want to use movenet in unity android game.

for use tensorflow lite in android unity. I should import dynamic shared library .so files

so I refered https://github.com/asus4/tf-lite-unity-sample this project.

after I made tensorflow lite module for movenet I knew there is problem to use movenet with gpu delegate.

because, the module worked almost situation. for examples movenet + gpu + android not worked movenet + cpu + android worked movenet + gpu + windows worked movenet + cpu + windows worked posenet + gpu + android worked posenet + cpu + android worked posenet + gpu + windows worked posenet + cpu + windows worked

I used https://tfhub.dev/google/lite-model/movenet/singlepose/lightning/tflite/float16/4 version of movenet model. and I used posenet model in asus4's repository

tensorflow version is 2.6.0.

yuhuichen1015 commented 3 years ago

Thanks for reporting the issue. Could you share a bit more information about what you mean by "not worked"? e.g. did you get an error message and the model doesn't run? Or does the model run but at unexpectedly slow speed or produce low quality predictions?

We have an example of using MoveNet on Pixel 5 (Android) with GPU. You can also check the speed/accuracy comparison in the blogpost. Thanks.

Igniscode commented 3 years ago

Thanks for reporting the issue. Could you share a bit more information about what you mean by "not worked"? e.g. did you get an error message and the model doesn't run? Or does the model run but at unexpectedly slow speed or produce low quality predictions?

We have an example of using MoveNet on Pixel 5 (Android) with GPU. You can also check the speed/accuracy comparison in the blogpost. Thanks.

Thank you for your response.

"not worked" means the app has been shut down. without any error message.

your example is working for me. (Galaxy Note 10) so I'm guessing there is something problem with built gpu delegate .so file

yuhuichen1015 commented 3 years ago

Thanks for your clarifications. Is the current situation that you were able to run the model normally with the example I shared on Android (Galaxy Note 10)? Does the same example and model work on your target device (is it Asus 4)? or you are already unblocked by the example?

Igniscode commented 3 years ago

Thanks for your clarifications. Is the current situation that you were able to run the model normally with the example I shared on Android (Galaxy Note 10)? Does the same example and model work on your target device (is it Asus 4)? or you are already unblocked by the example?

The "Asus4" is user name of this repositoryhttps://github.com/asus4/tf-lite-unity-sample that I referenced. Sorry to make you confused. You know, There is two way for using tensorflow lite in android.

  1. using aar file( in your example )
  2. using so file( in my project ) the issue is occurred when using so file.

and your example use tensorflow 2.5.0 and I'm using tensorflow 2.6.0. I'm not sure. If it is related with this problem.

What I learned from your example, it seems that this problem is likely related to the android gpu delegate rather than the problem with movenet itself.

Anyway if you have any idea about this issue, give me a mention or not, you can close this issue thread.

lu-wang-g commented 3 years ago

@Igniscode can you please point to the code of the following items:

  1. How you created the Interpreter with delegate
  2. The gradle file that you linked the .so file.
  3. How you build the .so file?

Thanks!