TF Lite Task Library
Learn about optimized interfaces offered by the TF Lite Task Library for ML and DL tasks.
We'll cover the following
The TF Lite framework provides us with the tools to run ML and DL models on target hardware, such as mobile and edge devices. However, we have to develop preprocessing and postprocessing logic, including the input data preparation and output result interpretation, to use TF Lite models on these devices.
The TF Lite Task Library provides prebuilt components and utilities that handle common preprocessing and postprocessing tasks associated with ML and DL inference on mobile and edge devices. It facilitates the integration of TF Lite models into the apps without having to implement the processing steps from scratch. Let’s explore the functionalities provided by the TF Lite Task Library.
APIs supported by the Task Library
The TF Lite Task Library is a collection of pretrained models, a set of interfaces, and associated tools for common learning tasks such as vision, audio, and natural language processing. Some of the Task Library APIs are provided below:
Vision APIs
ImageClassifier
: To deploy pretrained or custom image classifiers.ObjectDetector
: To deploy pretrained or custom object detectors.ImageSegmenter
: To deploy pretrained or custom image segmenters.
Audio APIs
AudioClassifier
: To classify various types of sounds.
Natural language APIs
NLClassifier
: To classify text into various categories; it can handle different text classification models.TextSearcher
: To search for similar text in different writings.
These APIs act as building blocks to develop on-device ML solutions by providing functions to convert our vision or language data to the format expected by the model and to provide the model output in a suitable format.
Delegates
The TF Lite Task Library supports the use of delegates to optimize the performance of the prebuilt models. Delegates allow the TF Lite interpreter to offload computations to specialized hardware or software accelerators, thereby improving the performance of the TF Lite models. We can use various delegates with the TF Lite Interpreter, as the following figure illustrates.
Get hands-on with 1400+ tech skills courses.