diff --git a/.github/issue_template.md b/.github/issue_template.md index 79b9614f7f2cd29155b32a0bff60ad976e3d23a1..7717e42fb8c8ec7ea2c9e4312092dff6a1e6c1e8 100644 --- a/.github/issue_template.md +++ b/.github/issue_template.md @@ -13,6 +13,7 @@ Issues/comments that do not follow this will be **ignored or removed** with no f ### Executed command (if any) +Note: add `--logging_level 0` to get higher debug information. diff --git a/doc/demo_overview.md b/doc/demo_overview.md index 8264ed29d90d4a4920da08d5c097d9d95dc8e2c8..33071e84e53e4b381e6fe15a857564ea13bcf612 100644 --- a/doc/demo_overview.md +++ b/doc/demo_overview.md @@ -11,7 +11,7 @@ In order to learn how to use it, run `./build/examples/openpose/openpose.bin --h Each flag is divided into flag name, default value, and description. 1. Debugging -- DEFINE_int32(logging_level, 3, "The logging level. Integer in the range [0, 255]. 0 will output any log() message, while 255 will not output any. Current OpenPose library messages are in the range 0-4: 1 for low priority messages and 4 for important ones."); +- DEFINE_int32(logging_level, 4, "The logging level. Integer in the range [0, 255]. 0 will output any log() message, while 255 will not output any. Current OpenPose library messages are in the range 0-4: 1 for low priority messages and 4 for important ones."); 2. Producer - DEFINE_int32(camera, 0, "The camera index for cv::VideoCapture. Integer in the range [0, 9]."); - DEFINE_string(camera_resolution, "1280x720", "Size of the camera frames to ask for."); @@ -42,12 +42,13 @@ Each flag is divided into flag name, default value, and description. - DEFINE_string(face_net_resolution, "368x368", "Multiples of 16. Analogous to `net_resolution` but applied to the face keypoint detector. 320x320 usually works fine while giving a substantial speed up when multiple faces on the image."); 6. OpenPose Hand - DEFINE_bool(hand, false, "Enables hand keypoint detection. It will share some parameters from the body pose, e.g. `model_folder`."); -- DEFINE_string(hand_net_resolution, "368x368", "Multiples of 16. Analogous to `net_resolution` but applied to the hand keypoint detector. 320x320 usually works fine while giving a substantial speed up when multiple hands on the image."); +- DEFINE_string(hand_net_resolution, "368x368", "Multiples of 16. Analogous to `net_resolution` but applied to the hand keypoint detector. 320x320 usually works fine while giving a substantial speed up when multiple hands on the image.");t_resolution` but applied to the hand keypoint detector."); +- DEFINE_int32(hand_detection_mode, -1, "Set to 0 to perform 1-time keypoint detection (fastest), 1 for iterative detection (recommended for images and fast videos, slow method), 2 for tracking (recommended for webcam if the frame rate is >10 FPS per GPU used and for video, in practice as fast as 1-time detection), 3 for both iterative and tracking (recommended for webcam if the resulting frame rate is still >10 FPS and for video, ideally best result but slower), or -1 (default) for automatic selection (fast method for webcam, tracking for video and iterative for images)."); 7. OpenPose Rendering - DEFINE_int32(part_to_show, 0, "Part to show from the start."); - DEFINE_bool(disable_blending, false, "If blending is enabled, it will merge the results with the original frame. If disabled, it will only display the results."); 8. OpenPose Rendering Pose -- DEFINE_int32(render_pose, 1, "Set to 0 for no rendering, 1 for CPU rendering (slightly faster), and 2 for GPU rendering (slower but greater functionality, e.g. `alpha_X` flags). If rendering is enabled, it will render both `outputData` and `cvOutputData` with the original image and desired body part to be shown (i.e. keypoints, heat maps or PAFs)."); +- DEFINE_int32(render_pose, 2, "Set to 0 for no rendering, 1 for CPU rendering (slightly faster), and 2 for GPU rendering (slower but greater functionality, e.g. `alpha_X` flags). If rendering is enabled, it will render both `outputData` and `cvOutputData` with the original image and desired body part to be shown (i.e. keypoints, heat maps or PAFs)."); - DEFINE_double(alpha_pose, 0.6, "Blending factor (range 0-1) for the body part rendering. 1 will show it completely, 0 will hide it. Only valid for GPU rendering."); - DEFINE_double(alpha_heatmap, 0.7, "Blending factor (range 0-1) between heatmap and original frame. 1 will only show the heatmap, 0 will only show the frame. Only valid for GPU rendering."); 9. OpenPose Rendering Face @@ -109,15 +110,63 @@ Please, in order to check all the real time pose demo options and their details, +## Hands +Very important note, use `hand_detection_mode` accordingly. +``` +# Images +# Fast method for speed +./build/examples/openpose/openpose.bin --hand --hand_detection_mode 0 +# Iterative for higher accuracy +./build/examples/openpose/openpose.bin --hand --hand_detection_mode 1 + +# Video +# Iterative tracking for higher accuracy +./build/examples/openpose/openpose.bin --video examples/media/video.avi --hand --hand_detection_mode 3 +# Tracking for speed +./build/examples/openpose/openpose.bin --video examples/media/video.avi --hand --hand_detection_mode 2 + +# Webcam +# Fast method for speed if the frame rate is low +./build/examples/openpose/openpose.bin --hand --hand_detection_mode 0 +# Iterative for higher accuracy (but the frame rate will be reduced) +./build/examples/openpose/openpose.bin --hand --hand_detection_mode 1 +# Tracking for higher accuracy if the frame rate is high enough. Worse results than fast method if frame rate is low +./build/examples/openpose/openpose.bin --hand --hand_detection_mode 2 +# Iterative + tracking for best accuracy if frame rate is high enough. Worse results than fast method if frame rate is low +./build/examples/openpose/openpose.bin --hand --hand_detection_mode 3 +``` + + + +## Debugging Information +``` +# Basic information +./build/examples/openpose/openpose.bin --logging_level 3 +# Showing all messages +./build/examples/openpose/openpose.bin --logging_level 0 +``` + + + +## Pose + Face + Hands +``` +./build/examples/openpose/openpose.bin --face --hand +``` + + + ## Rendering Face without Pose ``` +# CPU rendering (faster) ./build/examples/openpose/openpose.bin --face --render_pose 0 --render_face 1 +# GPU rendering +./build/examples/openpose/openpose.bin --face --render_pose 0 --render_face 2 ``` -## Example -The following example runs the demo video `video.avi`, renders image frames on `output/result.avi`, and outputs JSON files in `output/`. It parallelizes over 2 GPUs, GPUs 1 and 2. Note that it will skip GPU 0: +## Basic Output Saving +The following example runs the demo video `video.avi`, renders image frames on `output/result.avi`, and outputs JSON files in `output/`. It parallelizes over 2 GPUs, GPUs 1 and 2 (note that it will skip GPU 0): ``` ./build/examples/openpose/openpose.bin --video examples/media/video.avi --num_gpu 2 --num_gpu_start 1 --write_video output/result.avi --write_keypoint_json output/ ``` diff --git a/doc/installation.md b/doc/installation.md index 2d7b17d59eddd311cbb5831bf72e8b2a5cc6844d..b87bab8b2310e5df0321f6e21e7259226d8bcd94 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -227,3 +227,4 @@ If you choose to visualize a body part or a PAF (Part Affinity Field) heat map w 2. Reduce the `--net_resolution` (e.g. to 320x176) (lower accuracy). 3. For face, reduce the `--face_net_resolution`. The resolution 320x320 usually works pretty decently. 4. Use the `MPI_4_layers` model (lower accuracy and lower number of parts). + 5. Change GPU rendering by CPU rendering to get approximately +0.5 FPS (`--render_pose 1`). diff --git a/doc/media/pose_face_hands.gif b/doc/media/pose_face_hands.gif index ed4cd1c452c17df247929293bb90c4866a37cecb..6e43b4357907f2ddea41e8e5f35580301c2efa3f 100644 Binary files a/doc/media/pose_face_hands.gif and b/doc/media/pose_face_hands.gif differ diff --git a/doc/media/pose_face_hands_old.gif b/doc/media/pose_face_hands_old.gif new file mode 100644 index 0000000000000000000000000000000000000000..ed4cd1c452c17df247929293bb90c4866a37cecb Binary files /dev/null and b/doc/media/pose_face_hands_old.gif differ diff --git a/doc/output.md b/doc/output.md index cc505af80a6258d5084ba768cccf3948d3fc9143..a0baa8acd20b25f0ac45a1a03b0af45a3ab32c1f 100644 --- a/doc/output.md +++ b/doc/output.md @@ -4,14 +4,14 @@ OpenPose Demo - Output ## Output Format -There are 2 alternatives to save the **(x,y,score) body part locations**. The `write_keypoint` flag uses the OpenCV cv::FileStorage default formats (JSON, XML and YML). However, the JSON format is only available after OpenCV 3.0. Hence, `write_keypoint_json` saves the people pose data using a custom JSON writer. For the latter, each JSON file has a `people` array of objects, where each object has an array `body_parts` containing the body part locations and detection confidence formatted as `x1,y1,c1,x2,y2,c2,...`. The coordinates `x` and `y` can be normalized to the range [0,1], [-1,1], [0, source size], [0, output size], etc., depending on the flag `keypoint_scale`. In addition, `c` is the confidence in the range [0,1]. +There are 2 alternatives to save the **(x,y,score) body part locations**. The `write_keypoint` flag uses the OpenCV cv::FileStorage default formats (JSON, XML and YML). However, the JSON format is only available after OpenCV 3.0. Hence, `write_keypoint_json` saves the people pose data using a custom JSON writer. For the latter, each JSON file has a `people` array of objects, where each object has an array `pose_keypoints` containing the body part locations and detection confidence formatted as `x1,y1,c1,x2,y2,c2,...`. The coordinates `x` and `y` can be normalized to the range [0,1], [-1,1], [0, source size], [0, output size], etc., depending on the flag `keypoint_scale`. In addition, `c` is the confidence in the range [0,1]. ``` { "version":0.1, "people":[ - {"body_parts":[1114.15,160.396,0.846207,...]}, - {"body_parts":[...]}, + {"pose_keypoints":[1114.15,160.396,0.846207,...]}, + {"pose_keypoints":[...]}, ] } ``` @@ -50,6 +50,9 @@ The saving order is body parts + background + PAFs. Any of them can be disabled Where each index is the key value corresponding to each body part in `POSE_COCO_BODY_PARTS`, e.g., 0 for "Neck", 1 for "RShoulder", etc. +### Face and Hands +The output format is analogous for hand (`hand_left_keypoints` and `hand_right_keypoints`) and face (`face_keypoints`) JSON files. + ## Reading Saved Results diff --git a/examples/openpose/openpose.cpp b/examples/openpose/openpose.cpp index a4b8aa16ff192c2b565fe573b05241c19c74686c..af60256208a13abb338d1473d318b80deacc0215 100755 --- a/examples/openpose/openpose.cpp +++ b/examples/openpose/openpose.cpp @@ -114,7 +114,7 @@ DEFINE_int32(part_to_show, 0, "Part to show from the s DEFINE_bool(disable_blending, false, "If blending is enabled, it will merge the results with the original frame. If disabled, it" " will only display the results."); // OpenPose Rendering Pose -DEFINE_int32(render_pose, 1, "Set to 0 for no rendering, 1 for CPU rendering (slightly faster), and 2 for GPU rendering" +DEFINE_int32(render_pose, 2, "Set to 0 for no rendering, 1 for CPU rendering (slightly faster), and 2 for GPU rendering" " (slower but greater functionality, e.g. `alpha_X` flags). If rendering is enabled, it will" " render both `outputData` and `cvOutputData` with the original image and desired body part" " to be shown (i.e. keypoints, heat maps or PAFs)."); @@ -215,7 +215,7 @@ op::ProducerType gflagsToProducerType(const std::string& imageDirectory, const s } std::shared_ptr gflagsToProducer(const std::string& imageDirectory, const std::string& videoPath, const int webcamIndex, - const op::Point webcamResolution, const int webcamFps) + const op::Point webcamResolution, const double webcamFps) { op::log("", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto type = gflagsToProducerType(imageDirectory, videoPath, webcamIndex); diff --git a/examples/tutorial_wrapper/1_user_asynchronous.cpp b/examples/tutorial_wrapper/1_user_asynchronous.cpp index a1fc7cb8aecc67330f049f6b6962d965f214973f..fc7d5f805a737ac0f9c7729d4bcca044dbeb8c50 100644 --- a/examples/tutorial_wrapper/1_user_asynchronous.cpp +++ b/examples/tutorial_wrapper/1_user_asynchronous.cpp @@ -101,7 +101,7 @@ DEFINE_int32(part_to_show, 0, "Part to show from the s DEFINE_bool(disable_blending, false, "If blending is enabled, it will merge the results with the original frame. If disabled, it" " will only display the results."); // OpenPose Rendering Pose -DEFINE_int32(render_pose, 1, "Set to 0 for no rendering, 1 for CPU rendering (slightly faster), and 2 for GPU rendering" +DEFINE_int32(render_pose, 2, "Set to 0 for no rendering, 1 for CPU rendering (slightly faster), and 2 for GPU rendering" " (slower but greater functionality, e.g. `alpha_X` flags). If rendering is enabled, it will" " render both `outputData` and `cvOutputData` with the original image and desired body part" " to be shown (i.e. keypoints, heat maps or PAFs)."); diff --git a/examples/tutorial_wrapper/2_user_synchronous.cpp b/examples/tutorial_wrapper/2_user_synchronous.cpp index 5b97b17f8006b46db9c99ad2427aa32ca2e79b46..86ac25dce7af50da5f5edf4f115c54c9861998e1 100644 --- a/examples/tutorial_wrapper/2_user_synchronous.cpp +++ b/examples/tutorial_wrapper/2_user_synchronous.cpp @@ -101,7 +101,7 @@ DEFINE_int32(part_to_show, 0, "Part to show from the s DEFINE_bool(disable_blending, false, "If blending is enabled, it will merge the results with the original frame. If disabled, it" " will only display the results."); // OpenPose Rendering Pose -DEFINE_int32(render_pose, 1, "Set to 0 for no rendering, 1 for CPU rendering (slightly faster), and 2 for GPU rendering" +DEFINE_int32(render_pose, 2, "Set to 0 for no rendering, 1 for CPU rendering (slightly faster), and 2 for GPU rendering" " (slower but greater functionality, e.g. `alpha_X` flags). If rendering is enabled, it will" " render both `outputData` and `cvOutputData` with the original image and desired body part" " to be shown (i.e. keypoints, heat maps or PAFs).");