In this section, we will cover how TFLite can be run on the two major mobile OSes: Android and iOS.
Running TFLite on mobile devices
TFLite on Android
Using TFLite on Android is as easy as adding TFLite to the dependencies field in the build.gradle file in Android Studio, and importing it into Android Studio:
dependencies {
implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly'
}
import org.tensorflow.lite.Interpreter;
Once this is done, the next step is to create an instance of the interpreter and load the model. This can be done using a helper function from the TFLite sample on GitHub called getModelPath, and by using loadModelFile to load the converted TFLite file. Now, to run the model, simply use the...