Audio Recognition in Android with OpenVINO

OpenVINO for Android

Official distribution of OpenVINO provides Windows, Linux, Mac and Raspbian (Raspberry Pi OS) installers. So this article is based on my own build for ARM64 Android (arm64-v8a ABI). Make sure that your device also has 64bit CPU. Otherwise you can repeat the build steps for 32bit version (armeabi-v7a ABI).

Audio Recognition model

For this demo we use a model trained for keywords spotting. Due OpenVINO uses own representation, you need download necessary ov_model.xmland ov_model.binfrom HuggingFace Hub.

Application code

Application consists of two major parts: audio recording and deep learning inference. Audio recording can be easily done with helps of Android public tutorials:

  • Initialize OpenVINO
  • Create OpenVINO Core object. This step is a bit different from non-Android applications because of resources management. We need create a temporal copy of plugins.xml config file to make it visible for native libraries:
  • Read and compile model (same as in C++). Also, we need create temporal ov_model.xmland ov_model.bin similar to the plugins.xml
  • Create an instance named as inference request, put the input data to Tensor, run inference and get the prediction:
How the demo works on Redmi Note 9S

Useful links

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store