pip install -r requirements.txt
The continer runs a jupyter notebook server with all requirements.
docker build -t facepose:v0 .
docker run -p 10091:8888 facepose:v0
to use the notebook with gpu:
docker run -p 10091:8888 --gpus all facepose:v0
You can see the example notebook and to make the installation eaiser use docker. Also you can install all the requirements and run this command
python DetectFacePose.py -p <image_path>
use -u <image_URL>
for urls.
Or run the command with no argument it will use your camera
python DetectFacePose.py
This repo will look into a technique that might help detect face orientation or pose. And I will focus on only detecting three main poses which are:
- Frontal Face.
- Right Profile.
- Left Profile.
Detecting tilted face either front or back is out of the scope of this post. The technique detects only out-of-plane orientation estimation which is face rotation with respect to the y-axis (pan rotation). Since the technique relies heavily on the face detection model, I used MTCNN because it produces facial landmarks that we will use to detect face poses. Simply explained when a face is detected for the first time, we extract face landmarks (i.e., right eye, left eye, nose, left mouth, and right mouth) and from these points, we calculate the angels between the right eye, left eye, and the nose using a Cartesian coordinate system for Euclidean space 2D. Setting threshold ranges -which we already experimented with- for the right eye angle and left eye angle can estimate if the face left, or right profile, or frontal face.
Facial Landmarks and Illustration for eyes anglesAs shown in the figure we are going to calculate the angles
And here an example from Head Pose Image Database:
For more details see the full document Here.