GithubHelp home page GithubHelp logo

osmanzeki / head-pose-estimation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yinguobing/head-pose-estimation

0.0 1.0 0.0 118.39 MB

Head pose estimation by TensorFlow and OpenCV

License: MIT License

Python 100.00%

head-pose-estimation's Introduction

Head pose estimation

Real time human head pose estimation using TensorFlow and OpenCV.

demo demo

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

TensorFlow OpenCV Numpy

The code was tested on Ubuntu 20.04 and macOS Big Sur.

Installing

This repository already provided a pre-trained model for facial landmarks detection. Just git clone then you are good to go.

# From your favorite development directory:
git clone --depth=1 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 built in webcam will be used by default.

With video file

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

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

With webcam

The webcam index should be provided:

python3 main.py --cam 0

How it works

There are three major steps:

  1. Face detection. A face detector is introduced to provide a face bounding 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 pre-trained deep learning model take the face image as input and output 68 facial landmarks.

  3. Pose estimation. After getting 68 facial landmarks, the pose could be calculated by a mutual PnP algorithm.

Retrain the model

To retrain the facial landmark detection model, please refer to this series of posts (in Chinese only). 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

head-pose-estimation's People

Contributors

yinguobing avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.