google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://mediapipe.dev
Apache License 2.0
26.71k stars 5.08k forks source link

Yocto recepie for Mediapipe for embeddedsystems #2333

Closed akshayvernekar closed 1 year ago

akshayvernekar commented 3 years ago

Please make sure that this is a feature request.

System information (Please provide as much relevant information as possible)

Describe the feature and the current behavior/state: We plan to use mediapipe in the camera device we are developing, the base SOC is imx8mm from NXP, we generally use Yocto build system to generate the device firmware . We didnt find any yocto recipes for Mediapipe anywhere but I think it will be a great addition and help lot of embedded developers who plan to use Mediapipe in their projects . Our current approach has been to generate and cross compile the binaries on the host system and then transfer it to the device for testing .

Will this change the current api? How? No

Who will benefit with this feature? Embedded systems developers who are using Yocto to build system firmware .

Please specify the use cases for this feature:

Any Other info:

willstott101 commented 3 years ago

There is an OpenEmbedded tensorflow layer https://layers.openembedded.org/layerindex/branch/master/layer/meta-tensorflow/ which is probably a good jumping off point. However it hasn't been touched in quite some time. We're just starting to look into building mediapipe for an RPi running poky using yocto. I'll try to release anything helpful I come up with, but we may end up cross-compiling outside of yocto initially if that's easier.

willstott101 commented 3 years ago

Ok, I've got to the point of having a bitbake-built mediapipe running and connecting to my RPi's GPU but have some camera trouble. So I'm going to need to start moving away from just building examples and integrating mediapipe into our framework as a library. Out of curiosity what exactly did you want to build with yocto? A c++ lib like us, or are you using mediapipe from python?

I'm hesitating releasing the layer until it's slightly neater but tidying up might take some time.

akshayvernekar commented 3 years ago

we are exploring both . For initial prototyping we want to use mediapipe as a python package we have got our application working on x86 now we want to port it to aarch64 ,did you have any luck building python package on yocto ? I tried building python wheel package on aarch64 ubuntu on docker and later installing it on the device via pip but it is running into some errors. But in the long run we want use mediapipe as a library .

willstott101 commented 3 years ago

Ok, I've uploaded my layer that I'm successfully using hackily to build a c++ library.

https://github.com/willstott101/meta-mediapipe

I'm yet to consider the python side of things, but the tensorflow layer is meant to be able to build a python library.

The whole layer is quite thrown together so some parts may be able to be simpler. Possibly a separate bazel build that downloads mediapipe or something would actually be neater than the amount of patching to mediapipe than is neccessary. As a bazel-based repository which builds a library would be useful for others who don't use yocto.

Anyway, please open any PRs if you use it and manage to get anything else working! The tensorflow targets with the .inc setup might be a good for basis seperating the .so and python lib build.

sureshdagooglecom commented 1 year ago

Hi @akshayvernekar , Are you still looking for the resolution on this issue.

akshayvernekar commented 1 year ago

@sureshdagooglecom yocto recipe from @willstott101 worked for us . Thanks @willstott101 !

kuaashish commented 1 year ago

Hi @akshayvernekar, Thanks for your confirmation! Could we move this issue to close status as it has been resolved? Thank you!

google-ml-butler[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.

google-ml-butler[bot] commented 1 year ago

Closing as stale. Please reopen if you'd like to work on this further.