Open ash0080 opened 2 years ago
also, blobs/ is not packaged in build https://github.com/am15h/tflite_flutter_plugin/issues/181
@ash0080 I have a fix for this and will open a pull request soon.
@CaptainDario any update on this?
@ash0080 do you have a workaround? Just modify the source or is the blob
packaging issue in #181 still a blocker?
@walsha2 I found a way to make it work and forgot to open the PR.
I will take a look what I did and update here.
But it is related to the way the dynamic library is loaded on macos. You need to check that it is actually trying to load from the path where the library is located.
@CaptainDario I actually got this to work by forking. First, the change to dlib.dart
noted above is def a typo.
The else if (Platform.isMacOS)
line should be the following. I can open an PR for that.
ext = 'dylib';
Second, #181 is also a problem and the easier way to "resolve" that in the interim was to simply copy the files manually into the expected location. This should be part of the build step as you noted in #181
cd <PROJECT ROOT>
cp -r blobs/ <PROJECT ROOT>/build/macos/Build/Products/Debug/flutter.app/Contents/MacOS/blobs
The second part is not a real solution, so if you have an actually solution please do open a PR and note it in #181.
Regarding this plugin, this is my first time using it, but it looks super useful and worked great for my use case. The code traffic and maintainer feedback on PR/issues seems like it has stagnated? Is this package still maintained?
FYI @am15h - please feel free to chime in. Thanks!
@walsha2 take a look at my fork. For MacOS you need to add the dynamic library in Xcode to your project's resources. This will lead to the library being available
Directory(Platform.resolvedExecutable).parent.parent.path + '/resources/libtensorflowlite_c-mac.dylib'
For Linux and Windows you need to adapt the CMakeLists.txt (of your project not TF Lite plugin), at the end add (my project windows and lin)
install(
FILES ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c-win.dll
DESTINATION ${INSTALL_BUNDLE_DATA_DIR}/../blobs/
)
this will result in the lib being available in the blobs folder. However, this solution is outside of this plugin that's, why I didn't open a PR. I think there is a way to include the blobs-dir in a better way...
I am following this repo already for ~1 1/2 years and there is nearly no activity, so do not expect an answer from the author. However, if this repo gains traction again, there are quite a few ways to make this more user-friendly. For example, I adapted this package so it auto downloads the libs on iOS / Android. If you are interested take a look at my fork.
...so do not expect an answer from the author
Well that's sad to hear. Thanks for following up, I will definitely take a look at your fork. Hopefully we can revive this plugin, or at least get the maintainers to open it up to other people to maintain.
@am15h is that something we can do? It is 100% understandable if the original maintainers no longer have the time to support the plugin. Can we open the package to other maintainers? tflite_flutter already has 250+ likes on pub.dev. It would be better to keep this package up to date rather than create clones with similar names and confuse users.
https://github.com/am15h/tflite_flutter_plugin/blob/659e6d5fbf95506f89cf487ae3e355dd4ff7bc2a/lib/src/bindings/dlib.dart#L12