Reasons for Using ML Kit in Mobile App Development

Kayvan Kaseb
Software Development
9 min readAug 16, 2020
The picture is provided by Unsplash

Recently, a growing interest to Machine Learning forced the companies to focus and invest on it. Machine Learning (ML) is the field of computational science, which focuses on analyzing and interpreting patterns and structures in data to enable learning, reasoning, and decision making outside of human being interaction. As a result, the introduction of new mobile SDK called ML Kit has been a prominent topic in the IT industry. Today, more than 25,000 applications on Android and iOS make use of ML Kit’s features. This essay aims to introduce and discuss ML Kit as an advanced SDK for having smarter mobile apps.

Introduction and Overview

Nowadays, Machine learning (ML) is an exciting field of research in computer science and engineering. It is considered a subset of Artificial Intelligence (AI) because it enables the extraction of meaningful patterns from samples, which is a capability of human intelligence. The demand of having a computer that performs repetitive and well-defined tasks is clear: computers will perform a given task consistently and tirelessly, but these tasks would be difficult to accomplish for human. Recently, machines have showed the ability to learn and even master tasks that were thought to be extremely complicated for machines, showing that machine learning algorithms are potentially useful elements of detection and decision support systems. Another exciting point is the finding that in some situations, computers seem to be able to observe patterns that are beyond human perception. This discovery has led to substantial and increased interest in the major of machine learning in various areas. At a high level, machine learning is the process of teaching a computer system how to make accurate predictions when fed data. Those predictions could be answering whether a piece of fruit in a photo is a banana or an apple, spotting people crossing the road in front of a self-driving car, whether the use of the word book in a sentence relates to a paperback or a hotel reservation, whether an email is spam, or recognizing speech accurately enough to generate captions for a video. The key difference between traditional computer software and machine learning approach is that a human developer has not written codes that instructs the system how to tell the difference between the banana and the apple. Instead, a machine-learning model has been taught how to reliably discriminate between the fruits by training on a large amount of data, in this instance likely a massive number of images labelled as containing a banana or an apple.

Machine learning (ML) is the study of computer algorithms that enhance automatically through experience. It is seen as a subset of Artificial Intelligence (AI). Machine learning algorithms build a mathematical model based on sample data, known as “training data”, in order to make predictions or decisions without being explicitly programmed to do.

Artificial Intelligence and Machine Learning, the photo is provided by Oracle

In fact, we use algorithms to learn from data and then we make predictions about similar data that has not been seen before by using Machine Learning. Thus, it would be a two-step process: training and inference. First, the model learns, and then we use it to make predictions. The process of model learning is what we typically call training, and when the model is making predictions about the data is what we call inference. This is a high-level view of what is happening during training the model for extracting knowledge from input data with using prediction and decision. Because we know what the right answer in our case, we are able to calculate the errors that occurs many times. As a result, we use these errors to enhance our model, and this process is repeated many times until we reach the point that we make sure that the model is good enough or that this is the best result that we can do. This involves a number of steps and preparations and that is why we have to use a framework to make this easier.

Machine Learning (ML) is the science of computer algorithms that improve automatically through past experiences.

To sum up this section, Machine Learning is considered as a subset of AI, which uses statistical methods to enable machines to improve with experience. It enables a computer system to make decisions to carry out a certain task. These programs or algorithms are designed in such a way, which they can learn and enhance over time by observing new data. The aim of machine learning is to derive meaning from data. Thus, data is the key to unlock Machine Learning. The more qualified data ML has, the more accurate the ML algorithm becomes.

Machine Learning is the extraction of knowledge from data.

Difference between AI and ML

Basically, the goal of Artificial Intelligence is to create a machine that can mimic a human mind, and it needs learning capabilities as well. However, it is more than just about learning; it is also about knowledge representation, reasoning and abstract thinking. In contrast, Machine Learning is solely focused on writing software that can learn from past experiences. Besides, Machine Learning is more closely related to Data Mining and Statistics than it is to Artificial Intelligence.

Machine Learning: Using data to answer questions. “Using data” is what is generally referred to as “training”, and also “answering questions” is referred to as “making predictions”, or “inference”.

ML Kit for app developers

As a matter of fact, ML Kit SDK is a new product from Google, which was presented in 2018. ML Kit is a software development kit that makes it possible for developers to simplify the integration of machine learning models into their mobile apps. In addition, even a junior developer can address this task easily. Another point is that it makes your iOS and Android apps much more engaging, personalized, and useful with solutions that are optimized to run on device. Today, more than 25,000 applications on Android and iOS make use of ML Kit’s features.

A new SDK that brings Google’s Machine Learning experience to mobile developers in a powerful, easy-to-use package on Firebase.

The picture is provided by Google Documents

ML Kit has some features that can be categorized in three sections:

  1. Vision: Video and image analysis APIs to label images and detect bar-codes, text, faces, and objects.
  2. Natural Language: Natural language processing APIs to identify and translate between 58 languages and provide reply suggestions.
  3. Custom: Build your own models using AutoML Vision Edge, or bring your own TensorFlow Lite models, run experiments, and deploy them in production with ML Kit.

Each category has some features. For instance, Vision has some features as Base APIs: Barcode Scanning, Face Detection, Image Labeling, Object Detection, Landmark Detection, and Text Detection.

