-
Notifications
You must be signed in to change notification settings - Fork 353
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
TFLite platform libraries (binary vs. repository) #110
Comments
Thanks a lot for the analysis @applikationsprogramvara. When using: dependencies {
implementation 'org.tensorflow:tensorflow-lite:2.4.0'
implementation 'org.tensorflow:tensorflow-lite-gpu:2.4.0'
} In the build directory, these two files are obtained separtely.
We can either load them sepeately or possibly host libtensorflowlite_normal_with_gpu.so on a new maven repository, so that everything becomes a zero setup process for the users of this plugin. It would be helpful to get more information regarding how everything would work for the iOS counterpart |
For iOS to use cocoapods to download the library/frameowrk automatically, you would replace (in s.ios.vendored_frameworks = 'TensorFlowLiteC.framework' with s.dependency 'TensorFlowLiteC' And optionally also include the s.dependency 'TensorFlowLiteC/Metal'
s.dependency 'TensorFlowLiteC/CoreML' Or add all in one go (edit: I think this might not work, and requires Metal and CoreML as above?): s.dependency 'TensorFlowLiteC', :subspecs => ['CoreML', 'Metal'] You can add version pinning with: s.dependency 'TensorFlowLiteC', '~> 2.4.0'
s.dependency 'TensorFlowLiteC/Metal', '~> 2.4.0'
s.dependency 'TensorFlowLiteC/CoreML', '~> 2.4.0' |
@am15h not needing to use the install.bat and the complicated setup for iOS would be very nice. Therefore could you please comment on how to use this setup procedure? |
I changed both iOS and Android to remote dependencies:
|
Confusion
After some experiments I can say that the location of the binary libraries on using
tflite_flutter_plugin
is confusing:<project dir>/android/app/src/main/jniLibs/arm64-v8a/libtensorflowlite_c.so
<flutter>/.pub-cache/hosted/pub.dartlang.org/tflite_flutter-0.5.0/ios/TensorFlowLiteC.framework/TensorFlowLiteC
Here are some suggestions how the situation can be improved:
Suggestion 1
The first approach is flexible, by requires some experience from the developer building to libraries or at least to find the right place, where to put them. Also required to bring binaries.
Suggestion 2
Even better as suggested here #103 include libraries for the appropriate repository for each platform:
Android
Use Maven repository as a source of libraries for Android and include it to
build.gradle
(like here):A good start point how to use it is here.
iOS
Use Cocoapods repository as a source of libraries for iOS and includr them to
Podfile
(like here):A possible start point can be here.
The second approach looks more appropriate as does not need to compile the libraries or bring binaries and it assumed as a best practice solution for the both platforms.
To switch the libraries between stable and experimental version it is only needed to change versions of the libraries in
build.gradle
orPodfile
.The text was updated successfully, but these errors were encountered: