Face Emotion Recognition Example
HUSKYLENS 2 detects seven preset facial emotions and returns IDs, names, confidence, counts, and coordinates in real time, like a mood-aware camera viewfinder. It’s like giving your project eyes that understand basic feelings.
1.Face Emotion Recognition Blocks
Before You Start:
1.1 Face Emotion Recognition And Output Relevant Data
Under the Face Emotion Recognition function, HUSKYLENS 2 can recognize 7 specific emotions: angry (ID 1), disgust (ID 2), fear (ID 3), happiness (ID 4), neutral (ID 5), sad (ID 6), and surprise (ID 7). These emotions have already been learned by HUSKYLENS 2 at the factory, so users do not need to learn them manually again. For detailed function instructions, please see the Face Emotion Recognition.
The example program below can be used to count the total number of all recognized emotions in the current HUSKYLENS 2 camera frame and output the ID of a specific emotion.
Click to upload the program to the device in Mind+, and wait for the upload to complete.
When any of the seven emotions above appear in the camera frame, observe the HUSKYLENS 2 screen. It will frame the emotion and display its ID, name, and confidence. At the same time, the UNIHIKER K10 screen will display the result data output by the program.
Output Result: As shown below, it outputs the specified emotion ID and the total number of emotions in the frame, as required by the program.
Output Result: As shown below, when multiple emotions with a specific ID appear in the frame, it can acquire the total count, name, and coordinates of a specific emotion under that ID, among other data.
1.2 Face Emotion Recognition Blocks Description
| block | Description |
|---|---|
|
Used to obtain expression recognition data once under HUSKYLENS 2 Face Emotion Recognition. |
|
Determine whether the current image contains seven specific expressions (anger (ID 1), disgust (ID 2), fear (ID 3), happiness (ID 4), neutral (ID 5), sadness (ID 6), and surprise (ID 7)). |
|
Get data of the expression closest to the crosshair: ID, name, center X/Y coordinates, width, and height. |
|
Get the total number of detected expressions. |
|
Get the related data of a specified expression when multiple expressions are detected. |
|
Get the total number of learned expressions that have been learned by HuskyLens 2, regardless of whether they appear in the current frame. |
|
Determine whether an expression with a specified ID is present (anger (ID 1), disgust (ID 2), fear (ID 3), happiness (ID 4), neutral (ID 5), sadness (ID 6), and surprise (ID 7)). |
|
Get the number of expressions with a specified ID. |
|
Get the related data of an expression by its ID. |
|
Get the related data of one specific expression when multiple identical expressions appear. |
Was this article helpful?
