This tutorial walks you through the general process of adding software packages to your Celadon image. The Intel® Movidius Neural Network Abstraction Layer (NN HAL) is added to the Celadon image in order to provide hardware acceleration for Android Neural Networks API (NNAPI) using Intel Movidius Neural Compute Stick (NCS).
The Android Neural Networks API is a new Android C API introduced in Android 8.1 to run the computation intensive operations required by most machine learning frameworks (e.g. TensorFlow Lite and Caffe) to build and train neural networks on Android platforms. Intel Movidius Neural Compute Stick is a fanless deep learning USB accessory powered by Intel Movidius Vision Processing Unit (VPU), which enables rapid prototyping, validation, and deployment of Deep Neural Network (DNN) inference applications on PC platforms. By integrating the Intel Movidius Neural Network HAL to Android neural networks runtime, machine learning frameworks running on Android will perform hardware-accelerated inference operations using Intel Movidius NCS.
In this tutorial, you add the Intel Movidius NC SDK to your Celadon image and invoke a native app to communicate with the neural compute stick using NC API. The use of Android NNAPI, leveraging Intel Movidius NCS will be covered in future tutorials.
- Intel NUC systems supported by Celadon
- Intel Movidius Neural Compute Stick
- A 64-bit Ubuntu 16.04 Linux development host to build Celadon images
Reference the Build Celadon from source section in the Getting Started Guide to set up the Celadon source tree and the build environment.
Add Intel Movidius NN HAL to the build
- Please go through the Intel® Movidius™ Neural Networks HAL README to complete setup
- Google has released the NNAPI support since Android 8.1, and it is included in the Celadon source tree. To add Intel Movidius NN HAL to the build, clone the following GitHub repository under the external directory in the Celadon source tree:
$ cd <celadon_src> $ git clone https://github.com/intel/nn-hal.git external/nn-hal
- Include MvNCAPI.mvcmd, libncsdk, and ncs_test1_app packages into the build by adding the following lines to the device makefile device/intel/project-celadon/celadon/device.mk . These packages represent the NC firmware, NC SDK library, and the testing app respectively.
# Intel® Movidius Neural Networks HAL PRODUCT_PACKAGES += MvNCAPI.mvcmd libncsdk ncs_test1_app
Communicate with Intel Movidius NCS
To quickly test the functionality of NCSDK, you must establish an adb session from the Ubuntu development host to the Intel NUC system. This allows you to issue commands over adb sessions. Boot up the Intel NUC system, configure the WiFi credentials with the Android Settings app, and get the assigned IP address from the Settings->System->About tablet->Status page.
Install the Android adb tool on the Ubuntu development host if no adb executable is found. Enter the following commands to establish an adb session:
$ sudo apt-get install -y adb ... $ adb kill-server $ adb connect 192.168.1.107 # the IP address of Intel NUC * daemon not running; starting now at tcp:5037 * daemon started successfully connected to 192.168.1.107:5555
Once the adb session is connected, plug in the Intel Movidius Neural Compute Stick to the Intel NUC. Login to the system and launch the ncs_test1_app native app with root privilege. The app should detect the presence of the NCS as shown in following screenshot.
$ adb shell celadon:/ $ su celadon:/ # ncs_test1_app Hello NCS! Device opened normally. Goodbye NCS! Device Closed normally. NCS device working. celadon:/ #