The architecture of a mobile machine learning application

Now that we understand the components of TensorFlow Lite, we'll look at how a mobile application works with the TensorFlow components to provide the mobile ML solution.

The mobile application should leverage the TensorFlow Lite model file to perform the inference for future data. The TensorFlow Lite model file can either be packaged with the mobile application and deployed together, or kept separate from the mobile application deployment package. The following diagram depicts the two possible deployment scenarios:

Each deployment has its pros and cons. In the first case, where both are coupled, there is more security for the model file and it can be kept safe and secured. This is a more straightforward approach. However, the application package size is increased due to the size of the model file. In the second case, where both are kept separate, it is easy to update the model file separately, without performing an application upgrade. Hence, all activities with respect to the application upgrade, deployment to the app store, and so on can be avoided for a model upgrade. The application package size can also be minimized due to this separation. However, since the model file is standalone, it should be handled with greater care, without leaving it vulnerable to security threats.

Having got an overview of the mobile application with the TensorFlow Lite model file, let's look at the whole picture. The mobile application is packaged with the TensorFlow Lite model file. This interaction between the mobile application written using the Android SDK and the TensorFlow Lite model file happens through the TensorFlow Lite Interpreter, which is part of the Android NDK layer. The C functions are invoked through the interfaces exposed to the SDK layer from the mobile application in order to do the prediction or inference by using the trained TensorFlow Lite model deployed with the mobile application. The following diagram provides a clear view of the layers of the SDK and NDK of the Android ecosystem that will be involved in a typical machine learning program. The execution can also be triggered on GPU or any specialized processors through the android NN layer:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset