Sign language recognition on Android with Intel OpenVINO Java bindings

您所在的位置:网站首页 openvino安卓端 Sign language recognition on Android with Intel OpenVINO Java bindings

Sign language recognition on Android with Intel OpenVINO Java bindings

2023-06-20 15:08| 来源: 网络整理| 查看: 265

Sign language recognition on Android with Intel OpenVINOAnna Likholat

Anna Likholat

·

Follow

4 min read·Dec 2, 2020

--

This article explains how to create a sign language recognition application on Android x86 OS (64-bit) with Intel OpenVINO. We used the core component of OpenVINO — Inference Engine, which manages the loading and compiling of the optimized neural network model, runs inference operations on input data, and outputs the results.

There are multiple Android OS distributions which may run on Intel Architecture. Some of them are:

Intel CeladonAndroid x86

The application reads a video from the camera, collects every 16 frames in a sequence, uses a neural network to recognize a sign word and displays a text with the recognized word on image.

Build OpenVINO Java bindings for Android:

These steps were done on Ubuntu 18.04, but in the general case, they can be done on other operating systems, without fundamental differences.

Download and unpack Android NDK to ~/Downloads folder.Install OpenJDK 8:sudo apt-get install -y openjdk-8-jdkExport OpenJDK 8 path:export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64Clone OpenVINO repositories to your computer. Let’s assume that ~/Downloads is used as a working folder:cd ~/Downloadsgit clone https://github.com/openvinotoolkit/openvino.gitgit clone https://github.com/openvinotoolkit/openvino_contrib.gitUpdate openvino submodules and create build directory:cd openvinogit submodule update --init --recursivemkdir build && cd buildBuild OpenVINO for Android:cmake \ -DANDROID_ABI=x86_64 \ -DANDROID_PLATFORM=21 \ -DANDROID_STL=c++_shared \ -DENABLE_VPU=OFF \ -DENABLE_GNA=OFF \ -DENABLE_CLDNN=OFF \ -DENABLE_OPENCV=OFF \ -DENABLE_SAMPLES=OFF \ -DIE_EXTRA_MODULES=~/Downloads/openvino_contrib/modules \ -DCMAKE_TOOLCHAIN_FILE=~/Downloads/android-ndk-r20/build/cmake/android.toolchain.cmake ..make --jobs=$(nproc --all)To reduces size of the binaries do:~/Downloads/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/x86_64-linux-android/bin/strip ../bin/intel64/Release/lib/*.soCreate Android Studio projectDownload Android Studio on your PC.Start a new project, choose “Empty Activity”Create new Android Studio projectModify the following project files:/app/src/main/AndroidManifest.xml/app/src/main/res/layout/activity_main.xml/app/src/main/java/com/example/aslrecognitionapp/MainActivity.javaAdd Inference Engine dependency to projectYou need the following files from OpenVINO:cd ~/Downloads && mkdir openvino_installcp openvino/bin/intel64/Release/lib/plugins.xml openvino_installcp openvino/bin/intel64/Release/lib/inference_engine_java_api.jar openvino_installcp openvino/bin/intel64/Release/lib/*.so openvino_installcp openvino/inference-engine/temp/tbb/lib/libtbb.so openvino_installcp openvino/inference-engine/temp/tbb/lib/libtbbmalloc.so openvino_installAlso you will need C++ runtime library:cp android-ndk-r20/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_shared.so openvino_installCreate jniLibs/x86_64 directory in ~/AndroidStudioProjects/AslRecognitionApp/app/src/main folder:mkdir -p app/src/main/jniLibs/x86_64Copy native libraries to the project:cp openvino_install/*.so app/src/main/jniLibs/x86_64Copy inference_engine_java_api.jar file to the ~/AndroidStudioProjects/AslRecognitionApp/app/libs folder:cp openvino_install/inference_engine_java_api.jar app/libsAdd inference_engine_java_api.jar dependency in Gradle Scripts -> build.gradle (Module: AslRecognitionApp.app) file:Add JAR dependencyimplementation files('libs\\inference_engine_java_api.jar')Add OpenCV dependency to projectDownload OpenCV SDK for Android.Import OpenCV module: File -> New -> ImportModule and specify a path to unpacked SDK: ~/Downloads/opencv-4.5.0-android-sdk/OpenCV-android-sdk/sdkImport module to projectSpecify a path to unpacked SDKAdd module dependency: File -> Project StructureAdd module dependencyAdd SDK module as dependencyReplace minSdkVersion 16 to minSdkVersion 21 in Gradle Scripts -> build.gradle (Module: AslRecognitionApp.app) :Change minSdkVersionDownload deep learning network

Download model files from Open Model Zoo :

git clone --depth 1 https://github.com/openvinotoolkit/open_model_zoocd open_model_zoo/tools/downloaderpython3 -m pip install -r requirements.inpython3 downloader.py --name asl-recognition-0004

Model will be downloaded to intel/asl-recognition-0004/FP32 folder.

Add files on Android device

Use Android Debug Bridge (adb) to transfer data files on Android:

adb push ~/Downloads/openvino/plugins.xml /dataadb push asl-recognition-0004.xml asl-recognition-0004.bin /dataTry to run the applicationThe first time application will ask for camera permissions. If you’ll see a blank screen after that — try to run application again.ASL phrase


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3