1 Star 0 Fork 0

Broken / head-pose-estimation

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

我正在找工作。预计从10月14日开始,会依次经过杭州、厦门、广州与深圳四个城市。欢迎有工作机会的小伙伴联系!yinguobing@gmail.com

Head pose estimation

This repo shows how to estimate human head pose from videos using TensorFlow and OpenCV.

demo demo

Getting Started

The following packages are required:

  • TensorFlow 1.14.
  • OpenCV 3.3 or higher.
  • Python 3.5

The code is tested on Ubuntu 16.04.

Installing

This repository comes with a pre-trained model for facial landmark detection. Just git clone then you are good to go.

# From your favorite development directory:
git clone https://github.com/yinguobing/head-pose-estimation.git

Running

A video file or a webcam index should be assigned through arguments. If no source provided, the default webcam will be used.

For video file

For any video format that OpenCV supported (mp4, avi etc.):

python3 estimate_head_pose.py --video /path/to/video.mp4

For webcam

The webcam index should be assigned:

python3 estimate_head_pose.py --cam 0

How it works

There are three major steps:

  1. 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.

  2. Facial landmark detection. A custom trained facial landmark detector based on TensorFlow is responsible for output 68 facial landmarks.

  3. Pose estimation. Once we got the 68 facial landmarks, a mutual PnP algorithms is adopted to calculate the pose.

The marks is detected frame by frame, which result in small variance between adjacent frames. This makes the pose unstable. A Kalman filter is used to solve this problem, you can draw the original pose to observe the difference.

Retrain the model

To reproduce the facial landmark detection model, you can refer to this series of posts(in Chinese only). And the training code is also open sourced: https://github.com/yinguobing/cnn-facial-landmark

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Authors

Yin Guobing (尹国冰) - yinguobing

Acknowledgments

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.

The 3D model of face comes from OpenFace, you can find the original file here.

The build in face detector comes from OpenCV. https://github.com/opencv/opencv/tree/master/samples/dnn/face_detector

MIT License Copyright (c) 2017 Yin Guobing Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/sindre/head-pose-estimation.git
git@gitee.com:sindre/head-pose-estimation.git
sindre
head-pose-estimation
head-pose-estimation
master

搜索帮助