LOUISVILLE, KENTUCKY
ATLANTA, GEORGIA
CHICAGO, ILLINOIS
CINCINNATI, OHIO
DENVER, COLORADO
MADISON, WISCONSIN
RARITAN, NEW JERSEY
TORONTO, ONTARIO
NOIDA, INDIA
HYDERABAD, INDIA

V-Soft's Corporate Headquarters

101 Bullitt Lane, Suite #205
Louisville, KY 40222

502.425.8425
TOLL FREE: 844.425.8425
FAX: 502.412.5869

Denver, Colorado

6400 South Fiddlers Green Circle Suite #1150
Greenwood Village, CO 80111

TOLL FREE: 844.425.8425

Chicago, Illinois

208 N. Green Street, #302, Chicago, IL 60607

TOLL FREE: 844.425.8425

Madison, Wisconsin

2810 Crossroads Drive, Ste. 4000
Madison, WI 53718

TOLL FREE: 844.425.8425

Atlanta, Georgia

1255 Peachtree Parkway Suite #4201
Cumming, GA 30041

TOLL FREE: 844.425.8425

Cincinnati, Ohio

Spectrum Office Tower 11260
Chester Road Suite 350
Cincinnati, OH 45246

Phone: 513.771.0050

Raritan, New Jersey

216 Route 206 Suite 22 Hillsborough Raritan, NJ 08844

Phone: 513.771.0050

Toronto, Canada

1 St. Clair Ave W Suite #902, Toronto, Ontario, M4V 1K6

Phone: 416.663.0900

Hyderabad, India

Incor 9, 3rd Floor, Kavuri Hills
Madhapur, Hyderabad – 500033 India

PHONE: 040-48482789

Noida, India

H-110 - Sector 63 ,
NOIDA , Gautham Budh Nagar ,
UP – 201301

State of AI on Android and iOS

State of AI on Android and iOS

In previous posts, we explored some of the compelling applications for Machine Learning on mobile apps, and considered whether the learning/computation should happen on-device or in the cloud. In this post, we’ll explore what are the options for implementing AI based applications on Android and iOS.

Setting Up ML Application on Andriod and iOS Platforms

The good news is that both Android and iOS platforms have announced first-class support for Machine Learning applications. Google announced Neural Networks API to accelerate on-device machine intelligence on Android 8.1 and Tensorflow Light for using in mobile and embedded devices. Apple announced the CoreML framework at their developer conference, WWDC 2017.

Now we will list the steps involved in setting up a simple machine learning application on mobile platforms: Andriod and iOS. For better understanding, we’ll consider the example of an app with Image Recognition using a neural network.

(Note: the below steps are more on the technical side, but just goes on to show the simple high-level steps required to get machine learning setup on your apps.)

Setup in Android

Below are the steps to be followed in setting up Andriod Machine Learning platform:

  1. Add TensorFlow lib as a dependency to your project.
  2. Identify the suitable pre-trained model. Model will be “.pb” file. It will come with a label file (.txt format). Drop them into the assets folder.
  3. Use the TensorFlowInferenceInterface that comes with the TF library. This class encapsulates the logic required to process the image and give the output label with confidence level.
  4. Process/display the label and confidence level. It'll be a value between 0 and 1.

In Android, the machine learning computation is completely based on pre-trained Tensorflow models, combined with a standard SDK. There is no platform level API to get output from a model (unlike Apple). However, Android has an advanced Neural Net API, which lets you train models on the device, on the go. Pretty powerful and advanced, but not many devices supported (as of the writing of this blog, at least).

Setup in iOS

Below is the list of steps to be followed in setting up iOS Machine Learning platform:

  1. Here, we will have to use models in the .mlmodel format. This is an Apple-prescribed format. As this is a non-standard format, Apple actually provides some tools to convert other formats in to .mlmodel format, including from TensorFlow models.
  2. Identify a suitable model, drop it into Project Navigator and assign the target ownership correctly.
  3. If you click on the model object, it will directly show all details of the model like Input & output name.
  4. Now XCode will auto-generate a Swift class representing this model. This class will be your interface to provide input and get output from the model.
  5. Now, all we need to do is pass the input to the model object, and get the output.

We see that both Android and iOS platforms are adopting Machine Learning in a big way, by providing built-in support for them. They’ve made it easy for developers to drag-drop trained models and use them on the fly in few simple steps. And there are several tools available to convert and reuse these models across the platforms.

Free mobile app consultation


About Authors

Kunj Gupta1. Kunj Gupta is a Google Certified Senior Mobile Developer at V-Soft. He works on developing apps for Android and iOS platforms, following best practices to ensure that apps run efficiently with respect to memory, CPU, battery, and network. He is also an expert in DevOps side of mobile app development, especially on automated Unit Tests and UI Tests on the Continuous Integration pipeline. Currently, he is working on applying Machine Learning in mobile apps as well.

 

Shaik Ghouse Basha2. Shaik Ghouse Basha is a Mobile Lead at V-Soft. He works on developing apps for Android and iOS platforms, following best practices to ensure that apps run efficiently with respect to memory, CPU, battery, and network. He is also an expert in DevOps side of mobile app development, especially on automated Unit Tests and UI Tests on the Continuous Integration pipeline. He is researching on applying Machine Learning in mobile apps as well.

 


Topics: Technology, Mobile Apps, Machine Learning, Artificial Intelligence, AI

Get tech and IT industry Updates

Webinar: Artificial Intelligence Use Cases