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

Feature linux support #162

Merged
33 commits merged into from
Dec 7, 2023
Merged

Conversation

CaptainDario
Copy link
Contributor

@CaptainDario CaptainDario commented Oct 22, 2023

This PR should add linux support.

Environment:

  • Ubuntu 22.04

Changes:

  • Load TF Lite binary
  • update examples (same as macos) to support linux

Notes:

  • Camera is disabled for the examples on desktop as this is not really supported

Progress:

  • load TF Lite on linux
  • test examples
    • audio classification
      • uses some platform channels that do not work on linux
    • image classification mobilenet
      • only from file works
    • live object detection ssd mobile net
      • uses camera package that only works on iOS / mobile
    • object detection ssd mobile net
      • only from file works
    • style transfer
      • works
    • super resolution esrgan
      • works
    • text classification
      • works

@CaptainDario CaptainDario marked this pull request as draft October 22, 2023 15:18
@CaptainDario CaptainDario marked this pull request as ready for review October 22, 2023 18:59
@PaulTR PaulTR requested a review from a user November 19, 2023 02:42
@ghost
Copy link

ghost commented Nov 20, 2023

@st-duymai Do you happen to have a Linux machine? I don't think I'll be back at the office before leave for doing this review. If not, I can ask someone internally, too. Thanks!

I don't currently have a Linux machine, but I can set one up to test it.

@CaptainDario Could you help me resolve the conflict?

@CaptainDario
Copy link
Contributor Author

Yeah, sure! Do you encounter the same issue as PaulTR?

@CaptainDario
Copy link
Contributor Author

@PaulTR I think I found the problem that you were encountering and I pushed a fix. @st-duymai Let me know if you have problems setting this up.

@PaulTR
Copy link
Collaborator

PaulTR commented Nov 20, 2023

Sounds good, I'll see if I can make my way in to an office tomorrow or Wednesday to give it one more shot. Thanks!

@ghost
Copy link

ghost commented Nov 21, 2023

@CaptainDario I frequently encounter this problem when building Linux applications. Have you ever dealt with this issue before?
/home/ubuntu/Documents/flutter-tflite/example/super_resolution_esrgan/build/linux/x64/debug/bundle/super_resolution_esrgan: symbol lookup error: /home/ubuntu/Documents/flutter-tflite/example/super_resolution_esrgan/build/linux/x64/debug/bundle/blobs/libtensorflowlite_c-linux.so: undefined symbol: _ZN6tflite3ops7builtin12Register_NEGEv

@CaptainDario
Copy link
Contributor Author

No I have not seen this issue, how did you build the binary?

The one I used can be found here

@ghost
Copy link

ghost commented Nov 21, 2023

Thanks @CaptainDario I will check again with your .so library. I may have built it wrong at some step.

@ghost
Copy link

ghost commented Nov 21, 2023

Hi @PaulTR ,

After check with .so library that @CaptainDario provide above, I can confirm that the following five examples are working properly:

  1. Style transfer
  2. Text classification
  3. Super resolution esrgan
  4. Object detection SSD Mobilenet(only file work)
  5. Image classification

However, two examples are not working:

  1. Audio classification
  2. Live object detection SSD Mobilenet

@ghost
Copy link

ghost commented Nov 21, 2023

Hi @CaptainDario
Here is my libtensorflow_cc.so build step. Is this step correct?

sudo apt-get install cmake
git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
mkdir tflite_build
cd tflite_build
cmake ../tensorflow_src/tensorflow/lite/c
cmake --build . -j

@CaptainDario
Copy link
Contributor Author

Hi @CaptainDario Here is my libtensorflow_cc.so build step. Is this step correct?

sudo apt-get install cmake
git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
mkdir tflite_build
cd tflite_build
cmake ../tensorflow_src/tensorflow/lite/c
cmake --build . -j

You forgot to checkout a specific release, I guess the state you are currently in is broken. I used r2.12

@PaulTR
Copy link
Collaborator

PaulTR commented Nov 21, 2023

Hi @PaulTR ,

After check with .so library that @CaptainDario provide above, I can confirm that the following five examples are working properly:

  1. Style transfer
  2. Text classification
  3. Super resolution esrgan
  4. Object detection SSD Mobilenet(only file work)
  5. Image classification

However, two examples are not working:

  1. Audio classification
  2. Live object detection SSD Mobilenet

Awesome, thanks for checking on those. Yeah those two are expected to not work with desktop, so that's fine. I think once we have those conflicts resolved we should be pretty golden then for all three desktop versions! :)

@PaulTR
Copy link
Collaborator

PaulTR commented Nov 21, 2023

Screenshot from 2023-11-21 07-58-45
Just confirmed image classification on my work machine with my own .so file, so we're looking good on my side too

@ghost
Copy link

ghost commented Nov 29, 2023

Hi @CaptainDario Would you mind resolving the conflict in this PR? Thank you.

@CaptainDario
Copy link
Contributor Author

Yeah sure! I did not notice that there are conflicts.

@CaptainDario
Copy link
Contributor Author

done

@ghost
Copy link

ghost commented Dec 5, 2023

Hi @CaptainDario . I think this PR look greate and ready to merge. I just have one minor request regarding the readme file, which I mentioned earlier. Thank you for your hard work.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks

@ghost ghost merged commit 0535ea2 into tensorflow:main Dec 7, 2023
2 checks passed
@CaptainDario
Copy link
Contributor Author

@st-duymai are you able to release new tf lite version on pub?

@ghost
Copy link

ghost commented Dec 7, 2023

@st-duymai are you able to release new tf lite version on pub?

Sorry. I don't have any information about that.

@CaptainDario
Copy link
Contributor Author

CaptainDario commented Dec 7, 2023

@PaulTR, when you have some time, could you take a look at releasing a new version at pub?

@ghost
Copy link

ghost commented Dec 11, 2023

@CaptainDario The new version was published a few days ago (tflite_flutter: ^0.10.4). Please check.

@CaptainDario
Copy link
Contributor Author

@st-duymai thanks for the heads up, I tried it!

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants