Slide 1

Slide 1 text

Androidで TensorFlow かものはし 2017/9/30 @kawai

Slide 2

Slide 2 text

いきさつ

Slide 3

Slide 3 text

ディープ ラーニング すごい

Slide 4

Slide 4 text

Androidでも CNN動かしたい! CNN=畳み込みニューラルネットワーク

Slide 5

Slide 5 text

Java + RenderScriptで 実装できるらしい 参考にさせていただいた記事: http://www.kaede-software.com/2015/06/renderscript_ja.html

Slide 6

Slide 6 text

実装できた! けど処理時間が…

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

“When we started building TensorFlow, supporting mobile devices was a top priority.” https://developers-jp.googleblog.com/2016/07/tensorflow-v09.html

Slide 9

Slide 9 text

waifu2x TensorFlowへ再移植 RenderScript

Slide 10

Slide 10 text

① ② ①tfへの移植例:https://github.com/mrkn/tf-waifu2x

Slide 11

Slide 11 text

流れ

Slide 12

Slide 12 text

1. tfのGraphにする 2. Graphを書き出す(*.pb) 3. AndroidでGraphを読み込む 4. Androidで実行

Slide 13

Slide 13 text

tf.train.write_graph(def) 移植フロー

Slide 14

Slide 14 text

Python と Java(Android)のAPI対応 Python(1.2.1) tf-android (1.2.0) Graphの 読み込み def = tf.GraphDef() def.ParseFromString(f.read()) tf.import_graph_def(def, name='') new (AssetManager, “file://android_asset/xxxxx”) Placeholderへ の入力 feed_dict={“x:0”, nparray} #feed(“x”, float[], 1, w, h, 3) 処理の実行と 出力の取得 result = session.run("out_conv7:0", feed_dict) #run({“out_conv7”}, boolean) #fetch(“out_conv7”, int[])

Slide 15

Slide 15 text

デモ

Slide 16

Slide 16 text

AndroidでTensorFlow 以上