Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build for Android ARMv7 #11

Closed
marimomo00 opened this issue Apr 6, 2020 · 12 comments · Fixed by #228
Closed

Build for Android ARMv7 #11

marimomo00 opened this issue Apr 6, 2020 · 12 comments · Fixed by #228
Assignees
Labels
Android enhancement New feature or request

Comments

@marimomo00
Copy link

Thanks for the sample project. It helps me a lot.

I'm new to building App on Unity. I'm really need help from you.
I'm trying to build the sample of Posenet for Android. I can build the Android App with ARM64, it works very well on my mobile. However, it doesn't work on my another android phone. So I tried to build with ARMv7 support. It built successfully but it runs with error. The error is,

AndroidPlayer(ADB@127.0.0.1:34999) DllNotFoundException: Unable to load DLL 'libtensorflowlite_gpu_delegate': The specified module could not be found.
at TensorFlowLite.GpuDelegate.TfLiteGpuDelegateOptionsV2Default () [0x00000] in <00000000000000000000000000000000>:0
at TensorFlowLite.GpuDelegate..ctor () [0x00000] in <00000000000000000000000000000000>:0
at TensorFlowLite.BaseImagePredictor1[T].CreateGpuDelegate () [0x00000] in <00000000000000000000000000000000>:0 at TensorFlowLite.BaseImagePredictor1[T]..ctor (System.String modelPath, System.Boolean useGPU) [0x00000] in <00000000000000000000000000000000>:0
at TensorFlowLite.PoseNet..ctor (System.String modelPath) [0x00000] in <00000000000000000000000000000000>:0
at PoseNetSample.Start () [0x00000] in <00000000000000000000000000000000>:0

What is the problem? Anything that I can do?

@asus4
Copy link
Owner

asus4 commented Apr 6, 2020

@marimomo00 Android plugin *.so files are built for only Arm64 CPU for now. Could you try to rebuild the plugin with android_arm option instead of android_arm64?

# Configure the Android SDK path by running configure script at the repository root
./configure

# Build experimental
bazel build -c opt --cxxopt=--std=c++11 --config=android_arm //tensorflow/lite/experimental/c:libtensorflowlite_c.so

# Build GPU delegate
bazel build -c opt --config android_arm --copt -Os --copt -DTFLITE_GPU_BINARY_RELEASE --copt -fvisibility=hidden --linkopt -s --strip always //tensorflow/lite/delegates/gpu:libtensorflowlite_gpu_delegate.so

@marimomo00
Copy link
Author

marimomo00 commented Apr 6, 2020 via email

@gblue1223
Copy link

gblue1223 commented Apr 11, 2020

I wanna share my experience about Bazel building.
First of all, I've built with ''tensorflow-2.1.0" and ''bazel-0.29.1''.
And I ran ''./configure'' and everything leave as default but set options regarding Android.

Then I ran the command as @asus4 said.
You have to make sure about tensorflow and bazel version.
It is very sensitive.

@manena
Copy link

manena commented Apr 21, 2020

I'm sorry I'm new to building so files.
I would like to build for android_arm. I'm working on MAC OS Catalina and have no idea if these are commands to run from the shell, what directory I should be in and what would I need to install in order to be able to build.

Can you give me some guidance?

Thanks in advance

@marimomo00
Copy link
Author

@manena
There are instruction on building tensorflow.
https://www.tensorflow.org/install/source

However, I got lots of error when compiling on windows. I'm still struggling on building android_arm. I've opened another issue and hope someone could help.

tensorflow/tensorflow#38525

@gblue1223 I've tried ''tensorflow-2.1.0" and ''bazel-0.29.1'', but with error. Do you build on Windows or MAC OS?

@gblue1223
Copy link

@marimomo00 I've built on Ubuntu. Since Tensorflow more familiar with Linux, you should try on Linux OS.

@manena
Copy link

manena commented Apr 26, 2020

Thanks @marimomo00 i’ll try.
In the meanwhile @gblue1223: would it be possible for you to share with us the .so files you have built? It would be very helpful!

Regards and I hope all of you and your families are fine!

@gblue1223
Copy link

gblue1223 commented Apr 28, 2020

@manena Here is the .so files. Good luck~

@Freeverc
Copy link

I've built libtensorflowlite_c.so for ARMv7,but I can not use it in your samples. The result on my phone is pure white with no images.How can I use it in ARMv7? I've changed the Target Architectures.

@asus4 asus4 added Android enhancement New feature or request labels Aug 4, 2020
@emusiceducation123
Copy link

I built for ARMv7 as well. When it runs, log shows:
08-29 11:01:18.646 3872 4085 I tflite : Initialized TensorFlow Lite runtime.
08-29 11:01:20.242 7703 7723 E Unity : Unable to find libtensorflowlite_gpu_delegate
08-29 11:01:20.244 7703 7723 E Unity : Unable to find tensorflowlite_gpu_delegate
08-29 11:01:20.259 7703 7723 E Unity : Unable to find libtensorflowlite_c

@mathtasatlime
Copy link

Does anybody have a working build auf 2.4.0 for armv7 ?

@stale
Copy link

stale bot commented Apr 8, 2021

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.

@stale stale bot added the wontfix This will not be worked on label Apr 8, 2021
@stale stale bot closed this as completed Apr 15, 2021
@asus4 asus4 self-assigned this Jun 10, 2022
@asus4 asus4 reopened this Jun 10, 2022
@stale stale bot removed the wontfix This will not be worked on label Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants