Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

just yaw? #4

Closed
XiaXuehai opened this issue Oct 19, 2016 · 5 comments
Closed

just yaw? #4

XiaXuehai opened this issue Oct 19, 2016 · 5 comments

Comments

@XiaXuehai
Copy link

XiaXuehai commented Oct 19, 2016

Estimate the head pose by cnn, just get the yaw?what about roll and pitch?

@mpatacchiola
Copy link
Owner

mpatacchiola commented Oct 19, 2016

Hi XiaXuehai

Yesterday I pushed the new code that estimate also the pitch. The pitch estimation is in the range [-45, +45] degrees. If you do a pull you should get the updated code. To make it work you have to run again the "sudo python setup.py install" command.

The reference code for the yaw estimation is here. You can easily expand that code to include the pitch. To implement the pitch and the yaw at the same time you can do something like that:

#Defining the session, object and loading the variables
sess = tf.Session() #Launch the graph in a session.
my_head_pose_estimator = CnnHeadPoseEstimator(sess) #Head pose estimation object
my_head_pose_estimator.load_pitch_variables("../../etc/tensorflow/head_pose/pitch/cnn_arch2_pitch_f2-29999")
my_head_pose_estimator.load_yaw_variables("../../etc/tensorflow/head_pose/yaw/cnn_cccdd_30k.tf")

#Here you should get from OpenCV the sub_frame containing the person's face

#Estimating the pitch and yaw angle
pitch = my_head_pose_estimator.return_pitch(sub_frame) #Evaluate the pitch angle using a CNN
 print("Estimated pitch ..... " + str(pitch[0,0,0]))
yaw = my_head_pose_estimator.return_yaw(sub_frame) #Evaluate the yaw angle using a CNN
 print("Estimated yaw ..... " + str(yaw[0,0,0]))

I will add some examples during the weekend. I can implement also the roll angle, the only problem is that the range is between [-25, +25] degrees and it could be not enough stable. Unfortunately there are not good public datasets with a wide range of poses for the roll angle. In future probably I will generate some artificial data to solve the problem.

All the best

@mpatacchiola
Copy link
Owner

mpatacchiola commented Oct 19, 2016

I added a working example for estimating the Pitch here.

You can mix yaw and pitch estimation calling the two "load_variable" functions followed by the return_yaw and return_pitch ones, as explained here.

All the best

@XiaXuehai
Copy link
Author

Thinks! Do you have some head pose datasets to test it? I test it by this,but the result was not good.

@mpatacchiola
Copy link
Owner

Actually that dataset is one of the most famous and I used it in my previous work. A network similar to the one used in Deepgaze achieved the best result ever reported on that dataset with an accuracy of 60.9% (pitch) and 62.3% (yaw) for the unknown subject test. Remember that for testing the library you have to give as input the sub frame containing the face. If you use that dataset "as is" the images are not cropped, you have to use the ground table to isolate the face and give it as input to Deepgaze.

All the best

@XiaXuehai
Copy link
Author

Got it. Thinks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants