Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,115 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
---
|
4 |
+
|
5 |
+
# SynthPose (MMPose HRNet48+DarkPose variant)
|
6 |
+
|
7 |
+
The SynthPose model was proposed in [OpenCapBench: A Benchmark to Bridge Pose Estimation and Biomechanics](https://arxiv.org/abs/2406.09788) by Yoni Gozlan, Antoine Falisse, Scott Uhlrich, Anthony Gatti, Michael Black, Akshay Chaudhari.
|
8 |
+
|
9 |
+
# Intended use cases
|
10 |
+
|
11 |
+
This model uses DarkPose with an HRNet backbone.
|
12 |
+
SynthPose is a new approach that enables finetuning of pre-trained 2D human pose models to predict an arbitrarily denser set of keypoints for accurate kinematic analysis through the use of synthetic data.
|
13 |
+
More details are available in [OpenCapBench: A Benchmark to Bridge Pose Estimation and Biomechanics](https://arxiv.org/abs/2406.09788).
|
14 |
+
This particular variant was finetuned on a set of keypoints usually found on Motion Capture setups, and include coco keypoints as well.
|
15 |
+
|
16 |
+
The model predicts 52 markers:
|
17 |
+
|
18 |
+
```
|
19 |
+
[
|
20 |
+
'nose',
|
21 |
+
'left_eye',
|
22 |
+
'right_eye',
|
23 |
+
'left_ear',
|
24 |
+
'right_ear',
|
25 |
+
'left_shoulder',
|
26 |
+
'right_shoulder',
|
27 |
+
'left_elbow',
|
28 |
+
'right_elbow',
|
29 |
+
'left_wrist',
|
30 |
+
'right_wrist',
|
31 |
+
'left_hip',
|
32 |
+
'right_hip',
|
33 |
+
'left_knee',
|
34 |
+
'right_knee',
|
35 |
+
'left_ankle',
|
36 |
+
'right_ankle',
|
37 |
+
'sternum',
|
38 |
+
'rshoulder',
|
39 |
+
'lshoulder',
|
40 |
+
'r_lelbow',
|
41 |
+
'l_lelbow',
|
42 |
+
'r_melbow',
|
43 |
+
'l_melbow',
|
44 |
+
'r_lwrist',
|
45 |
+
'l_lwrist',
|
46 |
+
'r_mwrist',
|
47 |
+
'l_mwrist',
|
48 |
+
'r_ASIS',
|
49 |
+
'l_ASIS',
|
50 |
+
'r_PSIS',
|
51 |
+
'l_PSIS',
|
52 |
+
'r_knee',
|
53 |
+
'l_knee',
|
54 |
+
'r_mknee',
|
55 |
+
'l_mknee',
|
56 |
+
'r_ankle',
|
57 |
+
'l_ankle',
|
58 |
+
'r_mankle',
|
59 |
+
'l_mankle',
|
60 |
+
'r_5meta',
|
61 |
+
'l_5meta',
|
62 |
+
'r_toe',
|
63 |
+
'l_toe',
|
64 |
+
'r_big_toe',
|
65 |
+
'l_big_toe',
|
66 |
+
'l_calc',
|
67 |
+
'r_calc',
|
68 |
+
'C7',
|
69 |
+
'L2',
|
70 |
+
'T11',
|
71 |
+
'T6',
|
72 |
+
]
|
73 |
+
```
|
74 |
+
Where the first 17 keypoints are the COCO keypoints, and the next 35 are anatomical markers.
|
75 |
+
|
76 |
+
# Usage
|
77 |
+
|
78 |
+
## Installation
|
79 |
+
This implementation is based on [MMPose](https://mmpose.readthedocs.io/en/latest/).
|
80 |
+
MMpose requires torch, and the installation process is the following:
|
81 |
+
```
|
82 |
+
pip install -U openmim
|
83 |
+
mim install mmengine
|
84 |
+
mim install "mmcv>=2.0.1"
|
85 |
+
mim install "mmdet>=3.1.0"
|
86 |
+
mim install "mmpose>=1.1.0"
|
87 |
+
```
|
88 |
+
|
89 |
+
## Image inference
|
90 |
+
|
91 |
+
Here's how to load the model and run inference on an image:
|
92 |
+
|
93 |
+
```python
|
94 |
+
from huggingface_hub import snapshot_download
|
95 |
+
from mmpose.apis import MMPoseInferencer
|
96 |
+
|
97 |
+
snapshot_download(repo_id="yonigozlan/synthpose-hrnet-48-mmpose", local_dir="./synthpose-hrnet-48-mmpose")
|
98 |
+
inferencer = MMPoseInferencer(
|
99 |
+
pose2d='./synthpose-hrnet-48-mmpose/td-hm_hrnet-w48_dark-8xb32-210e_synthpose_inference.py',
|
100 |
+
pose2d_weights='./synthpose-hrnet-48-mmpose/hrnet-w48_dark.pth'
|
101 |
+
)
|
102 |
+
|
103 |
+
url = "https://farm7.staticflickr.com/6105/6218847094_20deb6b938_z.jpg"
|
104 |
+
result_generator = inferencer([url], pred_out_dir='predictions', vis_out_dir='visualizations')
|
105 |
+
results = [result for result in result_generator]
|
106 |
+
```
|
107 |
+
|
108 |
+
## Video inference
|
109 |
+
|
110 |
+
To run inference on a video, simply replace the last two lines with
|
111 |
+
|
112 |
+
```python
|
113 |
+
result_generator = inferencer("football.mp4", pred_out_dir='predictions', vis_out_dir='visualizations')
|
114 |
+
results = [result for result in result_generator]
|
115 |
+
```
|