Get the source code available on code aurora:
Face Detection Using OpenCV
This application demo uses Haar Feature-based Cascade Classifiers for real time face detection. The pre-trained Haar Feature-based Cascade Classifiers for face, named as XML, is already contained in OpenCV. The XML file for face is stored in the opencv/data/haarcascades/ folder. It is also put on code aurora. Read Face Detection using Haar Cascades for more details.
TensorFlow Lite implementation for MobileFaceNets
The MobileFaceNets is re-trained with a smaller batch size and input size to get a higher performance on a host PC. The trained model is loaded as a source file in this demo.
Setting Up the Board
Step 1 - Download the demo from eIQ Sample Apps and put it in /opt/tflite folder. Then enter the src folder:
root@imx8mmevk:~# cd /opt/tflite/examples-tflite/face_recognition/src/
This folder should include these files:
Step 2 - Compile the source code on the board:
Step 3 - Run the demo:
root@imx8mmevk:/opt/tflite/examples-tflite/face_recognition/src# ./FaceRecognition -c 0 -h 0.85
NOTE: -c is used to specify the camera index. '0' means the MIPI/USB camera is mounted on /dev/video0. -h is a threshold for the prediction score.
Step 4 - Add a new person to the face data set.
When the demo is running, it will detect one biggest face at real time. Once the face is detected, you can click keyboards on the right of GUI to input the new person's name. Then, click 'Add new person' to add the face to data set.
1. Detect face.
2. Input new person's name.
3. Click 'Add new person'.
NOTE: Once new faces are added, it will create a folder named 'data' in current directory. If you want to remove the new face from the data set, just delete it in 'data'.