hri_emotion_recognizer
#
hri_emotion_recognizer
Quick Facts
- Category
- Debian package
hri_emotion_recognizer-None
- License
Apache-2.0
- Source code
Recognises basic emotions from detected faces.
Overview#
The hri_emotion_recognizer
node is for emotion recognition using
ONNX (Open Neural Network Exchange) models. It integrates within the
ROS4HRI framework by analyzing the output from the hri_face_detector
node to identify emotional states.
For more information about ONNX Fer Plus models, visit ONNX GitHub repository.
Preparation#
The emotion recognizer node relies on DNN models, currently supporting ONNX models, collected in the hri_emotion_models repository.
Resources#
dnn_models.emotion_recognition
: All the available emotion models are installed under this resource. It expects the model name as saved in the hri_emotion_models/model/ folder. Note not all models may be supported at this time.
ROS API#
Topics#
/humans/faces/*/expression: This topic publishes the recognized emotion for each detected face. The message includes the detected emotion and its confidence score.
Parameters#
model
: This parameter specifies the ONNX model used foremotion recognition. It is a string and defaults to
emotion-ferplus-8.onnx
. Other ONNX models can be used, but compatibility with this node should be verified as not all models may be compatible. Models should be included in hri_emotion_models/models directory.
Launch#
ros2 launch hri_emotion_recognizer emotion_recognizer.launch.py
The emotion_recognizer.launch.py
launch file accepts as arguments
and configures the defined parameters. It also
automatically transitions the node to the active state.
Example#
To test the package using the system default webcam:
Install the
usb_cam
package:sudo apt install ros-humble-usb-cam
Launch the
usb_cam
package:ros2 run usb_cam usb_cam_node_exe
In a new terminal, install launch the
hri_face_detect
package:sudo apt install ros-humble-hri-face-detect
ros2 launch hri_face_detect face_detect.launch.py rgb_camera:=<input camera namespace>
In a new terminal, run the
hri_emotion_recognizer
package:ros2 launch hri_emotion_recognizer emotion_recognizer.launch.py
Check the faces tracked and the corresponding expression
ros2 topic echo /humans/faces/tracked
ros2 topic echo /humans/faces/wstw/expression
In ROSβs RViz, add the Humans
plugin to see the expression together with the
faces detected.