Neural Nework - Face Detection
Materials
- AmebaPro2 [ AMB82 MINI ] x 1
Example
Introduction
In this example, we will be using Ameba Pro2 development board to detect faces. Faces are detected based on 5 face feature points (left eye, right eye, nose, left side of mouth and right side of mouth).
Procedure
Open face detection example in “File” -> “Example” -> “AmebaNN” -> “RTSPFaceDetection”.
Since the camera video output will be used, ensure that the “Video ISP Bin” option in “Tools” is set to enabled. Also ensure that “Neural Network Bin” is enabled to upload a flash binary that includes the required neural network binary file.
In the highlighted code snippet, fill in the “ssid” with your WiFi network SSID and “pass” with the network password.
Compile the code and upload it to Ameba. After pressing the Reset button, wait for the Ameba Pro 2 board to connect to the WiFi network. The board’s IP address and network port number for RTSP will be shown in the Serial Monitor.
The result of detected faces can be validated using VLC. You may download VLC media player from the link (here).
Upon the completion of the software installation, open VLC media player, and go to “Media” -> “Open Network Stream”.
Make sure your PC is connected to the same network as the Ameba Pro2 board for streaming. Since RTSP is used as the streaming protocol, key in “rtsp://{IPaddress}:{port}” as the Network URL in VLC media player, replacing {IPaddress} with the IP address of your Ameba Pro2 board, and {port} with the RTSP port shown in Serial Monitor (e.g., “rtsp://192.168.1.154:554”). The default RTSP port number is 554.
Next, click “Play” to start RTSP streaming to see the result. The video stream from the camera will be shown in VLC media player.
A bounding box with face landmark will be drawn to the RTSP video stream to highlight faces that are detected by the camera.
The information of the detected faces will be shown in the Serial Monitor.
Code Reference
For recommended setting to achieve better video quality, please refer to Ameba FAQ: https://forum.amebaiot.com/t/ameba-faq/1220.
You may adjust the video bitrate based on your WiFi network quality, by uncommenting the highlighted code below.