allowing us to build new types of applications and products. • Access to a lot of data • Super fast interactions • Pro-Privacy and security • Serve offline
quantized and float tuned for mobile platforms. • A new FlatBuffers-based model file format. • On-device interpreter with kernels optimized for faster execution on mobile. • TensorFlow converter to convert TF-trained models to the .tflite format. • Smaller in size - less than 300KB • Numerous pre-tested models • Java and C++ API support
in Pixel 3 Portrait mode accelerates: • Foreground-background segmentation model by over 4x • Depth estimation model by over 10x [Source: TensorFlow Lite Now Faster with Mobile GPUs]
freeze_graph --input_graph=/tmp/mobilenet_v1_224.pb \ --input_checkpoint=/tmp/checkpoints/mobilenet-10202.ckpt \ --input_binary=true \ --output_graph=/tmp/frozen_mobilenet_v1_224.pb \ --output_node_names=MobileNetV1/Predictions/Reshape_1 The process of merging the checkpoint values with the graph structure
\ --input_arrays=input \ --output_arrays=MobilenetV1/Predictions/Reshape_1 .tflite - A serialized FlatBuffer that contains TensorFlow Lite operators and tensors for the TensorFlow Lite interpreter.
tensorflow as tf converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir) converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE] tflite_quant_model = converter.convert() Lowering the precision of parameters from their training-time 32-bit floating-point representations into much smaller and efficient 8-bit integer ones
Import the TensorFlow AAR file • Build the source code with Bazel • Implement the Interpreter • Run the apk Resource: Using TensorFlow on Android Trained TF Model .tflite model file TFLite Converter Interpreter Android NN API Java API C++ API Interpreter C++ API Kernels Kernels Android App iOS App Architecture