Code Monkey home page Code Monkey logo

wiki2020 / facepose_pytorch Goto Github PK

View Code? Open in Web Editor NEW
698.0 19.0 121.0 12.11 MB

🔥🔥The pytorch implement of the head pose estimation(yaw,roll,pitch) and emotion detection with SOTA performance in real time.Easy to deploy, easy to use, and high accuracy.Solve all problems of face detection at one time.(极简,极快,高效是我们的宗旨)

License: MIT License

Python 100.00%
pytorch facepose-pytorch headpose emotion-detection emotion-recognition

facepose_pytorch's Introduction

FacePose_pytorch

The pytorch implement of the head pose estimation(yaw,roll,pitch) and emotion detection with SOTA performance in real time.Easy to deploy, easy to use, and high accuracy.Solve all problems of face detection at one time.(极简,极快,高效是我们的宗旨)

Update Log

[2020/12]We found a better algorithm for face key points(estimates 468 3D face landmarks in real-time even on CPU or mobile devices).
#First install Anaconda3, python 3.7
pip install mediapipe
python newdectect.y (run on cpu)
You can replace the pfld algorithm(this GitHub) by yourself.
image

[2020/11]congratulate! The algorithm has been applied to the following two products: online education for children, which is used to identify whether children listen carefully; on-site meeting or school classroom, to judge the quality of speech.

The head angle, especially the accuracy of facial emotion recognition, has reached the world's top level. However, for some reasons, we only open source prediction code.

We will release the ultra-high precision model in future(Including angles and emotion). If you need, please add a github star and leave email, I will send it to you separately.
image image

Demo

