6
6

More than 5 years have passed since last update.

Android 8.1 - Neural Network API メモ

Posted at

数か月前にリリースされたAndroid 8.1でNeural Network機能がAOSPに追加された。

公式ガイド:
https://developer.android.com/ndk/guides/neuralnetworks/index.html

framework側に組み込まれたことで、Tensorflow等のライブラリをアプリに組み込まずに基本的なNN機能をAndroid標準機能としてアプリから使用できるようになった。

NNAPI is designed to provide a base layer of functionality for higher-level machine learning frameworks (such as TensorFlow Lite, Caffe2, or others) that build and train neural networks.

image.png

アプリからNeural Network APIを使用するにはNDKを用いる必要がある。

足し算・掛け算をNeural Network APIで行う公式サンプルアプリ↓
https://github.com/googlesamples/android-ndk/tree/master/nn_sample

サンプルでもassetフォルダに学習済みバイナリデータを格納し読み込んでいるように、Neural Network APIに学習機能はなく、
1. 学習済みモデル読み込み
2. 学習済みモデルに値入力
3. 結果出力
といった使用の流れを想定していると思われる。

NNAPI is meant to be called by machine learning libraries, frameworks, and tools that let developers train their models off-device and deploy them on Android devices.

FW側の実装は↓
https://android.googlesource.com/platform/frameworks/ml/+/android-8.1.0_r14/nn/

https://android.googlesource.com/platform/frameworks/ml/+/android-8.1.0_r14/nn/common/operations/
辺りを見てみると、RNN、LSTM、CNN(Conv2D)等あり、ディープラーニングも使えそうだが、実装例が見つからず。

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6