liveBook · Manning

TFLite

As explained in Deep Learning with Python, Third Edition

A framework for efficient on-device TensorFlow inference on mobile and embedded hardware.

TFLite is a framework for efficient on-device deep-learning inference. It targets Android and iOS smartphones, ARM CPUs, Raspberry Pi, and certain microcontrollers, keeping sensitive inputs local and avoiding network latency. section 6.3.2

Choose on-device inference when:

  • Sensitive data cannot be sent to a remote model, such as end-to-end encrypted chat messages. section 6.3.2
  • Latency matters enough to avoid a network round trip, or the application must continue working without connectivity. section 6.3.2
  • Export a Keras model with its computation graph, then deploy the resulting TensorFlow-compatible artifact on the device. section 6.3.2
model.export("path/to/location", format="tf_saved_model")             #1

reloaded_artifact = tf.saved_model.load("path/to/location")            #2
predictions = reloaded_artifact.serve(input_data)                       #2

Use the export-and-reload workflow to produce a deployable TensorFlow SavedModel before serving predictions locally or integrating the artifact with an on-device runtime. section 6.3.2

How Deep Learning with Python, Third Edition covers it

How deep it goes
Defines the deployment role and supported hardware, but stops short of explaining TFLite runtime internals or conversion details.
Examples
Uses smartphone spam detection and factory bad-cookie detection to motivate local inference.
What it assumes
Assumes a Keras model and introduces export-based deployment rather than requiring prior knowledge of mobile inference internals.
What you can do after
Operate on-device inference by exporting a Keras model and selecting TFLite for supported mobile or embedded targets.
How it connects
Connects Keras, TensorFlow SavedModel, TensorFlow Serving, ONNX Runtime, TFX, and MediaPipe.

Also explained in

Compare how 2 books explain TFLite →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with Python, Third Edition. The section links point to the parts of the book it draws on.