Skip to content

Commit 0a71262

Browse files
committed
Update README.md
1 parent e2168fe commit 0a71262

File tree

5 files changed

+56
-49
lines changed

5 files changed

+56
-49
lines changed

README.md

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,52 @@
1-
WHENet: Real-time Fine-Grained Estimation for Wide Range Head Pose
2-
===
3-
**Yijun Zhou and James Gregson - BMVC2020**
1+
# State of art the Head Pose Estimation in Tensorflow2
42

3+
This repository includes:
4+
- ["WHENet: Real-time Fine-Grained Estimation for Wide Range Head Pose" (BMVC 2020).](https://www.bmvc2020-conference.com/assets/papers/0907.pdf) adapted from the [original source code](https://github.com/Ascend-Research/HeadPoseEstimation-WHENet).
55

6-
**Abstract:** We present an end-to-end head-pose estimation network designed to predict Euler
7-
angles through the full range head yaws from a single RGB image. Existing methods
8-
perform well for frontal views but few target head pose from all viewpoints. This has
9-
applications in autonomous driving and retail. Our network builds on multi-loss approaches
10-
with changes to loss functions and training strategies adapted to wide range
11-
estimation. Additionally, we extract ground truth labelings of anterior views from a
12-
current panoptic dataset for the first time. The resulting Wide Headpose Estimation Network
13-
(WHENet) is the first fine-grained modern method applicable to the full-range of
14-
head yaws (hence wide) yet also meets or beats state-of-the-art methods for frontal head
15-
pose estimation. Our network is compact and efficient for mobile devices and applications. [**ArXiv**](https://arxiv.org/abs/2005.10353)
166

17-
## Demo
18-
We provided two use case of the WHENet, image input and video input in this repo. Please make sure you installed all the requirments before running the demo code by `pip install -r requirements.txt`. Additionally, please download the [YOLOv3](https://drive.google.com/file/d/1wGrwu_5etcpuu_sLIXl9Nu0dwNc8YXIH/view?usp=sharing) model for head detection and put it under `yolo_v3/data`.
7+
- [RetinaFace: Single-stage Dense Face Localisation in the Wild](https://arxiv.org/abs/1905.00641) adapted from https://github.com/StanislasBertrand/RetinaFace-tf2.
198

20-
<img src=readme_imgs/video.gif height="220"/> <img src=readme_imgs/turn.JPG height="220"/>
219

22-
## Image demo
23-
To run WHENet with image input, please put images and bbox.txt under one folder (E.g. Sample/) and just run `python demo.py`.
2410

25-
Format of bbox.txt are showed below:
11+
12+
13+
<img src=images/output.png height="220"/>
14+
15+
16+
17+
## Install
18+
19+
You can install this repository with pip (requires python>=3.6);
20+
2621
```
27-
image_name,x_min y_min x_max y_max
28-
mov_001_007585.jpeg,240 0 304 83
22+
pip install headpose_estimation
2923
```
3024

31-
## Video/Webcam demo
32-
We used [YOLO_v3](https://github.com/qqwweee/keras-yolo3) in the video demo to get the cropped head image.
33-
In order to customize some of the functions we have put the yolo implementation and the pre-trained model in the repo.
34-
[Hollywood head](https://www.di.ens.fr/willow/research/headdetection/) and [Crowdhuman](https://www.crowdhuman.org/) are used to train the head detection YOLO model.
35-
````
36-
demo_video.py [--video INPUT_VIDEO_PATH] [--snapshot WHENET_MODEL] [--display DISPLAY_OPTION]
37-
[--score YOLO_CONFIDENCE_THRESHOLD] [--iou IOU_THRESHOLD] [--gpu GPU#] [--output OUTPUT_VIDEO_PATH]
38-
````
39-
Please set `--video ''` for webcam input.
25+
```bash
26+
pip install git+https://github.com/geekysethi/headpose_estimation
27+
```
28+
29+
You can also install with the `setup.py`
30+
31+
## Simple API with Face Detection
32+
To perform detection you can simple use the following lines:
33+
34+
```python
35+
36+
37+
import cv2
38+
from headpose_estimation import Headpose
39+
40+
if __name__ == "__main__":
41+
42+
headpose = Headpose()
43+
44+
img = cv2.imread("path_to_im.jpg")
45+
detections,image = headpose.run(img)
46+
```
47+
48+
This will return a list of dictionary which looks like this `[{'bbox': [xmin, ymin, xmax, ymax], 'yaw': yaw_value, 'pitch': pitch_value, 'roll': roll_value}`
49+
4050

4151
## Dependncies
4252
* EfficientNet https://github.com/qubvel/efficientnet
43-
* Yolo_v3 https://github.com/qqwweee/keras-yolo3

images/output.png

531 KB
Loading

setup.py

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
from setuptools import setup, find_packages
22
import os
3-
4-
# here = os.path.abspath(os.path.dirname(__file__))
5-
6-
7-
VERSION = '0.0.1'
3+
from pathlib import Path
4+
this_directory = Path(__file__).parent
5+
long_description = (this_directory / "README.md").read_text()
6+
VERSION = '0.0.2'
87
DESCRIPTION = 'Head pose estimation module'
9-
LONG_DESCRIPTION = 'A package that allows to build simple streams of video, audio and camera data.'
108

119
# Setting up
1210
setup(
@@ -16,18 +14,12 @@
1614
author_email="<ashish18024@iiitd.ac.in>",
1715
description=DESCRIPTION,
1816
long_description_content_type="text/markdown",
19-
long_description=LONG_DESCRIPTION,
17+
long_description=long_description,
2018
packages=find_packages(),
21-
install_requires=['opencv-python', 'tensorflow-macos',],
22-
keywords=['python', 'video', 'stream', 'video stream', 'camera stream', 'sockets'],
23-
classifiers=[
24-
"Development Status :: 1 - Planning",
25-
"Intended Audience :: Developers",
26-
"Programming Language :: Python :: 3",
27-
"Operating System :: Unix",
28-
"Operating System :: MacOS :: MacOS X",
29-
"Operating System :: Microsoft :: Windows",
30-
],
19+
install_requires=['', 'tensorflow-macos',],
20+
keywords=['python', 'image', 'face detection', 'headpose estimation', 'machine learning', 'computer vision'],
21+
22+
3123
include_package_data=True,
3224

3325
package_dir= {"cython":"headpose_estimation/face_detector/rcnn/cython/"}

test/output.png

531 KB
Loading

test/test_headpose.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,10 @@
88
image_path = '/Users/ashish/Desktop/projects/HeadPoseEstimation-WHENet/Sample/random_internet_selfie.jpg'
99
img = cv2.imread(image_path)
1010

11-
headpose.run(img)
11+
output,image = headpose.run(img)
12+
print(output)
13+
14+
cv2.imwrite("output.png",image)
15+
# cv2.imshow("image",image)
16+
# cv2.waitKey()
17+
# cv2.destroyAllWindows()

0 commit comments

Comments
 (0)