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.
The emotion recognizer node relies on DNN models, currently supporting ONNX models, collected in the hri_emotion_models repository.
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.
/humans/faces/[face_id]/expression: This topic publishes the recognized emotion for each detected face. The message includes the detected emotion and its confidence score./diagnostics(diagnostic_msgs/DiagnosticArray)
model: This parameter specifies the ONNX model used for emotion recognition. It is a string and defaults toemotion-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.
ros2 launch hri_emotion_recognizer emotion_recognizer.launch.pyThe emotion_recognizer.launch.py launch file accepts as arguments and configures the defined parameters.
It also automatically transitions the node to the active state.
To test thepackage using the system default microphone:
- Install the
usb_campackage:sudo apt install ros-humble-usb-cam - Launch the
usb_campackage:ros2 run usb_cam usb_cam_node_exe - In a new terminal, install launch the
hri_face_detectpackage:sudo apt install ros-humble-hri-face-detectros2 launch hri_face_detect face_detect.launch.py rgb_camera:=<input camera namespace> - In a new terminal, run the
hri_emotion_recognizerpackage:ros2 launch hri_emotion_recognizer emotion_recognizer.launch.py - Check the faces tracked and the corresponding expression
ros2 topic echo /humans/faces/trackedros2 topic echo /humans/faces/wstw/expression
In RViz, add the Humans plugin to see the expression together with the faces detected.
