quick_start.md 10.3 KB
Newer Older
1 2 3 4 5 6 7 8
OpenPose - Quick Start
====================================

## Contents
1. [Quick Start](#quick-start)
    1. [Running on Video](#running-on-video)
    2. [Running on Webcam](#running-on-webcam)
    3. [Running on Images](#running-on-images)
9
    4. [Maximum Accuracy Configuration](#maximum-accuracy-configuration)
G
gineshidalgo99 已提交
10
    5. [3-D Reconstruction](#3-d-reconstruction)
G
gineshidalgo99 已提交
11
    6. [Tracking](#tracking)
12 13 14 15 16
2. [Expected Visual Results](#expected-visual-results)



## Quick Start
G
Gines Hidalgo 已提交
17
Check that the library is working properly by running any of the following commands on any command-line interface program. In Ubuntu, Mac, and other Unix systems, use any command-line interface, such as `Terminal` or `Terminator`. In Windows, open the `PowerShell` (recommended) or Windows Command Prompt (CMD). They can be open by pressing the Windows button + X, and then A. Feel free to watch any Youtube video tutorial if you are not familiar with these non-GUI tools. Make sure that you are in the **root directory of the project** (i.e., in the OpenPose folder, not inside `build/` nor `windows/` nor `bin/`). In addition, `examples/media/video.avi` and `examples/media` do exist, no need to change the paths.
18 19 20

### Running on Video
```
G
gineshidalgo99 已提交
21
# Ubuntu and Mac
22 23 24 25 26
./build/examples/openpose/openpose.bin --video examples/media/video.avi
# With face and hands
./build/examples/openpose/openpose.bin --video examples/media/video.avi --face --hand
```
```
G
gineshidalgo99 已提交
27
:: Windows - Portable Demo
28 29 30 31 32
bin\OpenPoseDemo.exe --video examples\media\video.avi
:: With face and hands
bin\OpenPoseDemo.exe --video examples\media\video.avi --face --hand
```
```
G
gineshidalgo99 已提交
33
:: Windows - Library - Assuming you copied the DLLs following doc/installation.md#windows
34
build\x64\Release\OpenPoseDemo.exe --video examples\media\video.avi
35
:: With face and hands
36
build\x64\Release\OpenPoseDemo.exe --video examples\media\video.avi --face --hand
37 38 39 40 41 42
```



### Running on Webcam
```
G
gineshidalgo99 已提交
43
# Ubuntu and Mac
44 45 46 47 48
./build/examples/openpose/openpose.bin
# With face and hands
./build/examples/openpose/openpose.bin --face --hand
```
```
G
gineshidalgo99 已提交
49
:: Windows - Portable Demo
50 51 52 53 54
bin\OpenPoseDemo.exe
:: With face and hands
bin\OpenPoseDemo.exe --face --hand
```
```
G
gineshidalgo99 已提交
55
:: Windows - Library - Assuming you copied the DLLs following doc/installation.md#windows
56
build\x64\Release\OpenPoseDemo.exe
57
:: With face and hands
58
build\x64\Release\OpenPoseDemo.exe --face --hand
59 60 61 62 63 64
```



### Running on Images
```
G
gineshidalgo99 已提交
65
# Ubuntu and Mac
66 67 68 69 70
./build/examples/openpose/openpose.bin --image_dir examples/media/
# With face and hands
./build/examples/openpose/openpose.bin --image_dir examples/media/ --face --hand
```
```
G
gineshidalgo99 已提交
71
:: Windows - Portable Demo
72 73 74 75 76
bin\OpenPoseDemo.exe --image_dir examples\media\
:: With face and hands
bin\OpenPoseDemo.exe --image_dir examples\media\ --face --hand
```
```
G
gineshidalgo99 已提交
77
:: Windows - Library - Assuming you copied the DLLs following doc/installation.md#windows
78
build\x64\Release\OpenPoseDemo.exe --image_dir examples\media\
79
:: With face and hands
80
build\x64\Release\OpenPoseDemo.exe --image_dir examples\media\ --face --hand
81 82 83 84 85
```



### Maximum Accuracy Configuration
G
gineshidalgo99 已提交
86 87 88 89 90
This command provides the most accurate results we have been able to achieve for body, hand and face keypoint detection. However, this command will need ~10.5 GB of GPU memory (6.7 GB for COCO model) and runs at ~2 FPS on a Titan X for the body-foot model (1 FPS for COCO).

- **Note 1:** Increasing `--net_resolution` will highly reduce the frame rate and increase latency, while it might increase the accuracy. However, this accuracy increase is not guaranteed in all scenarios, required a more detailed analysis for each particular scenario. E.g., it will work better for images with very small people, but usually worse for people taking a big ratio of the image. Thus, we recommend to follow the commands below for maximum accuracy in most cases for both big and small-size people.
- **Note 2: Do not use this configuration for MPII model**, its accuracy might be harmed by this multi-scale setting. This configuration is optimal only for COCO and COCO-extended (e.g., the default BODY_25) models.

91
```
G
gineshidalgo99 已提交
92
# Ubuntu and Mac: Body
G
gineshidalgo99 已提交
93
./build/examples/openpose/openpose.bin --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25
G
gineshidalgo99 已提交
94
# Ubuntu and Mac: Body + Hand + Face
95 96 97
./build/examples/openpose/openpose.bin --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25 --hand --hand_scale_number 6 --hand_scale_range 0.4 --face
```
```
G
gineshidalgo99 已提交
98
:: Windows - Portable Demo: Body
G
gineshidalgo99 已提交
99
bin\OpenPoseDemo.exe --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25
G
gineshidalgo99 已提交
100
:: Windows - Portable Demo: Body + Hand + Face
101 102 103
bin\OpenPoseDemo.exe --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25 --hand --hand_scale_number 6 --hand_scale_range 0.4 --face
```
```
G
gineshidalgo99 已提交
104
:: Windows - Library - Assuming you copied the DLLs following doc/installation.md#windows: Body
105
build\x64\Release\OpenPoseDemo.exe --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25
G
gineshidalgo99 已提交
106
:: Windows - Library - Assuming you copied the DLLs following doc/installation.md#windows: Body + Hand + Face
107
build\x64\Release\OpenPoseDemo.exe --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25 --hand --hand_scale_number 6 --hand_scale_range 0.4 --face
108 109
```

G
gineshidalgo99 已提交
110 111 112 113 114 115
If you want to increase the accuracy value metric on COCO, while harming the qualitative accuracy, add the flag `--maximize_positives`. It reduces the thresholds to accept a person candidate. It highly increases both false and true positives. I.e., it maximizes average recall but could harm average precision. Our experience is that it looks much worse visually, but it improves the COCO accuracy numbers, so use it at your own risk.

In addition, our paper numbers are not based on the current models that have been released. We released our best model at the time but later found a better one. But given that the accuracy difference is less than 2%, we did not want to release yet another model to avoid confusion for the users (otherwise there would be more than 10 models released at this point). We will release a new one every time a major improvement is achieved.

If you are operating on Ubuntu, you can check the experimental scripts that we use to test our accuracy (we do not officially support it, i.e., we will not answer questions about it, as well as it might change it continuously), they are placed in `openpose/scripts/tests/`, called `pose_accuracy_coco_test_dev.sh` and `pose_accuracy_coco_val.sh`.

116 117


G
gineshidalgo99 已提交
118
### 3-D Reconstruction
119
1. Real-time demo
G
gineshidalgo99 已提交
120
```
G
gineshidalgo99 已提交
121
# Ubuntu and Mac
122
./build/examples/openpose/openpose.bin --flir_camera --3d --number_people_max 1
G
gineshidalgo99 已提交
123
# With face and hands
124
./build/examples/openpose/openpose.bin --flir_camera --3d --number_people_max 1 --face --hand
G
gineshidalgo99 已提交
125 126 127
```
```
:: Windows - Portable Demo
128
bin\OpenPoseDemo.exe --flir_camera --3d --number_people_max 1
G
gineshidalgo99 已提交
129
:: With face and hands
130
bin\OpenPoseDemo.exe --flir_camera --3d --number_people_max 1 --face --hand
G
gineshidalgo99 已提交
131 132
```
```
G
gineshidalgo99 已提交
133
:: Windows - Library - Assuming you copied the DLLs following doc/installation.md#windows
134
build\x64\Release\OpenPoseDemo.exe --flir_camera --3d --number_people_max 1
G
gineshidalgo99 已提交
135
:: With face and hands
136
build\x64\Release\OpenPoseDemo.exe --flir_camera --3d --number_people_max 1 --face --hand
G
gineshidalgo99 已提交
137 138
```

139
2. Saving 3-D keypoints and video
140
```
G
gineshidalgo99 已提交
141
# Ubuntu and Mac (same flags for Windows version)
142
./build/examples/openpose/openpose.bin --flir_camera --3d --number_people_max 1 --write_json output_folder_path/ --write_video_3d output_folder_path/video_3d.avi
143 144
```

145
3. Fast stereo camera image saving (without keypoint detection) for later post-processing
146
```
G
gineshidalgo99 已提交
147
# Ubuntu and Mac (same flags for Windows version)
148 149
# Saving video
# Note: saving in PNG rather than JPG will improve image quality, but slow down FPS (depending on hard disk writing speed and camera number)
150
./build/examples/openpose/openpose.bin --flir_camera --num_gpu 0 --write_video output_folder_path/video.avi --write_video_fps 5
151
# Saving images
152
# Note: saving in PNG rather than JPG will improve image quality, but slow down FPS (depending on hard disk writing speed and camera number)
G
gineshidalgo99 已提交
153
./build/examples/openpose/openpose.bin --flir_camera --num_gpu 0 --write_images output_folder_path/ --write_images_format jpg
154 155 156
```

4. Reading and processing previouly saved stereo camera images
157
```
G
gineshidalgo99 已提交
158
# Ubuntu and Mac (same flags for Windows version)
159
# Optionally add `--face` and/or `--hand` to include face and/or hands
160
# Assuming 3 cameras
G
gineshidalgo99 已提交
161
# Note: We highly recommend to reduce `--output_resolution`. E.g., for 3 cameras recording at 1920x1080, the resulting image is (3x1920)x1080, so we recommend e.g. 640x360 (x3 reduction).
162 163 164 165
# Video
./build/examples/openpose/openpose.bin --video output_folder_path/video.avi --3d_views 3 --3d --number_people_max 1 --output_resolution {desired_output_resolution}
# Images
./build/examples/openpose/openpose.bin --image_dir output_folder_path/ --3d_views 3 --3d --number_people_max 1 --output_resolution {desired_output_resolution}
166 167
```

G
Gines Hidalgo 已提交
168
5. Reconstruction when the keypoint is visible in at least `x` camera views out of the total `n` cameras
G
gineshidalgo99 已提交
169
```
G
gineshidalgo99 已提交
170
# Ubuntu and Mac (same flags for Windows version)
G
Gines Hidalgo 已提交
171
# Reconstruction when a keypoint is visible in at least 2 camera views (assuming `n` >= 2)
G
gineshidalgo99 已提交
172
./build/examples/openpose/openpose.bin --flir_camera --3d --number_people_max 1 --3d_min_views 2 --output_resolution {desired_output_resolution}
G
Gines Hidalgo 已提交
173 174
# Reconstruction when a keypoint is visible in at least max(2, min(4, n-1)) camera views
./build/examples/openpose/openpose.bin --flir_camera --3d --number_people_max 1 --output_resolution {desired_output_resolution}
G
gineshidalgo99 已提交
175 176
```

G
gineshidalgo99 已提交
177 178


G
gineshidalgo99 已提交
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
### Tracking
1. Runtime huge speed up by reducing the accuracy:
```
# Using OpenPose 1 frame, tracking the following e.g., 5 frames
./build/examples/openpose/openpose.bin --tracking 5 --number_people_max 1
```

2. Runtime speed up while keeping most of the accuracy:
```
:: Using OpenPose 1 frame and tracking another frame
./build/examples/openpose/openpose.bin --tracking 1 --number_people_max 1
```

3. Visual smoothness:
```
# Running both OpenPose and tracking on each frame. Note: There is no speed up/slow down
./build/examples/openpose/openpose.bin --tracking 0 --number_people_max 1
```



200 201 202 203 204 205 206 207 208 209 210 211 212 213
## Expected Visual Results
The visual GUI should show the original image with the poses blended on it, similarly to the pose of this gif:
<p align="center">
    <img src="media/shake.gif", width="720">
</p>

If you choose to visualize a body part or a PAF (Part Affinity Field) heat map with the command option `--part_to_show`, the result should be similar to one of the following images:
<p align="center">
    <img src="media/body_heat_maps.png", width="720">
</p>

<p align="center">
    <img src="media/paf_heat_maps.png", width="720">
</p>