assets | ||
.gitignore | ||
demo.gif | ||
demo1.gif | ||
estimate_head_pose.py | ||
LICENSE | ||
mark_detector.py | ||
optical_flow_tracker.py | ||
pose_estimator.py | ||
README.md | ||
stabilizer.py |
Head pose estimation
This repo shows how to estimate human head pose from videos using TensorFlow and OpenCV.
How it works
There are three major steps:
-
Face detection. A face detector is adopted to provide a face box containing a human face. Then the face box is expanded and transformed to a square to suit the needs of later steps.
-
Facial landmark detection. A custom trained facial landmark detector based on TensorFlow is responsible for output 68 facial landmarks.
-
Pose estimation. Once we got the 68 facial landmarks, a mutual PnP algorithms is adopted to calculate the pose.
Miscellaneous
-
The marks is detected frame by frame, which result in small variance between adjacent frames. This makes the pose unstaible. A Kalman filter is used to solve this problem, you can draw the original pose to observe the difference.
-
The 3D model of face comes from OpenFace, you can find the original file here.
License
The code is licensed under the MIT license. However, the pre-trained TensorFlow model file is trained with various public data sets which have their own licenses. Please refer to them before using this code.
- 300-W: https://ibug.doc.ic.ac.uk/resources/300-W/
- 300-VW: https://ibug.doc.ic.ac.uk/resources/300-VW/
- LFPW: https://neerajkumar.org/databases/lfpw/
- HELEN: http://www.ifp.illinois.edu/~vuongle2/helen/
- AFW: https://www.ics.uci.edu/~xzhu/face/
- IBUG: https://ibug.doc.ic.ac.uk/resources/facial-point-annotations/