Face Detection with TFLite model (without Firebase) in Flutter

Miguel Angel
6 min readAug 16, 2020

In this article, we will see how to detect faces using Tensorflow models without using libraries like Firebase in Flutter, the process is based on the BlazeFace model, a lightweight and well-performing face detector tailored for mobile GPU inference.

Intro

BlazeFace, a lightweight and well-performing face detector tailored for mobile GPU inference. It runs at a speed of 200–1000+ FPS on flagship devices. This super-realtime performance enables it to be applied to any augmented reality pipeline that requires an accurate facial region of interest as an input for task-specific models, such as 2D/3D facial keypoint or geometry estimation, facial features or expression classification, and face region segmentation.

Workflow

  • Get frames by camera plugin and parse planes
  • Create and initialize face detection model using tflite_flutter.
  • Create functions for parse inference results and get the coordinates of the faces.

Implementation

In this story we will only focus on the handling of tensors and initialization of the model, the installation of dependencies can be done with the help of the corresponding readme of the libraries.

--

--