How to Create a Cartoonizer with TensorFlow Lite?

AI for Art and Design

Margaret Maynard-Reid
12 min readSep 9, 2020

Written by ML GDEs Margaret Maynard-Reid and Sayak Paul

This is an end-to-end tutorial on how to convert a TensorFlow model to TensorFlow Lite (TFLite) and deploy it to an Android app to cartoonize an image captured by the camera.

We created this end-to-end tutorial to help developers with these objectives:

  • Provide a reference for the developers looking to convert models written in TensorFlow 1.x to their TFLite variants using the new features of the latest (v2) converter — for example, the MLIR-based converter, more supported ops, and improved kernels, etc.
    (In order to convert TensorFlow 2.x models in TFLite please follow this guide.)
  • How to download the .tflite models directly from TensorFlow Hub if you are only interested in using the models for deployment.
  • Understand how to use the TFLite tools such as the Android Benchmark Tool, Model Metadata, and Codegen.
  • Guide developers on how to create a mobile application with TFLite models easily, with ML Model Binding feature from Android Studio.

The project repo contains notebooks for saving and converting to .tflite models and the Android code (learn more about the SavedModel format on the…

--

--

Margaret Maynard-Reid

ML GDE (Google Developer Expert) | AI, Art & Design | 3D Fashion Designer