Skip to content

OSM‐IMX93 ML Demo

AdlinkCCoE edited this page Oct 27, 2024 · 2 revisions

TensorFlow Lite Demos for i.MX 93

The implementation details of TensorFlow Lite demos running on i.MX 93 are provided in this section.

Boot the Module and traverse to mentioned directory

$ cd /usr/bin/eiq-examples-git 

Run download_models_final.py to download the binary models into the device.

$ python3 download_models_final.py

NOTE: This script is downloaded from Google Drive and GitHub. Verify that the device network is set up properly and has connection to the Internet.

Face recognition demo

This application serves as a real-time facial recognition demonstration. It computes face landmarks using the facenet model and detects faces using the pretrained Yoloface model. The demo only allows live camera input.

Navigate to the specified directory and confirm the presence of the files listed below

$  cd  /usr/bin/eiq-examples-git/face_recognition

· face_database.py

· face_detection.py

· face_recognition.py

· main.py

· yoloface_int8.tflite

· facenet_512_int_quantized.tflite

There are two ways to run the face recognition demo

1.0 Using CPU

Connect the USB camera to USB port and run the Python example to start face recognition demo.

$ python3 main.py -i /dev/video0

NOTE* : Select the appropriate port for the camera's current connection. To check it, use the v4l2-ctl --list devices command.

To Add a name to the face database:

Press "a" on the board-connected keyboard while facing the camera, then enter a new name

To Delete the name from the face database:

Enter the name by pressing the "d" key on the keyboard that is attached to the board.

2.0 Using ethos-u Delegate NPU(Hardware Acceleration)

CODE CHANGES (main.py):

Remove or Modify this line 

29 - detector = YoloFace("../models/yoloface_int8.tflite", args.delegate)
29 + detector = YoloFace("../vela_models/yoloface_int8_vela.tflite", args.delegate)

30 - recognizer = Facenet("../models/facenet_512_int_quantized.tflite", args.delegate)
30 + recognizer = Facenet("../vela_models/facenet_512_int_quantized_vela.tflite", args.delegate)

Connect the USB camera to USB port and run the Python example to start face recognition demo.

$ python3 main.py -i /dev/video0 -d /usr/lib/libethosu_delegate.so

NOTE* : Select the appropriate port for the camera's current connection. To check it, use the v4l2-ctl --list devices command.

To Add a name to the face database:

Press "a" on the board-connected keyboard while facing the camera, then enter a new name

To Delete the name from the face database:

Enter the name by pressing the "d" key on the keyboard that is attached to the board.