python 姿势估计
Head pose estimation is a challenging problem in computer vision because of the various steps required to solve it. Firstly, we need to locate the face in the frame and then the various facial landmarks. Now, recognizing the face seems a trivial task in this day and that is true with faces facing the camera. The problem arises when the face is at an angle. Add to that some facial landmarks are not visible due to the movement of the head. After this, we need to convert the points to 3D coordinates to find the inclination. Sounds like a lot of work? Don’t worry we will go step by step and refer two great resources that will make our work a lot easier.
头部姿势估计在计算机视觉中是一个具有挑战性的问题,因为解决它需要采取各种步骤。 首先,我们需要在框架中定位面部,然后定位各种面部标志。 现在,识别脸部在今天看来是一件微不足道的任务,对于面对相机的脸部来说确实如此。 当面部倾斜时会出现问题。 此外,由于头部的移动,一些面部标志也看不见。 之后,我们需要将这些点转换为3D坐标以找到倾斜度。 听起来需要很多工作? 不用担心,我们将一步一步地介绍两个重要的资源,这些资源将使我们的工作更加轻松。
目录 (Table of Contents)
- Requirements 要求
- Face Detection 人脸检测
- Facial Landmark Detection 脸部地标检测
- Pose Estimation 姿势估计
要求 (Requirements)
For this project, we need OpenCV and Tensorflow so let’s install them.
对于此项目,我们需要OpenCV和Tensorflow,因此让我们安装它们。
#Using pip
pip install opencv-python
pip install tensorflow#Using conda
conda install -c conda-forge opencv
conda install -c conda-forge tensorflow
人脸检测 (Face Detection)
Our first step is to find the faces in the images on which we can find facial landmarks. For this task, we will be using a Caffe model of OpenCV’s DNN module. If you are wondering how it fares against other models like Haar Cascades or Dlib’s frontal face detector or you want to know more about it in-depth then you can refer to this article:
我们的第一步是在图像中找到可以找到面部标志的面Kong。 对于此任务,我们将使用OpenCVDNN模块的Caffe模型。 如果您想知道它与Haar Cascades或Dlib的正面人脸检测器之类的其他型号相比效果如何,或者想深入了解它,那么可以参考本文:
You can download the required models from my GitHub repository.
您可以从GitHub