TensorFlow profile

On November 9, 2015, Google Research published the following article: TensorFlow – Google’s latest Machine Learning System, open sourced for everyone, is pleased to announce its next generation machine learning system.

As for why Google is open sourcing TensorFlow, the official explanation is:

If TensorFlow is so great, why open source it rather than keep it proprietary? The answer is simpler than you might think: We believe that machine learning is a key ingredient to the innovative products and technologies of the future. Research in this area is global and growing fast, but lacks standard tools. By sharing what we believe to be one of the best machine learning toolboxes in the world, we hope to create an open standard for exchanging research ideas and putting machine learning in products. Google engineers really do use TensorFlow in user-facing products and services, and our research group intends to share TensorFlow implementations along side many of our research publications.

Here’s Why Google Is open-sourcing Some Of Its Most Important Technology Here’s Why Google Is open-sourcing Some Of Its Most Important Technology

The decision to open-source was the brainchild of Jeff Dean, Who felt that the company’s innovation efforts were being hampered by the slow pace of normal science.Google researchers would write a paper, which would then be discussed at a conference some months later. Months after that somebody else would write another paper building on their work.

Dean saw that open-sourcing TensorFlow could significantly accelerate the process. Rather than having to wait for the next paper or conference, Google’s researchers could actively collaborate with the scientific community in real-time Google could also improve the source code and, by sharing machine learning techniques more broadly, it would help populate the field with more technical talent.

“Having this system open sourced we’re able to collaborate with many other researchers at universities and startups, which gives us new ideas about how we can advance our technology. Since we made the decision to open-source, The code runs faster, it can do more things and it’s more flexible and convenient,” says Rajat Monga, who leads the TensorFlow team.

Not surprisingly, TensorFlow’s Github Repo has generated a large number of stars and forks in a short period of time, with both academic and industrial interest, We are committed to the TensorFlow community and working with Google to improve and improve TensorFlow.

However, Soumith, a programmer who was benchmarking at Github at the time and now works in Facebook’s AI division, published a Benchmark TensorFlow article comparing the performance of TensorFlow with other major deep learning frameworks. The result was disappointing. Of course, the Google team says it will continue to optimize and support distribution in future releases.

On April 13, 2016, Google published Announcing TensorFlow 0.8 — Now with Distributed Computing Support! TensorFlow 0.8 is a distributed version of TensorFlow that can be used in real-world big data production environments.

On April 29, 2016, Google DeepMind, which developed the best Go AI to date, announced: TensorFlow’s DeepMind move to TensorFlow has finally been recognized as a milestone in the development of TensorFlow in the industry, greatly increasing the enthusiasm of TensorFlow users.

The Good, Bad & Ugly of TensorFlow (Chinese translation) The advantages and disadvantages of TensorFlow are analyzed in detail.

The Windows platform

Tensorflow uses Bazel for the Android Demo. It is not recommended because of its experimental support for Windows. Github has a sample project for compiling with the NDK in Anroid Studio that you can clone to use.

Ubuntu 14.04

This assumes that Ubuntu 14.04 does not yet have an Android development environment.

Install the Java 1.8

$ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:webupd8team/java $ sudo apt-get update $  sudo apt-get install oracle-java8-installerCopy the code

Configure the Java environment variable to add the following to/etc/environment:

JAVA_HOME="/usr/lib/jvm/java-8-oracle"
Copy the code

Install bazel

[the arch = $echo "deb amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list $ curl https://bazel.io/bazel-release.pub.gpg | sudo apt-key add - $ sudo apt-get update && sudo apt-get install bazel $ sudo apt-get upgrade bazelCopy the code

You can refer to bazel’s official documentation for detailed instructions.

Download tensorflow

$ cd ~/
$ git clone https://github.com/tensorflow/tensorflow.git
Copy the code

The following steps are based on TensorFlow on Android.

Download and unpack the Android SDK

$wget https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz $tar XVZF android - sdk_r24. 4.1 - Linux. TGZ - C ~/tensorflowCopy the code

Update the SDK:

$CD ~/tensorflow/android-sdk-linux /tensorflow/android-sdk-linux /tensorflow/android-sdk-linuxCopy the code

Download and decompress the NDK

$ wget https://dl.google.com/android/repository/android-ndk-r12b-linux-x86_64.zip
$ unzip android-ndk-r12b-linux-x86_64.zip -d ~/tensorflow
Copy the code

Download tensorflow’s model

$ cd ~/tensorflow
$ wget https://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip -O /tmp/inception5h.zip
$ unzip /tmp/inception5h.zip -d tensorflow/examples/android/assets/
Copy the code

Modify the WORKSPACE

$ gedit ~/tensorflow/WORKSPACE
Copy the code

Uncomment android_sdk_repository and android_ndk_repository sections and replace them with the following:

Android_sdk_repository (name = "androidsdk", api_level = 24, build_tools_version = "24.0.3", # Replace with path to Android SDK on your system path = "/home/ross/Downloads/android-sdk-linux", ) android_ndk_repository( name="androidndk", path="/home/ross/Downloads/android-ndk-r12b", api_level=24)Copy the code

Tensorflow Android Demo App

$ cd ~/tensorflow
$ bazel build //tensorflow/examples/android:tensorflow_demo
Copy the code

If all goes well, you’ll see the following prompt at the end:

bazel-bin/tensorflow/examples/android/tensorflow_demo_deploy.jar bazel-bin/tensorflow/examples/android/tensorflow_demo_unsigned.apk Bazel - bin/tensorflow/examples/android/tensorflow_demo apk INFO: Elapsed time: 109.114 s, Critical Path: 37.45 sCopy the code

Android Demo analysis

The Demo directory structure is the same, and using Jni Android engineering in ~ / tensorflow tensorflow/examples/Android/Jni directory, with the native code:

├ ─ ─ imageutils_jni. Cc ├ ─ ─ just set py ├ ─ ─ rgb2yuv. Cc ├ ─ ─ rgb2yuv. H ├ ─ ─ yuv2rgb. Cc └ ─ ─ yuv2rgb. HCopy the code

The Java interface related Java classes in the https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/android directory, Consider integrating it directly into your own projects.

Demo the native implementation in the https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/android/jni directory.

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/android/src/org/tensorflow/demo/TensorFlowImage Listener. Java defines tensorflow model, protobuf format, labels for identifying results, etc.

    private static final Logger LOGGER = new Logger();

    private static final boolean SAVE_PREVIEW_BITMAP = false;

    private static final String MODEL_FILE = "file:///android_asset/tensorflow_inception_graph.pb";
    private static final String LABEL_FILE =
            "file:///android_asset/imagenet_comp_graph_label_strings.txt";

    private static final int NUM_CLASSES = 1001;
    private static final int INPUT_SIZE = 224;
    private static final int IMAGE_MEAN = 117;
Copy the code

If you want to use your own model, use TensorFlow to solve other problems by modifying the code and modules mentioned above. The TensorFlow on Android article provides specific steps.

Finally, Tensorflow can also be ported to iOS applications. See TalkingData SDK Team’s technical blog post about machine learning in iOS development — Tensorflow.