แสดงบทความที่มีป้ายกำกับ tensorflow android demo แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ tensorflow android demo แสดงบทความทั้งหมด

วันจันทร์ที่ 13 มีนาคม พ.ศ. 2560

Machine Learning Tensorflow Android App Demo

Machine Learning TensorFlow Android App Demo

What is TensorFlow?
TensorFlow is open source machine learning library from Google. Computation code is written in C++, but programmers can write their TensorFlow software in either C++ or Python and implemented for CPUs ,GPUs or both.


In November 2015, Google announced and open sourced TensorFlow, its latest and greatest machine learning library. This is a big deal for three reasons:
  1. Machine Learning expertise: Google is a dominant force in machine learning. Its prominence in search owes a lot to the strides it achieved in machine learning.
  2. Scalable : the announcement noted that TensorFlow was initially designed for internal use and that it’s already in production for some live product features.
  3. Ability to run on Mobile.
This last reason is the operating reason for this post since we’ll be focusing on Android. If you examine the tensorflow repo on GitHub, you’ll find a little tensorflow/examples/android directory. I’ll try to shed some light on the Android TensorFlow example and some of the things going on under the hood.



Install TensorFlow on your System ( PC or Notebook , Windows or mac )

It has many method to install

  • virtualenv
  • pip
  • Docker
  • installing from sources

We use pip method first.



Installing with native pip


Python
In order to install TensorFlow, your system must contain one of the following Python versions:

  • Python 2.7
  • Python 3.3+

Pip installs and manages software packages written in Python. If you intend to install with native pip, then one of the following flavors of pip must be installed on your system:
  • pip, for Python 2.7
  • pip3, for Python 3.n.
pip or pip3 was probably installed on your system when you installed Python. To determine whether pip or pip3 is actually installed on your system, issue one of the following commands:
$ pip -V  # for Python 2.7
$ pip3 -V # for Python 3.n 

We strongly recommend pip or pip3 version 8.1 or higher in order to install TensorFlow. If pip or pip3 8.1 or later is not installed, issue the following commands to install or upgrade:
$ sudo easy_install --upgrade pip
$ sudo easy_install --upgrade six 

Install Bazel
https://bazel.build/versions/master/docs/install.html


Building the Demo from Source

git clone --recurse-submodules https://github.com/tensorflow/tensorflow.git


Build the Android APK 
$ cd ~/tensorflow
$ bazel build //tensorflow/examples/android:tensorflow_demo

Install the APK to Android devices
$ adb install -r -g bazel-bin/tensorflow/examples/android/tensorflow_demo.apk
Reference