Flutter Plugin tflite Example

What is tflite?

A Tensorflow model is converted to a Tensorflow Lite flat buffer file using Tensorflow Lite Converter (. tflite). The client, which in our instance is a mobile device operating on iOS or Android or an embedded device, receives the Tensorflow Lite flat buffer file.

tflite is a Flutter plugin for accessing TensorFlow Lite API. Supports image classification, object detection (SSD and YOLO), Pix2Pix and Deeplab and PoseNet on both iOS and Android.

To learn more, A Flutter Plugin for Accessing TensorFlow Lite API, tflite.

tflite_example

Use tflite plugin to run model on images. The image is captured by camera or selected from gallery (with the help of image_picker plugin).

Prerequisites

Create a assets folder. From https://github.com/shaqian/flutter_tflite/tree/master/example/assets dowload the following files and place them in assets folder.

  • mobilenet_v1_1.0_224.tflite
  • mobilenet_v1_1.0_224.txt
  • ssd_mobilenet.tflite
  • ssd_mobilenet.txt
  • yolov2_tiny.tflite
  • yolov2_tiny.txt
  • deeplabv3_257_mv_gpu.tflite
  • deeplabv3_257_mv_gpu.txt
  • posenet_mv1_075_float_from_checkpoints.tflite

Install

flutter packages get

Run

flutter run

Caveat

recognizeImageBinary(image) (sample code for runModelOnBinary) is slow on iOS when decoding image due to a known issue with image package.

GitHub

Source Code: flutter_tflite_example.

SHARE Flutter Plugin tflite Example

You may also like...

Leave a Reply

Your email address will not be published.

Share