Code Monkey home page Code Monkey logo

android_tflite's Introduction

GPU Accelerated TensorFlow Lite applications on Android NDK.

Run and measure the performance of TensorFlow Lite GPU Delegate on Android NDK.

1. Applications

  • Lightweight Face Detection.
  • Higher accurate Face Detection.
  • Image Classfication using Moilenet.
  • Object Detection using MobileNet SSD.
  • Hair segmentation and recoloring.
  • 3D Handpose Estimation from single RGB images.
  • Eye position estimation by detecting the iris.
  • Pose Estimation.
  • Assign semantic labels to every pixel in the input image.
  • Human portrait drawing by U^2-Net.
  • Create new artworks in artistic style.

2. How to Build & Run

2.1 setup environment

$ mkdir ~/Android/
$ mv ~/Download/android-ndk-r20b-linux-x86_64.zip ~/Android
$ cd ~/Android
$ unzip android-ndk-r20b-linux-x86_64.zip
  • Download and install bazel.
$ wget https://github.com/bazelbuild/bazel/releases/download/3.1.0/bazel-3.1.0-installer-linux-x86_64.sh
$ chmod 755 bazel-3.1.0-installer-linux-x86_64.sh
$ sudo ./bazel-3.1.0-installer-linux-x86_64.sh

2.2 build TensorFlow Lite library and GPU Delegate library

  • run the build script to build TensorFlow Library
$ mkdir ~/work
$ git clone https://github.com/terryky/android_tflite.git
$ cd android_tflite/third_party/
$ ./build_libtflite_r2.4_android.sh

(Tensorflow configure will start after a while. Please enter according to your environment)


$ ls -l tensorflow/bazel-bin/tensorflow/lite/
-r-xr-xr-x  1 terryky terryky 3118552 Dec 26 19:58 libtensorflowlite.so*

$ ls -l tensorflow/bazel-bin/tensorflow/lite/delegates/gpu/
-r-xr-xr-x 1 terryky terryky 80389344 Dec 26 19:59 libtensorflowlite_gpu_delegate.so*

2.3 Download the needed assets

$ cd ~/work/android_tflite
$ ./download_all_assets.sh

2.4 Build Android Applications

$ cd ${ANDROID_STUDIO_INSTALL_DIR}/android-studio/bin/
$ ./studio.sh
  • Install NDK 20.0 by SDK Manager of Android Studio.
  • Open application folder (eg. ~/work/android_tflite/tflite_posenet).
  • Build and Run.

3. Tested Environment

Host PC Target Device
x86_64 arm64-v8a
Ubuntu 18.04.4 LTS Android 9 (API Level 28)
Android NDK r20b

4. Related Articles

5. Acknowledgements

android_tflite's People

Contributors

terryky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

android_tflite's Issues

clang++: error: linker command failed with exit code 1 (use -v to see invocation)

Hi guys,

I have to build tflite_age_gender but the bellow errors have occurred.

