Face Emotion Recognition Example

Face emotion recognition on HUSKYLENS 2 lets Mind+ projects detect and count seven preset emotions and read their IDs, names and positions in real time. It’s like a smart camera that tags each face with a mood label. Blocks cover checking if any target emotion appears, counting all expressions in the frame, returning data for the one closest to the crosshair, and querying total or per‑ID counts and coordinates, even when multiple identical emotions are present.

1.Face Emotion Recognition Blocks

Before You Start:

1.1 Face Emotion Recognition - 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), happy (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 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.

Example Program:

Interface Diagram

Click 'Run' in Mind+ and wait for the program to upload.

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 M10 (User provided K10, but document context is M10) 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.

Interface Diagram

16.2 Get Data for a Specific Emotion in the Frame

When multiple emotions with the same ID appear in the frame, the following example program can be used to gather relevant data for that emotion ID.

Interface Diagram

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.

Interface Diagram

16.3 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?

TOP