tensorflow / tflite-support

TFLite Support is a toolkit that helps users to develop ML and deploy TFLite models onto mobile / ioT devices.
Apache License 2.0
378 stars 128 forks source link

Android NDK Prefabs for Tensorflow Lite #940

Open mrousavy opened 1 year ago

mrousavy commented 1 year ago

Hey all! I'm trying to use Tensorflow Lite in an Android NDK/C++ environment.

My build.gradle looks something like this:

...
android {
  ...
  buildFeatures {
    prefab true
  }
}

dependencies {
  ...
  implementation "org.tensorflow:tensorflow-lite:2.13.0"
}

And in my CMakeLists.txt I try to find tensorflow-lite as a prefab:

...
find_package(tensorflow-lite REQUIRED CONFIG)
...

target_link_libraries(
  ${PACKAGE_NAME}
  ...
  tensorflow-lite::tensorflow-lite
)

However, CMake is not able to find the package:

CMake Error at CMakeLists.txt:10 (find_package):
  Could not find a package configuration file provided by "tensorflow-lite"
  with any of the following names:

    tensorflow-liteConfig.cmake
    tensorflow-lite-config.cmake

  Add the installation prefix of "tensorflow-lite" to CMAKE_PREFIX_PATH or
  set "tensorflow-lite_DIR" to a directory containing one of the above files.
  If "tensorflow-lite" provides a separate development package or SDK, be
  sure it has been installed.

Does TensorFlow Lite not provide a prefab publish? This would make it a lot easier to integrate in such environments. Now I have to manually extract the .aar/zip and incldue the headers.