The picture is provided by Google Documents

Some features in ML Kit for developers

Fundamentally, some features in ML Kit that are classified into Vision category have been introduced as follows:

Barcode Scanning

By using ML Kit’s barcode scanning API, you can be able to read data encoded using most standard barcode formats. Barcode scanning happens on the device, and does not need a network connection. In fact, barcode is an efficient way to pass information from the real world to your application.To be specific, when using 2D formats like QR code, you can encode structured data such as contact information or WiFi network credentials. Since ML Kit can automatically recognize and parse this data, your application can respond intelligently when a user scans a barcode

Face Detection

There are a lot of possibilities in you apps where you may want to utilize the detection of faces. Probably, you want to perform facial verification, tag photos, or add filters to a camera. Now, this feature is available as a part of the ML Kit. When API gets an image, it returns coordinates of nose, mouth, eyes, cheeks, and ears. Furthermore, this API supports the information whether a person on the picture has eyes closed or smiles. However, take into consideration that this determination works only for frontal faces. Another important aspect is the speed of face detection. As API performs tasks extremely immediately, it can be used in real-time apps. Besides, it is important to note that face detection via ML Kit is just only available as on-device recognition. So, you cannot perform face recognition on the cloud. This is probably a noticeable point for your users in terms of their personal data and privacy.

Image Labeling

By utilizing ML Kit’s image labeling APIs you can be able to detect and extract information about entities in an image across a broad group of categories. The default image labeling model can identify general objects, places, activities, animal species, products, and more. Also, you can use a custom image classification model.

Object Detection and Tracking

Initially, with ML Kit’s on-device Object Detection and Tracking API, you can identify and track objects in an image or live camera feed. Another choice is that you can classify detected objects, either by using the coarse classifier built into the API, or utilizing your own custom image classification model.

Text Recognition

With ML Kit’s text recognition APIs can recognize text in any Latin-based character set. Furthermore, they could be used to automate data-entry tasks such as processing credit cards, receipts, and business cards.

Digital Ink Recognition

By using ML Kit’s Digital Ink Recognition API, you can detect handwritten text on a digital surface in lots of languages. Also, you can classify sketches. In fact, the Digital Ink Recognition API uses the same technology that uses handwriting recognition in Gboard, Google Translate, and the Quick, Draw! game. So, digital Ink Recognition makes it possible to write on the screen instead of typing on a virtual keyboard. This lets users draw characters that are not available on their keyboards. Another key point is that the API can also transcribe handwritten notes, and recognize hand‑drawn shapes and emojis.

Benefits of utilizing ML Kit in mobile apps

  1. Easy-to-use framework for developers

Typically, adding ML to a mobile app is a challenging and time-consuming process. By using this new SDK, this process is dramatically simplified. All you need is to pass data to the API, and wait until SDK will send a response. Google’s team stated, that implementing their APIs. Therefore, you don not need deep knowledge of neural networks.

2. Custom models

This option is helpful for experienced developers. If base ML Kit APIs do not cover all your needs, you can have your own ML model. New SDK can work with Tensor Flow and mobile app machine learning library. Besides, it supports developers with the possibility to download their own model to Firebase console, and bundle it with their products. Another significant key factor is that models are updated dynamically. It suggests that model will be updated even without updating the whole app.

3. Cloud and on-device APIs

In fact, developers can choose between cloud-based and on-device APIs. To make a right choice it is significant to take into consideration some differences between these two variants. Cloud APIs process data on the Google Cloud Platform; therefore, recognizes objects more accurately. However, cloud models are larger in comparison to on-device ones. Offline models need less free space, can work offline and process data faster, but their accuracy is lower.

4. Security Concern and privacy

As we know, most models are app-specific. Thus, probably, your customize model should be protected from other accesses from other developers. Now, you can do this task safely by using ML Kit. Furthermore, Google claims that cloud APIs do not store user’s data, and it is removed when processing is done.

In addition to this section, you can make your model smaller and it runs faster on mobile devices by using conversion and compression. Also, A/B testing and report performance can be done via Analytics for A/B testing.

On-device machine learning with ML Kit

To be exact, the original version of ML Kit was exceedingly integrated with Firebase. However, developers wanted more flexibility when implementing these features in their mobile apps. Therefore, Google are making all the on-device APIs available in a new standalone ML Kit SDK that no longer needs Firebase although you can still use both ML Kit and Firebase to get the best of both products if you want to. After making these changes by Google, ML Kit is currently fully focused on on-device machine learning. So, this gives developers access to the some benefits that on-device versus cloud ML offers such as no network latency, work offline, and privacy for sensitive users’ data.

In conclusion

As a matter of fact, Machine Learning (ML) is the major of computational science, which focuses on analyzing and interpreting patterns and structures in data to enable learning, reasoning, and decision making outside of human being interaction. Therefore, the introduction of new mobile SDK called ML Kit has been a prominent topic in the IT industry. This article discussed some reasons for using this software development kit in mobile app development based on Google resources.

--

--

Kayvan Kaseb
Software Development

Senior Android Developer, Technical Writer, Researcher, Artist, Founder of PURE SOFTWARE YAZILIM LİMİTED ŞİRKETİ https://www.linkedin.com/in/kayvan-kaseb