`Executing tasks: [:app:assembleDebug] in project /Users/momo/Documents/example/AI/android_tflite/tflite_age_gender

ABIs [arm64-v8a,armeabi-v7a,armeabi] set by 'android.injected.build.abi' gradle flag contained 'ARMEABI, ARM64_V8A' not targeted by this project.

Task :app:preBuild UP-TO-DATE
Task :app:preDebugBuild UP-TO-DATE
Task :app:compileDebugAidl NO-SOURCE
Task :app:compileDebugRenderscript NO-SOURCE
Task :app:checkDebugManifest UP-TO-DATE
Task :app:generateDebugBuildConfig UP-TO-DATE
Task :app:javaPreCompileDebug UP-TO-DATE
Task :app:mainApkListPersistenceDebug UP-TO-DATE
Task :app:generateDebugResValues UP-TO-DATE
Task :app:generateDebugResources UP-TO-DATE
Task :app:mergeDebugResources UP-TO-DATE
Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
Task :app:processDebugManifest UP-TO-DATE
Task :app:processDebugResources UP-TO-DATE
Task :app:compileDebugJavaWithJavac UP-TO-DATE
Task :app:generateJsonModelDebug UP-TO-DATE

Task :app:externalNativeBuildDebug
Build native-activity_armeabi-v7a
ninja: Entering directory `/Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/.cxx/cmake/debug/armeabi-v7a'
[1/3] Building CXX object CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp.o
[2/3] Building CXX object CMakeFiles/native-activity.dir/tflite_age_gender.cpp.o
[3/3] Linking CXX shared library /Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/build/intermediates/cmake/debug/obj/armeabi-v7a/libnative-activity.so
FAILED: /Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/build/intermediates/cmake/debug/obj/armeabi-v7a/libnative-activity.so
: && /Users/momo/Documents/libs/android-ndk-r20b/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=armv7-none-linux-androideabi27 --gcc-toolchain=/Users/momo/Documents/libs/android-ndk-r20b/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/momo/Documents/libs/android-ndk-r20b/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -march=armv7-a -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -std=gnu++11 -Wall -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -Wl,-z,noexecstack -u ANativeActivity_onCreate -shared -Wl,-soname,libnative-activity.so -o /Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/build/intermediates/cmake/debug/obj/armeabi-v7a/libnative-activity.so CMakeFiles/native-activity.dir/android_main.cpp.o CMakeFiles/native-activity.dir/app_engine.cpp.o CMakeFiles/native-activity.dir/tflite_age_gender.cpp.o CMakeFiles/native-activity.dir/render_imgui.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/android/camera_manager.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/android/camera_utils.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/android/gestureDetector.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/android/util_asset.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/assertgl.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/assertegl.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_egl.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_shader.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_matrix.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_texture.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_render2d.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_render_target.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_debugstr.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_pmeter.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/winsys/winsys_null.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/third_party/imgui/imgui.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/third_party/imgui/imgui_draw.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/third_party/imgui/imgui_widgets.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/third_party/imgui/examples/imgui_impl_opengl3.cpp.o -landroid libnative_app_glue.a -lm -lcamera2ndk -lmediandk -lEGL -lGLESv2 /Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/src/main/cpp/../jniLibs/armeabi-v7a/libtensorflowlite.so /Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/src/main/cpp/../jniLibs/armeabi-v7a/libtensorflowlite_gpu_delegate.so -llog -latomic -lm && :
/Users/momo/Documents/libs/android-ndk-r20b/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/src/main/cpp/../jniLibs/armeabi-v7a/libtensorflowlite.so: incompatible target
/Users/momo/Documents/libs/android-ndk-r20b/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/src/main/cpp/../jniLibs/armeabi-v7a/libtensorflowlite_gpu_delegate.so: incompatible target
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:250: error: undefined reference to 'tflite::DefaultErrorReporter()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:250: error: undefined reference to 'tflite::FlatBufferModel::BuildFromFile(char const*, tflite::ErrorReporter*)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:257: error: undefined reference to 'tflite::InterpreterBuilder::InterpreterBuilder(tflite::FlatBufferModel const&, tflite::OpResolver const&)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:257: error: undefined reference to 'tflite::InterpreterBuilder::operator()(std::__ndk1::unique_ptr<tflite::Interpreter, std::__ndk1::default_deletetflite::Interpreter >)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:257: error: undefined reference to 'tflite::InterpreterBuilder::~InterpreterBuilder()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:257: error: undefined reference to 'tflite::InterpreterBuilder::~InterpreterBuilder()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:272: error: undefined reference to 'tflite::Interpreter::SetNumThreads(int)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:280: error: undefined reference to 'tflite::Interpreter::AllocateTensors()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:180: error: undefined reference to 'TfLiteGpuDelegateV2Create'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:237: error: undefined reference to 'tflite::Interpreter::ModifyGraphWithDelegate(TfLiteDelegate
)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:298: error: undefined reference to 'tflite::DefaultErrorReporter()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:298: error: undefined reference to 'tflite::FlatBufferModel::BuildFromFile(char const*, tflite::ErrorReporter*)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:305: error: undefined reference to 'tflite::InterpreterBuilder::InterpreterBuilder(tflite::FlatBufferModel const&, tflite::OpResolver const&)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:305: error: undefined reference to 'tflite::InterpreterBuilder::operator()(std::__ndk1::unique_ptr<tflite::Interpreter, std::__ndk1::default_deletetflite::Interpreter >)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:305: error: undefined reference to 'tflite::InterpreterBuilder::~InterpreterBuilder()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:305: error: undefined reference to 'tflite::InterpreterBuilder::~InterpreterBuilder()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:320: error: undefined reference to 'tflite::Interpreter::SetNumThreads(int)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:334: error: undefined reference to 'tflite::Interpreter::AllocateTensors()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:353: error: undefined reference to 'tflite::DefaultErrorReporter()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:353: error: undefined reference to 'tflite::FlatBufferModel::BuildFromBuffer(char const
, unsigned int, tflite::ErrorReporter*)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:360: error: undefined reference to 'tflite::InterpreterBuilder::InterpreterBuilder(tflite::FlatBufferModel const&, tflite::OpResolver const&)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:360: error: undefined reference to 'tflite::InterpreterBuilder::operator()(std::__ndk1::unique_ptr<tflite::Interpreter, std::__ndk1::default_deletetflite::Interpreter >)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:375: error: undefined reference to 'tflite::Interpreter::SetNumThreads(int)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:383: error: undefined reference to 'tflite::Interpreter::AllocateTensors()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:401: error: undefined reference to 'tflite::DefaultErrorReporter()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:401: error: undefined reference to 'tflite::FlatBufferModel::BuildFromBuffer(char const
, unsigned int, tflite::ErrorReporter*)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:408: error: undefined reference to 'tflite::InterpreterBuilder::InterpreterBuilder(tflite::FlatBufferModel const&, tflite::OpResolver const&)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:408: error: undefined reference to 'tflite::InterpreterBuilder::operator()(std::__ndk1::unique_ptr<tflite::Interpreter, std::__ndk1::default_deletetflite::Interpreter >*)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:423: error: undefined reference to 'tflite::Interpreter::SetNumThreads(int)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:437: error: undefined reference to 'tflite::Interpreter::AllocateTensors()'
/Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/src/main/cpp/../../../../../common/util_tflite.h:32: error: undefined reference to 'tflite::ops::builtin::BuiltinOpResolver::BuiltinOpResolver()'
/Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/src/main/cpp/tflite_age_gender.cpp:390: error: undefined reference to 'tflite::Interpreter::Invoke()'
/Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/src/main/cpp/tflite_age_gender.cpp:447: error: undefined reference to 'tflite::Interpreter::Invoke()'
clibs/android-ndk-r20b/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/memory:2339: error: undefined reference to 'tflite::Interpreter::~Interpreter()'
/Users/momo/Documents/libs/android-ndk-r20b/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/memory:2339: error: undefined reference to 'tflite::FlatBufferModel::~FlatBufferModel()'
/Users/momo/Documents/example/AI/android_tflite/third_party/tensorflow/tensorflow/lite/mutable_op_resolver.h:0: error: undefined reference to 'vtable for tflite::MutableOpResolver'
/Users/momo/Documents/libs/android-ndk-r20b/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