# install requirements
First install Anaconda3, python 3.7,and then:
pip install numpy opencv-python 
pip install torch==1.4.0
pip install torchvision==0.5.0
Download the emoticon model (the angle model is already in the code):[https://pan.baidu.com/s/1oxznkRcP5w8lzYMAjj87-w],accesscode:WIKI


# run the simple inference script(angel)
Take a video of face rotation with a computer camera,and put it into video file
CUDA_VISIBLE_DEVICE=0 python video.py --video_name ./video/your_video_name.mp4
(tips:You can modify video.py file to infer pictures)

# run the simple inference script(emotion)
Download the emoticon model into checkpoint file,and(If you use your own photo, you need to cut out the face from the picture or use Retinaface to detection the face first. You can look at it in video.py)
CUDA_VISIBLE_DEVICE=0 python emotion.py --img ./img/surprise.jpg

At present, only one face is supported. You can try to modify the code to support the angle and expression recognition of multiple faces. It may be a bit complicated.

Training

There is no need to model train(Using my model is enough)

Introduction

  1. Firstly, the Retinaface is used to extract the face frame, and then PFLD is used to identify the key points of the face. Finally, the key points are followed up to estimate the face pose. It is very easy to deploy and use, with high precision and fast speed.
  2. We collected our own facial angle conversion data from hundreds of people and fit a simple linear model through the rotation key points of hundreds of people's faces.Experiments show that the simple mathematical linear point model is more efficient and accurate(You can also use GBDT or other algorithms to regression).
  3. At the same time, referring to several papers published in the United States summit in 2020, we developed a highly accurate emotion recognition model. Results show that the methods with 95% on raf-db, 80% on affectnet, and 98% on ferplus.At present, we predict seven kinds of expressions: "surprise", "fear", "strange", "happiness", "Sadness", "anger" and "neutral".

Performance

GPU type     | fps/s  | Angle error(yaw,roll,pitch)| emotion
Nvidia-V100  | 90     | -3°~+3°                    | 95% on average

Example

image image image image

Other Project

The following is a list of some classic face pose detection items, you can compare the effect by yourself
OpenFace:[https://github.com/TadasBaltrusaitis/OpenFace]
Dlib:[https://github.com/KeeganRen/FaceReconstruction]
3DDFA_V2:[https://github.com/cleardusk/3DDFA_V2]

FAQ

Q1. Why implement this while there are several FacePose projects already.

A1: Because the existing open source project identification error is big.And this is a Key point detection and expression detection integration project.

Q2: What exactly is the difference among this repository and the others?

A2: For example, Here are some of the common methods used by other open source projects:

  1. Dlib:It is not accurate for face key points recognition, and the error is large when the face is rotated or roll.
  2. Virtual 3D model:it is very inaccurate to compare the recognition of key points with a "2D to 3D Virtual fix model",because everyone has a different face.
  3. Through the convolution network statistics face key point bitmap, the angle is also very inaccurate.

Q3: What should I do when I find a bug?

A3: Check out the update log if it's been fixed, then pull the latest code to try again. If it doesn't help, create a new issue and describe it in detail.

Contribution

Many thanks to ElonMusk,huangwj and wangz for contributing and revising to the code and English documentation.

facepose_pytorch's People

Contributors

podidiving avatar wiki2020 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

facepose_pytorch's Issues

emotion model

hi
thanks for your great work.
I'd be greatfull if you could send me the high precision emotion model.

email: [email protected]

thanks a lot

Use different landmarks model (original: plfd)

Hi,
Could I use the different landmarks extraction model, such as the 106-landmarks model in this repo (https://github.com/deepinsight/insightface)?
In your open-source code, I see that you refer to point1, point31, point51, point60, and point72 for calculating the yaw/pitch/roll, which could be similar to point 9, point 25, point 72, point 35 and point 93 in 106-landmarks map.
Do I need to change params in formulations inside your code, such as yaw = int(yaw * 71.58 + 0.7037)? Thank you.

What is the girl's name in Readme.md

Thanks for sharing your great work on Facial Expression & Pose!
and the girl in Readme is so cute, so could you tell her name and the living room url

Thanks

I am looking forward to your work. If possible, could you please send the ultra-high precision model to [email protected]?
Thank you!

Thanks!

I would really appreciate if you send me the ultra-high precision model to [email protected].
I am looking forward to seeing more of your work!

Thank you

I am looking forward to your work. If possible, could you please send the ultra-high precision model to [email protected]?
Thank you!

Thanks !

I am looking forward to your work. It's so cool.If possible, could you please send the ultra-high precision model to [email protected]?
Thank you!

Thanks

Thank you for your perfect works!
I tried to use your model so it is so cool. Please give me your ultra-high precision model if it is possible
my gmail: [email protected]

Thanks

Thanks!

I am looking forward to your work. It's so cool.If possible, could you please send the ultra-high precision model to [email protected]?
Thank you!

Thanks !

Thanks for your work, any chance to get your ultra-precision model? [email protected]
others: Whether the code for detecting the opening and closing of the mouth and eyes is open source?

yaw pitch roll calculation principle

Hello there:
Can you provide the calculation principle of yaw pitch roll? especially:
yaw = int(yaw * 71.58 + 0.7037)
pitch = int(1.497 * pitch_dis + 18.97)
The experience value in these two lines of code?

Masked face affect to pitch value and stability

Hi,
Thank you for your great work. Your model works great with high precision and speed.
About testing with webcam and masked face, the yaw seems to be fine, while the pitch when I head-up could not be predicted.
So do you have any plan to improve the pretrained based on the current issue? Thank you
My email is [email protected].

感谢,非常非常棒!

这段时间我公司刚好需要人脸角度和表情识别两个算法做一些需求;阿里和百度找不到合适的,本来打算外包给其它公司去做这个事情,后来发现了这个项目,太棒了;测试之后角度检测虽然有一定的误差,但已经足够满足我们的需求,比其它华而不实的GIthub项目好多了,表情的准确度更是十分的精确,感谢作者的项目,为我们省下不少时间和人力成本。
另外是有新模型吗,可以有偿,感谢作者

Thanks!

I am looking forward to your work. If possible, could you please send the ultra-high precision model to [email protected] ?
Thanks!

Threshold for pose estimation?

Hi, are there any thresholds or calculations that you've made on the pitch, yaw and roll to determine where the person is looking at?

I'm not sure how to go about to calculating the direction of the gaze from the pitch, yaw and roll.

thanks!

I am looking forward to your work. If possible, could you please send the ultra-high precision model to [email protected]?
Thank you!

Thanks!

I am looking forward to your work. If possible, could you please send the ultra-high precision model to
[email protected] ?
Thank you!

add onnx conversion+inference

Thanks for this star project.

please add onnx conversion and inference script for the same to improvement performance.

Thanks!

I am looking forward to your work. It's so cool.If possible, could you please send the ultra-high precision model to [email protected]?
Thank you!

cv2.dnn.readNetFromCaffe(deploy, caffemodel)

a bug that FAILED: ReadProtoFromTextFile(param_file, param). Failed to parse NetParameter file: ./checkpoint/deploy.prototxt in function 'cv::dnn::ReadNetParamsFromTextFileOrDie',Any good suggestions?

Update on the new model

Hi, any update on the new model?
It's almost the end of November and I was wondering when the model is going to be released

About test precision.

Using 2D key points to solve the problem of face pose is not a good solution, especially in the case of large pose, such as yaw greater than 60 degrees. After testing, it is found that sometimes the face detector provided by you can not detect the face with large angle, and as long as the yaw is greater than 45 degrees, there will be an error, so we look forward to your higher precision version.In addition, the stability of pose is not very good.

Emotion Model

Hi,
thanks for your great work.
I'd be greatfull if you could send me the high precision emotion model.

email: [email protected]

thanks a lot

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.