FP-AI-FACEREC1 getting started

Revision as of 11:45, 27 November 2020 by Registered User (→‎Face Identification)

This article explains how to get started on the Face Recognition application running on STM32 microcontroller.

This article provides an overview on the following topics:

  • Overview of the required hardware setup
  • Overview of the software architecture
  • Description of the Face Reco application running on STM32

1. Hardware setup

The Face Reco application is running on a hardware setup made up of a STM32 microcontroller board connected to a camera module board.

1.1. STM32 board: STM32H747 Discovery Kit

The STM32H747I-DISCO is a complete demonstration and development platform for STMicroelectronics STM32H747XIH6 microcontroller, designed to simplify user application development. The STM32H747XIH6device is based on the high-performance Arm® Cortex®-M7 and Cortex®-M4 32-bit RISC cores. The Cortex®-M7 core operates at up to 480 MHz and the Cortex®-M4 core at up to 240 MHz.

The STM32H747XIH6device incorporates high-speed embedded memories with a dual-bank Flash memory of 2 Mbytes and of 1 Mbyte of RAM.

The other key specifications of the board are:

  • On-board STLINK-V3E debugger/programmer
  • USB OTG HS
  • 4” capacitive touch LCD display module with MIPI® DSI interface
  • 2 x 512-Mbit Quad-SPI NOR Flash memory
  • 256-Mbit SDRAM
  • 8-bit camera connector
  • microSD™ card
An image of STM32H747I-DISCO board.

1.2. Camera board

In the context of the Face Reco application the firmware supports the two following sensors:

  • The OV5640 sensor
  • The OV9655 sensor

(which is th eone mounted on the MB1379 camera daughterboard). Two camera module boards are supported:

1.2.1. STM32F4DIS-CAM camera module

The picture below shows the STM32F4DIS-CAM camera module featuring a OV9655 sensor:


1.2.2. B-CAMS-OMV based camera module

The picture below shows the B-CAMS-OMV mother board on which a MB1379 camera daughterboard is plugged:

An image of B-CAM-OMV camera board board.

The B-CAMS-OMV board is an adaptation which, on top of MB1379 camera daughterboard, enables to support camera board from OpenMV and Arducam.

In the context of the Face Reco application the firmware supports only the OV5640 sensor (which is the one mounted on the MB1379 camera daughterboard).

1.3. STM32H747I-DISCO connection to camera boards

The picture below shows how to connect the camera board to the STM32H747I-DISCO board using a flex cable:

An image of connection between STM32H747I-DISCO and camera board.

2. Software architecture

The figure below depicts the software architecture of the Face recognition application:

An image of the software architecture for the Face Reco application.

Here is below a brief description of the middleware components:

2.1. STM32 AI Runtime

This is a STM32 optimized AI library generated by the X-CUBE-AI tool when generating the C neural network model.

2.2. STM32 Image

This is a library of functions for image preprocessing: rescaling, pixel format conversion etc.

2.3. STM32 Face Detect

Library containing functions for Face Detection purpose.

2.4. STM32 Face Reco

Library containing functions for Face Recognition purpose.

3. Description of Face Reco demo application

The figure below shows the data pipe involved in the Face Recognition application:

An image of the data pipe for the Face Reco application.

3.1. Camera capture

The camera capture has the following characteristics:

  • Resolution is set to QVGA (320x240)
  • Pixel color format is set to RGB565

3.2. Frame Pre-processing

The main preprocessing stage involved in the Face Reco application is the pixel color format conversion so to convert the RGB565 captured frame into a RGB888 frame.

3.3. Face Detection

The Face Detection block is in charge of findings the faces present in the input frame (QVGA, RGB888). In the current version of the application, the maximum number of faces that can be found is set to one. The output of this block is a frame of resolution 96x96 that contains the face found in the input captured frame.

3.4. Face Recognition

The Face Recognition block is in charge of extracting features and computing a signature (feature vector) corresponding to the input face.

3.5. Face Identification

The Face Identification block is in charge of computing the distance between:

  • The vector produced by the Face Recognition block, and
  • Each of the vector stored in memory (and corresponding to the enrolled faces)

The user Face ID corresponds to the minimum distance.


Run in internal memory FPS@3.5 Default threshold so to have 1% FAR Threshold configurable via "Change Settings" menu etc..

basic enrollment with no retention