Get startedGet started for free

TensorFlow Lite

1. TensorFlow Lite

Lak: TensorFlow supports multiple mobile platforms including Android, iOS and Raspberry Pi. So in here, we're gonna focus on mobile devices. Mobile TensorFlow makes sense when there's a poor or missing network connection, or where sending continuous data to a server would be too expensive. The purpose is to help developers make lean mobile apps using TensorFlow, both by continuing to reduce the code footprint, and by supporting quantization and lower-precision arithmetic that make the models smaller. You can build a TensorFlow shared object on Android using Android Studio using a continuous integration tool called Bazel. And for iOS, there is CocoaPod integration as well. And it's all relatively simple. So let's take a look at how you can use a TensorFlow API. The Android inference library integrates with TensorFlow for Java applications. So this library is a very thin wrapper from Java to the native implementation so that the performance impact is not very high. So at first, you create TensorFlowInferenceInterface, opening the model file from the asset in the APK, and then you set up an input feed using the Feed API. And on mobile, the input data tends to be retrieved from various sensors like the camera, et cetera. And then you run the inference, and you fetch the result using the fetch method. So all of these are blocking calls, so you typically run them in a worker thread instead of the main thread because an API call takes time. And even though we've talked primarily about prediction on mobile, a new frontier is confederated learning. The idea is you continuously train the model on the device, and then you combine the model updates from a federation of user devices to update the overall model. The goal is for each user to get their customized experience because there's model training happening on the device, but still retain privacy because it's the overall model update that goes back to the cloud.

2. Let's practice!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.