Machine Learning?—?Building an AI app? (using Tensorflow and Android)
Objects Identification in Mobile app (Creative visualization)

Machine Learning?—?Building an AI app? (using Tensorflow and Android)

Abstract:

This article describes case study on building a mobile app that recognise objects using machine learning.We have used Tensorflow Lite. Tensorflow Lite machine learning(ML) open source library provided by Google. This article mentions a brief on Tensorflow Lite.

Tensorflow:

Using Tensorflow Implement the Machine Learning(ML) or Artificial Intelligence(AI)-powered applications running on mobile phones. ML adds great power to our mobile application. TensorFlow Lite is a lightweight ML library for mobile and embedded devices.TensorFlow works well on large devices and TensorFlow Lite works really well on small devices. So that it’s easier and faster and smaller to work on mobile devices.

Machine Learning:

Artificial Intelligence — science for making smart things like building an autonomous driving car or having a computer drawing.Realize that vision of AI is in MI.MI is a technology where computer train itself. Neural network is one of the algorithms in Machine learning.

Neural Network:

One of the use cases of neural networks is, If we have a bunch of images, we can train the neural network to classify which one is the image of a cat or the image of a dog.There are so many possible use cases for the combination between ML and mobile applications, starting from image recognition.

Machine learning model inside our mobile applications:

Instead of sending all raw images to server. We can extract the meaning from the raw data,then sent it to server, so we can get much faster responses from cloud services.

ML model running inside our mobile application so that mobile application can recognise what kind of object is in each image.So that we can just send the label, such as a cat ,dog or human face, to the server.That can reduce the traffic to server.We are going to use Tensorflow Lite in mobile app.

TensorFlow Lite Architecture:

TensorFlow demo video:

Github link:

Pull below source code, import into Android Studio.

https://github.com/Chokkar-G/machinelearningapp.git

This post contains an example application using TensorFlow Lite for Android App. The app is a simple camera app that classifies images continuously using a pretrained quantized MobileNets model.

Workflow :

Step 1: Add TensorFlow Lite Android AAR:

Android apps need to be written in Java, and core TensorFlow is in C++, a JNI library is provided to interface between the two

The following lines in the app’s build.gradle file, includes the newest version of the AAR

build.gradle:

repositories {maven {url ‘https://google.bintray.com/tensorflow'}}

dependencies {// …compile ‘org.tensorflow:tensorflow-lite:+’}

Android Asset Packaging Tool should not compress .lite or .tflite in asset folder, so add following block.

android {aaptOptions {noCompress “tflite”noCompress “lite”}}

Step 2: Add pretrained model files to the project

a) Download the pretrained quantized Mobilenet TensorFlow Lite model from here

b)unzip and copy mobilenet_quant_v1_224.tflite and label.txt to the assets directory: src/main/assets

Step 3: Load TensorFlow Lite Model:

The Interpreter.java class drives model inference with TensorFlow Lite.

tflite = new Interpreter(loadModelFile(activity));

Step 4: Run the app in device.

Conclusion:

Detection of objects like a human eye has not been achieved with high accuracy using cameras, Cameras cannot be replaced with a human eye.Detection refers to identification of an object or a person by training a model by itself.We have great potential in MI. This was just a simple demonstration for MI. We could create a robot that changes its behaviour and its way of talking according to who’s in front of it (a child / an adult).We can use deep learning algorithm to identify skin cancer, or detect defective pieces and automatically stop a production line as soon as possible.

References:

https://www.tensorflow.org/mobile/tflite/

https://www.tensorflow.org/mobile/



要查看或添加评论,请登录

Chokkar G ?????的更多文章

社区洞察

其他会员也浏览了