[MUSIC PLAYING]
IBRAHIM ULUKAYA: It seems machine learning is everywhere
nowadays.
And with so many offerings for you as a mobile developer,
it can get really confusing as to where you should start.
I'm Ibrahim Ulukaya, an engineer on the Firebase team,
and I'm here today to introduce you to the options that
are available to you.
If we could carry data centers in our pocket
with unlimited battery, it will be much easier.
But using ML for mobile apps means
thinking about the processing power, battery consumption,
and connectivity of our device.
There are a number of factors that
will dictate the ML strategy and tools you'll want to use,
like whether you want to keep the data local,
if you require low latency, or if you need access
to the processing power of the cloud.
Luckily, Google offers a number of ML options
for mobile developers that can help
you develop and deploy ML models for the environment that
fits your use case.
To help you pick which ML deployment option fits best,
I'll walk you through a few key decision points.
The first question you should ask yourself
is where you want to perform ML inferences--
in the cloud or on the device?
You would use a cloud if you are already using an existing cloud
service for model inferences.
Or you run inferences infrequently
and want to minimize impact on the device battery life.
Or need to support older, less performant devices.
Or if you need high-accuracy models that require
the compute power of the cloud.
On the other hand, there are cases
in which it might be useful to do ML
inference on the mobile device.
For example, if you want to keep data local to the device.
You need low latency, such as RAM processing multiple frames
in quick succession.
You want inferences to work even when the device is offline.
Or your users may be in an area of the world
where high-speed wireless connectivity
is non-existent or unreliable.
So now that you understand all the considerations,
let me present the options available to you.
First is to run inference in the cloud.
And there's a wealth of tools and APIs you can use.
These include Cloud Vision for image recognition
and classification, Cloud Natural Language
API for text parsing and analysis,
AutoML, that allows you to customize models
that are served from the cloud.
All are available via REST APIs.
I won't go into them all here, but you can learn more
at cloud.google.com /products/ai/building-blocks.
Next is to run inference on the device.
And you have two main options.
You can either use TF Lite directly
or you can use ML Kit for Firebase.
ML Kit is a mobile SDK that brings Google's machine
learning experience to Android and iOS
apps in a powerful yet easy to use package.
It comes with a set of ready to use APIs,
both for on device and cloud-based inference.
They support common mobile use cases,
like image labeling, face detection, text recognition,
and barcode scanning, to name a few.
You simply pass in the data to the ML Kit library
and it will give you the information you need.
Whether you are new to or experienced with machine
learning, you can implement the functionality you need, all
in a few lines of code.
And it includes both Android and iOS libraries.
[? While the ?] on device APIs process data quickly
and will work even when there's no network connection.
The cloud-based APIs leverage the power
of Google Cloud platform's machine
learning technology to give a higher level of accuracy.
If you have a use case that's different than offered models,
ML Kit also offers the ability to deploy and experiment
with your own custom TensorFlow Lite models
to run on device inference.
It works like this.
After converting your model to the TF Lite format,
you can host and serve it to your users.
ML Kit for Firebase can then be used to host
and dynamically serve TF Lite models to your users.
And it provides convenient APIs that
help you use your custom TF Lite models in your mobile apps.
With ML Kit for Firebase, you can
reduce the initial install size of your mobile app
and only download the model when needed.
Dynamically swap models on the fly
without having to republish you app to the app store.
Target different user segments with models
tailored specifically for them.
Run A/B experiments with multiple models
to find the best-performing one.
If you'd like, you can also use your TF Lite
model on mobile directly with TF Lite APIs.
These offer blazingly fast inference times,
particularly on Android devices that support the neural network
APIs and the variety of ways to host and deploy your model.
For mobile developers looking to implement machine learning
into their apps, there are several directions
to choose depending on how much flexibility you want
or how specific your use case is.
We covered some key factors that help you decide,
like whether you do your inference on the device
or in the cloud, and whether you want
to use the pre-trained models Google provides.
Or train and bring your custom model.
Check out our full session at Next for a deep dive
analysis, live experiments, and the latest ML offerings
from Google.
[MUSIC PLAYING]