Task :app:externalNativeBuildDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:externalNativeBuildDebug'.

Build command failed.
Error while executing process /Users/chinhnq/Library/Android/sdk/cmake/3.10.2.4988404/bin/ninja with arguments {-C /Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/.cxx/cmake/debug/armeabi-v7a native-activity}
ninja: Entering directory `/Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/.cxx/cmake/debug/armeabi-v7a'
[1/3] Building CXX object CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp.o
[2/3] Building CXX object CMakeFiles/native-activity.dir/tflite_age_gender.cpp.o
[3/3] Linking CXX shared library /Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/build/intermediates/cmake/debug/obj/armeabi-v7a/libnative-activity.so
FAILED: /Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/build/intermediates/cmake/debug/obj/armeabi-v7a/libnative-activity.so
: && /Users/momo/Documents/libs/android-ndk-r20b/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=armv7-none-linux-androideabi27 --gcc-toolchain=/Users/momo/Documents/libs/android-ndk-r20b/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/momo/Documents/libs/android-ndk-r20b/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -march=armv7-a -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -std=gnu++11 -Wall -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -Wl,-z,noexecstack -u ANativeActivity_onCreate -shared -Wl,-soname,libnative-activity.so -o /Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/build/intermediates/cmake/debug/obj/armeabi-v7a/libnative-activity.so CMakeFiles/native-activity.dir/android_main.cpp.o CMakeFiles/native-activity.dir/app_engine.cpp.o CMakeFiles/native-activity.dir/tflite_age_gender.cpp.o CMakeFiles/native-activity.dir/render_imgui.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/android/camera_manager.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/android/camera_utils.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/android/gestureDetector.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/android/util_asset.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/assertgl.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/assertegl.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_egl.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_shader.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_matrix.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_texture.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_render2d.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_render_target.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_debugstr.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_pmeter.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/common/winsys/winsys_null.c.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/third_party/imgui/imgui.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/third_party/imgui/imgui_draw.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/third_party/imgui/imgui_widgets.cpp.o CMakeFiles/native-activity.dir/Users/momo/Documents/example/AI/android_tflite/third_party/imgui/examples/imgui_impl_opengl3.cpp.o -landroid libnative_app_glue.a -lm -lcamera2ndk -lmediandk -lEGL -lGLESv2 /Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/src/main/cpp/../jniLibs/armeabi-v7a/libtensorflowlite.so /Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/src/main/cpp/../jniLibs/armeabi-v7a/libtensorflowlite_gpu_delegate.so -llog -latomic -lm && :
/Users/momo/Documents/libs/android-ndk-r20b/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/src/main/cpp/../jniLibs/armeabi-v7a/libtensorflowlite.so: incompatible target
/Users/momo/Documents/libs/android-ndk-r20b/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/src/main/cpp/../jniLibs/armeabi-v7a/libtensorflowlite_gpu_delegate.so: incompatible target
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:250: error: undefined reference to 'tflite::DefaultErrorReporter()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:250: error: undefined reference to 'tflite::FlatBufferModel::BuildFromFile(char const*, tflite::ErrorReporter*)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:257: error: undefined reference to 'tflite::InterpreterBuilder::InterpreterBuilder(tflite::FlatBufferModel const&, tflite::OpResolver const&)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:257: error: undefined reference to 'tflite::InterpreterBuilder::operator()(std::__ndk1::unique_ptr<tflite::Interpreter, std::__ndk1::default_deletetflite::Interpreter >)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:257: error: undefined reference to 'tflite::InterpreterBuilder::~InterpreterBuilder()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:257: error: undefined reference to 'tflite::InterpreterBuilder::~InterpreterBuilder()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:272: error: undefined reference to 'tflite::Interpreter::SetNumThreads(int)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:280: error: undefined reference to 'tflite::Interpreter::AllocateTensors()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:180: error: undefined reference to 'TfLiteGpuDelegateV2Create'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:237: error: undefined reference to 'tflite::Interpreter::ModifyGraphWithDelegate(TfLiteDelegate
)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:298: error: undefined reference to 'tflite::DefaultErrorReporter()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:298: error: undefined reference to 'tflite::FlatBufferModel::BuildFromFile(char const*, tflite::ErrorReporter*)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:305: error: undefined reference to 'tflite::InterpreterBuilder::InterpreterBuilder(tflite::FlatBufferModel const&, tflite::OpResolver const&)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:305: error: undefined reference to 'tflite::InterpreterBuilder::operator()(std::__ndk1::unique_ptr<tflite::Interpreter, std::__ndk1::default_deletetflite::Interpreter >)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:305: error: undefined reference to 'tflite::InterpreterBuilder::~InterpreterBuilder()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:305: error: undefined reference to 'tflite::InterpreterBuilder::~InterpreterBuilder()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:320: error: undefined reference to 'tflite::Interpreter::SetNumThreads(int)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:334: error: undefined reference to 'tflite::Interpreter::AllocateTensors()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:353: error: undefined reference to 'tflite::DefaultErrorReporter()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:353: error: undefined reference to 'tflite::FlatBufferModel::BuildFromBuffer(char const
, unsigned int, tflite::ErrorReporter*)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:360: error: undefined reference to 'tflite::InterpreterBuilder::InterpreterBuilder(tflite::FlatBufferModel const&, tflite::OpResolver const&)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:360: error: undefined reference to 'tflite::InterpreterBuilder::operator()(std::__ndk1::unique_ptr<tflite::Interpreter, std::__ndk1::default_deletetflite::Interpreter >)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:375: error: undefined reference to 'tflite::Interpreter::SetNumThreads(int)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:383: error: undefined reference to 'tflite::Interpreter::AllocateTensors()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:401: error: undefined reference to 'tflite::DefaultErrorReporter()'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:401: error: undefined reference to 'tflite::FlatBufferModel::BuildFromBuffer(char const
, unsigned int, tflite::ErrorReporter*)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:408: error: undefined reference to 'tflite::InterpreterBuilder::InterpreterBuilder(tflite::FlatBufferModel const&, tflite::OpResolver const&)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:408: error: undefined reference to 'tflite::InterpreterBuilder::operator()(std::__ndk1::unique_ptr<tflite::Interpreter, std::__ndk1::default_deletetflite::Interpreter >*)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:423: error: undefined reference to 'tflite::Interpreter::SetNumThreads(int)'
/Users/momo/Documents/example/AI/android_tflite/common/util_tflite.cpp:437: error: undefined reference to 'tflite::Interpreter::AllocateTensors()'
/Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/src/main/cpp/../../../../../common/util_tflite.h:32: error: undefined reference to 'tflite::ops::builtin::BuiltinOpResolver::BuiltinOpResolver()'
/Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/src/main/cpp/tflite_age_gender.cpp:390: error: undefined reference to 'tflite::Interpreter::Invoke()'
/Users/momo/Documents/example/AI/android_tflite/tflite_age_gender/app/src/main/cpp/tflite_age_gender.cpp:447: error: undefined reference to 'tflite::Interpreter::Invoke()'
/Users/momo/Documents/libs/android-ndk-r20b/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/memory:2339: error: undefined reference to 'tflite::Interpreter::~Interpreter()'
/Users/momo/Documents/libs/android-ndk-r20b/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/memory:2339: error: undefined reference to 'tflite::FlatBufferModel::~FlatBufferModel()'
/Users/momo/Documents/example/AI/android_tflite/third_party/tensorflow/tensorflow/lite/mutable_op_resolver.h:0: error: undefined reference to 'vtable for tflite::MutableOpResolver'
/Users/momo/Documents/libs/android-ndk-r20b/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 3s
12 actionable tasks: 1 executed, 11 up-to-date
`

