Spaces:
Sleeping
Sleeping
distraction detection
Browse files
README.md
CHANGED
|
@@ -1,100 +1,13 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
3. Pose estimation. After getting 68 facial landmarks, the pose could be calculated by a mutual PnP algorithm.
|
| 15 |
-
|
| 16 |
-
## Getting Started
|
| 17 |
-
|
| 18 |
-
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
|
| 19 |
-
|
| 20 |
-
### Prerequisites
|
| 21 |
-
|
| 22 |
-
The code was tested on Ubuntu 22.04 with following frameworks:
|
| 23 |
-
- ONNX Runtime: 1.17.1
|
| 24 |
-
- OpenCV: 4.5.4
|
| 25 |
-
|
| 26 |
-
### Installing
|
| 27 |
-
|
| 28 |
-
Clone the repo:
|
| 29 |
-
```bash
|
| 30 |
-
git clone https://github.com/yinguobing/head-pose-estimation.git
|
| 31 |
-
```
|
| 32 |
-
|
| 33 |
-
Install dependencies with pip:
|
| 34 |
-
```bash
|
| 35 |
-
pip install -r requirements.txt
|
| 36 |
-
```
|
| 37 |
-
|
| 38 |
-
Pre-trained models provided in the `assets` directory. Download them with Git LFS:
|
| 39 |
-
```bash
|
| 40 |
-
git lfs pull
|
| 41 |
-
```
|
| 42 |
-
|
| 43 |
-
Or, download manually from the [release page](https://github.com/yinguobing/head-pose-estimation/releases).
|
| 44 |
-
|
| 45 |
-
## Running
|
| 46 |
-
|
| 47 |
-
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.
|
| 48 |
-
|
| 49 |
-
### Video file
|
| 50 |
-
|
| 51 |
-
For any video format that OpenCV supports (`mp4`, `avi` etc.):
|
| 52 |
-
|
| 53 |
-
```bash
|
| 54 |
-
python3 main.py --video /path/to/video.mp4
|
| 55 |
-
```
|
| 56 |
-
|
| 57 |
-
### Webcam
|
| 58 |
-
|
| 59 |
-
The webcam index should be provided:
|
| 60 |
-
|
| 61 |
-
```bash
|
| 62 |
-
python3 main.py --cam 0
|
| 63 |
-
```
|
| 64 |
-
|
| 65 |
-
## Retrain the model
|
| 66 |
-
|
| 67 |
-
Tutorials: https://yinguobing.com/deeplearning/
|
| 68 |
-
|
| 69 |
-
Training code: https://github.com/yinguobing/cnn-facial-landmark
|
| 70 |
-
|
| 71 |
-
Note: PyTorch version coming soon!
|
| 72 |
-
|
| 73 |
-
## License
|
| 74 |
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
| 75 |
-
|
| 76 |
-
Meanwhile:
|
| 77 |
-
|
| 78 |
-
- The face detector is [SCRFD](https://github.com/deepinsight/insightface/tree/master/detection/scrfd) from InsightFace.
|
| 79 |
-
- The pre-trained model file was trained with various public datasets which have their own licenses.
|
| 80 |
-
|
| 81 |
-
Please refer to them for details.
|
| 82 |
-
|
| 83 |
-
## Authors
|
| 84 |
-
Yin Guobing (尹国冰) - [yinguobing](https://yinguobing.com)
|
| 85 |
-
|
| 86 |
-

|
| 87 |
-
|
| 88 |
-
## Acknowledgments
|
| 89 |
-
|
| 90 |
-
All datasets used in the training process:
|
| 91 |
-
- 300-W: https://ibug.doc.ic.ac.uk/resources/300-W/
|
| 92 |
-
- 300-VW: https://ibug.doc.ic.ac.uk/resources/300-VW/
|
| 93 |
-
- LFPW: https://neerajkumar.org/databases/lfpw/
|
| 94 |
-
- HELEN: http://www.ifp.illinois.edu/~vuongle2/helen/
|
| 95 |
-
- AFW: https://www.ics.uci.edu/~xzhu/face/
|
| 96 |
-
- IBUG: https://ibug.doc.ic.ac.uk/resources/facial-point-annotations/
|
| 97 |
-
|
| 98 |
-
The 3D face model is from OpenFace, you can find the original file [here](https://github.com/TadasBaltrusaitis/OpenFace/blob/master/lib/local/LandmarkDetector/model/pdms/In-the-wild_aligned_PDM_68.txt).
|
| 99 |
-
|
| 100 |
-
The build in face detector is [SCRFD](https://github.com/deepinsight/insightface/tree/master/detection/scrfd) from InsightFace.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Distraction
|
| 3 |
+
emoji: 🌖
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: gray
|
| 6 |
+
sdk: streamlit
|
| 7 |
+
sdk_version: 1.40.1
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
short_description: This is meant to detect whether someone is distracted or not
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|