openvinotoolkit / open_model_zoo

Pre-trained Deep Learning models and demos (high quality and extremely fast)
https://docs.openvino.ai/latest/model_zoo.html
Apache License 2.0
4.1k stars 1.37k forks source link

Rotation order for yaw ptich and roll output in head pose estimation model #3558

Closed balegajay closed 2 years ago

balegajay commented 2 years ago

Hello,

I am currently using the head pose estimation model. I was wondering what the rotation order of output angles is. Could anyone help me out with this? I stumbled upon the usage of the head pose angles in gaze estimation demo, where using head pose angles head coordinate system is drawn. But I could not figure out the rotation order using the rotation matrix used for drawing this coordinate system. Refer this code in results_marker.cpp:

cv::line(image, cv::Point(xCenter, yCenter),
            cv::Point(static_cast<int>(xCenter + axisLength * (cosR * cosY + sinY * sinP * sinR)),
            static_cast<int>(yCenter + axisLength * cosP * sinR)),
            cv::Scalar(0, 0, 255), 2);

I guess if there is explanation for the formulae in the above code, it would also give the rotation order of the angles. Thanks in advance

balegajay commented 2 years ago

@Wovchena thank you for the changes made, sorry for the late reply. I have a few questions regarding your code changes though,

  1. You say OX is from face center to camera in the code, but the link https://docs.openvino.ai/2019_R1/_gaze_estimation_adas_0002_description_gaze_estimation_adas_0002.html says the Z axis is from face center to camera

Regards

Wovchena commented 2 years ago

You refer to gaze_estimation model, not head pose. They may have different coordinate systems. I didn't review gaze_estimation model.

balegajay commented 2 years ago

Thanks for the reply, would you please tell if the coordinate systems are the same for gaze estimation and head pose? The gaze estimation model takes head pose as its input, so I assume it should be the same

Wovchena commented 2 years ago

The models are different. gaze-estimation predicts vector coordinates, not rotation angles. The demo implementation https://github.com/openvinotoolkit/open_model_zoo/blob/3a458fc9ea2db001e08ecd4cf5c226bf5482e079/demos/gaze_estimation_demo/cpp/src/results_marker.cpp#L97 follows the coordinate system explained in README

Wovchena commented 2 years ago

There was a mistake in my head pose angles explanation. I fixed it by https://github.com/openvinotoolkit/open_model_zoo/pull/3561/commits/69f35d3cbdc4aa4fe788369047c09b43432ad8a1