Using Front and Rear camera at the same time

Hi @terryky

I have been trying to get 2 cameras working at the same time. Looks like you have utilizes camera 2 api so it's possible. For some reason merely duplicating the pipeline to the srctex isn't working for a second camera.

I think the issue is with the hardware buffer. Or something only one camera works at a time. I think the pipeline to the srctex can be simplified to be available as an api. Could you give me some pointers, I have been stuck at it for a month now. Thanks!

Keypoints score

Why score of key points has negative values and also values over 1.0 ?
Here is printed values for a two keypoints before drawing a joint
float s0 = pose_ret->pose[pid].key[id0].score;
float s1 = pose_ret->pose[pid].key[id1].score;
Screenshot from 2020-10-29 14-33-50

DBFace using with Android tflite format

Hello,

I have a question about using the db_keras.tflite model in Android. I am not sure the correct parameters for the face detector when generating anchors. If you can provide info about them that would be amazing. Info that I am lacking are feature sizes & anchor sizes with anchor ratios, here I have added some random data from another object detector:

private static final int[] feature_map_sizes = new int[] {33, 17, 9, 5, 3};

private static final float[][] anchor_sizes = new float[][] {{0.04f, 0.056f}, {0.08f, 0.11f}, {0.16f, 0.22f}, {0.32f, 0.45f}, {0.64f, 0.72f}};

private static final float[] anchor_ratios = new float[] {1.0f, 0.62f, 0.42f};`

If u have pre-processing and post-processing for face detector in Android Java code that would help immensely. Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.