提交 0fff5a69 编写于 作者: G gineshidalgo99

Added flag cli_verbose

上级 dcc0c513
......@@ -166,7 +166,7 @@ Each flag is divided into flag name, default value, and description.
4. OpenPose Body Pose
- DEFINE_bool(body_disable, false, "Disable body keypoint detection. Option only possible for faster (but less accurate) face keypoint detection.");
- DEFINE_string(model_pose, "BODY_25", "Model to be used. E.g., `COCO` (18 keypoints), `MPI` (15 keypoints, ~10% faster), `MPI_4_layers` (15 keypoints, even faster but less accurate).");
- DEFINE_string(net_resolution, "-1x368", "Multiples of 16. If it is increased, the accuracy potentially increases. If it is decreased, the speed increases. For maximum speed-accuracy balance, it should keep the closest aspect ratio possible to the images or videos to be processed. Using `-1` in any of the dimensions, OP will choose the optimal resolution depending on the other value introduced by the user. E.g., the default `-1x368` is equivalent to `656x368` in 16:9 videos, e.g., full HD (1980x1080) and HD (1280x720) resolutions.");
- DEFINE_string(net_resolution, "-1x368", "Multiples of 16. If it is increased, the accuracy potentially increases. If it is decreased, the speed increases. For maximum speed-accuracy balance, it should keep the closest aspect ratio possible to the images or videos to be processed. Using `-1` in any of the dimensions, OP will choose the optimal aspect ratio depending on the user's input value. E.g., the default `-1x368` is equivalent to `656x368` in 16:9 resolutions, e.g., full HD (1980x1080) and HD (1280x720) resolutions.");
- DEFINE_int32(scale_number, 1, "Number of scales to average.");
- DEFINE_double(scale_gap, 0.3, "Scale gap between scales. No effect unless scale_number > 1. Initial scale is always 1. If you want to change the initial scale, you actually want to multiply the `net_resolution` by your desired initial scale.");
......@@ -178,11 +178,11 @@ Each flag is divided into flag name, default value, and description.
- DEFINE_bool(part_candidates, false, "Also enable `write_json` in order to save this information. If true, it will fill the op::Datum::poseCandidates array with the body part candidates. Candidates refer to all the detected body parts, before being assembled into people. Note that the number of candidates is equal or higher than the number of final body parts (i.e., after being assembled into people). The empty body parts are filled with 0s. Program speed will slightly decrease. Not required for OpenPose, enable it only if you intend to explicitly use this information.");
6. OpenPose Face
- DEFINE_bool(face, false, "Enables face keypoint detection. It will share some parameters from the body pose, e.g., `model_folder`. Note that this will considerable slow down the performance and increse the required GPU memory. In addition, the greater number of people on the image, the slower OpenPose will be.");
- DEFINE_bool(face, false, "Enables face keypoint detection. It will share some parameters from the body pose, e.g. `model_folder`. Note that this will considerable slow down the performance and increse the required GPU memory. In addition, the greater number of people on the image, the slower OpenPose will be.");
- DEFINE_string(face_net_resolution, "368x368", "Multiples of 16 and squared. 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.");
7. OpenPose Hand
- DEFINE_bool(hand, false, "Enables hand keypoint detection. It will share some parameters from the body pose, e.g., `model_folder`. Analogously to `--face`, it will also slow down the performance, increase the required GPU memory and its speed depends on the number of people.");
- DEFINE_bool(hand, false, "Enables hand keypoint detection. It will share some parameters from the body pose, e.g. `model_folder`. Analogously to `--face`, it will also slow down the performance, increase the required GPU memory and its speed depends on the number of people.");
- DEFINE_string(hand_net_resolution, "368x368", "Multiples of 16 and squared. Analogous to `net_resolution` but applied to the hand keypoint detector.");
- DEFINE_int32(hand_scale_number, 1, "Analogous to `scale_number` but applied to the hand keypoint detector. Our best results were found with `hand_scale_number` = 6 and `hand_scale_range` = 0.4.");
- DEFINE_double(hand_scale_range, 0.4, "Analogous purpose than `scale_gap` but applied to the hand keypoint detector. Total range between smallest and biggest scale. The scales will be centered in ratio 1. E.g., if scaleRange = 0.4 and scalesNumber = 2, then there will be 2 scales, 0.8 and 1.2.");
......@@ -193,34 +193,42 @@ Each flag is divided into flag name, default value, and description.
- DEFINE_int32(3d_min_views, -1, "Minimum number of views required to reconstruct each keypoint. By default (-1), it will require all the cameras to see the keypoint in order to reconstruct it.");
- DEFINE_int32(3d_views, 1, "Complementary option to `--image_dir` or `--video`. OpenPose will read as many images per iteration, allowing tasks such as stereo camera processing (`--3d`). Note that `--camera_parameters_folder` must be set. OpenPose must find as many `xml` files in the parameter folder as this number indicates.");
9. OpenPose Rendering
9. Extra algorithms
- DEFINE_bool(identification, false, "Experimental, not available yet. Whether to enable people identification across frames.");
- DEFINE_int32(tracking, -1, "Experimental, not available yet. Whether to enable people tracking across frames. The value indicates the number of frames where tracking is run between each OpenPose keypoint detection. Select -1 (default) to disable it or 0 to run simultaneously OpenPose keypoint detector and tracking for potentially higher accurary than only OpenPose.");
- DEFINE_int32(ik_threads, 0, "Experimental, not available yet. Whether to enable inverse kinematics (IK) from 3-D keypoints to obtain 3-D joint angles. By default (0 threads), it is disabled. Increasing the number of threads will increase the speed but also the global system latency.");
10. OpenPose Rendering
- DEFINE_int32(part_to_show, 0, "Prediction channel to visualize (default: 0). 0 for all the body parts, 1-18 for each body part heat map, 19 for the background heat map, 20 for all the body part heat maps together, 21 for all the PAFs, 22-40 for each body part pair PAF.");
- DEFINE_bool(disable_blending, false, "If enabled, it will render the results (keypoint skeletons or heatmaps) on a black background, instead of being rendered into the original image. Related: `part_to_show`, `alpha_pose`, and `alpha_pose`.");
10. OpenPose Rendering Pose
11. OpenPose Rendering Pose
- DEFINE_double(render_threshold, 0.05, "Only estimated keypoints whose score confidences are higher than this threshold will be rendered. Generally, a high threshold (> 0.5) will only render very clear body parts; while small thresholds (~0.1) will also output guessed and occluded keypoints, but also more false positives (i.e., wrong detections).");
- 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 -1, it will pick CPU if CPU_ONLY is enabled, or GPU if CUDA is enabled. 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.");
11. OpenPose Rendering Face
12. OpenPose Rendering Face
- DEFINE_double(face_render_threshold, 0.4, "Analogous to `render_threshold`, but applied to the face keypoints.");
- DEFINE_int32(face_render, -1, "Analogous to `render_pose` but applied to the face. Extra option: -1 to use the same configuration that `render_pose` is using.");
- DEFINE_double(face_alpha_pose, 0.6, "Analogous to `alpha_pose` but applied to face.");
- DEFINE_double(face_alpha_heatmap, 0.7, "Analogous to `alpha_heatmap` but applied to face.");
12. OpenPose Rendering Hand
13. OpenPose Rendering Hand
- DEFINE_double(hand_render_threshold, 0.2, "Analogous to `render_threshold`, but applied to the hand keypoints.");
- DEFINE_int32(hand_render, -1, "Analogous to `render_pose` but applied to the hand. Extra option: -1 to use the same configuration that `render_pose` is using.");
- DEFINE_double(hand_alpha_pose, 0.6, "Analogous to `alpha_pose` but applied to hand.");
- DEFINE_double(hand_alpha_heatmap, 0.7, "Analogous to `alpha_heatmap` but applied to hand.");
13. Display
14. Display
- DEFINE_bool(fullscreen, false, "Run in full-screen mode (press f during runtime to toggle).");
- DEFINE_bool(no_gui_verbose, false, "Do not write text on output images on GUI (e.g., number of current frame and people). It does not affect the pose rendering.");
- DEFINE_int32(display, -1, "Display mode: -1 for automatic selection; 0 for no display (useful if there is no X server and/or to slightly speed up the processing if visual output is not required); 2 for 2-D display; 3 for 3-D display (if `--3d` enabled); and 1 for both 2-D and 3-D display.");
14. Result Saving
15. Command Line Inteface Verbose
- DEFINE_double(cli_verbose, -1.f, "If -1, it will be disabled (default). If it is a positive integer number, it will print on the command line every `verbose` frames. If number in the range (0,1), it will print the progress every `verbose` times the total of frames.");
16. Result Saving
- DEFINE_string(write_images, "", "Directory to write rendered frames in `write_images_format` image format.");
- DEFINE_string(write_images_format, "png", "File extension and format for `write_images`, e.g., png, jpg or bmp. Check the OpenCV function cv::imwrite for all compatible extensions.");
- DEFINE_string(write_video, "", "Full file path to write rendered frames in motion JPEG video format. It might fail if the final path does not finish in `.avi`. It internally uses cv::VideoWriter. Flag `camera_fps` controls FPS.");
......@@ -232,3 +240,11 @@ Each flag is divided into flag name, default value, and description.
- DEFINE_string(write_heatmaps_format, "png", "File extension and format for `write_heatmaps`, analogous to `write_images_format`. For lossless compression, recommended `png` for integer `heatmaps_scale` and `float` for floating values.");
- DEFINE_string(write_keypoint, "", "(Deprecated, use `write_json`) Directory to write the people pose keypoint data. Set format with `write_keypoint_format`.");
- DEFINE_string(write_keypoint_format, "yml", "(Deprecated, use `write_json`) File extension and format for `write_keypoint`: json, xml, yaml & yml. Json not available for OpenCV < 3.0, use `write_json` instead.");
17. Result Saving - Extra Algorithms
- DEFINE_string(write_video_adam, "", "Experimental, not available yet. E.g., `~/Desktop/adamResult.avi`. Flag `camera_fps` controls FPS.");
- DEFINE_string(write_bvh, "", "Experimental, not available yet. E.g., `~/Desktop/mocapResult.bvh`.");
18. UDP Communication
- DEFINE_string(udp_host, "", "Experimental, not available yet. IP for UDP communication. E.g., `192.168.0.1`.");
- DEFINE_string(udp_port, "8051", "Experimental, not available yet. Port number for UDP communication.");
......@@ -288,6 +288,7 @@ OpenPose Library - Release Notes
17. Improved and added several functions to `utilities/keypoints.hpp` and Array to simplify keypoint post-processing.
18. Removed warnings from Spinnaker SDK at compiling time.
19. All bash scripts incorporate `#!/bin/bash` to tell the terminal that they are bash scripts.
20. Added flag `--verbose` to plot the progress.
2. Functions or parameters renamed:
1. By default, python example `tutorial_developer/python_2_pose_from_heatmaps.py` was using 2 scales starting at -1x736, changed to 1 scale at -1x368.
2. WrapperStructPose default parameters changed to match those of the OpenPose demo binary.
......
......@@ -98,9 +98,9 @@ int openPoseDemo()
opWrapper.configure(wrapperStructInput);
// Output (comment or use default argument to disable any output)
const op::WrapperStructOutput wrapperStructOutput{
FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), FLAGS_write_json,
FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant, FLAGS_write_images,
FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format),
FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant,
FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_write_heatmaps_format, FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
opWrapper.configure(wrapperStructOutput);
// GUI (comment or use default argument to disable any visual output)
......
......@@ -15,9 +15,12 @@ JSON_FOLDER=../evaluation/coco_val_jsons/
OP_BIN=./build/examples/openpose/openpose.bin
# # 1 scale
# $OP_BIN --image_dir $IMAGE_FOLDER --write_coco_json ${JSON_FOLDER}1_test.json --display 0 --render_pose 0
# $OP_BIN --image_dir $IMAGE_FOLDER --write_coco_json ${JSON_FOLDER}1_test_max.json --display 0 --render_pose 0 --maximize_positives
# $OP_BIN --image_dir $IMAGE_FOLDER --display 0 --render_pose 0 --cli_verbose 0.2 --write_coco_json ${JSON_FOLDER}1_test.json
# $OP_BIN --image_dir $IMAGE_FOLDER --display 0 --render_pose 0 --cli_verbose 0.2 --write_coco_json ${JSON_FOLDER}1_test_max.json \
# --maximize_positives
# 4 scales
# $OP_BIN --image_dir $IMAGE_FOLDER --write_coco_json ${JSON_FOLDER}1_4_test.json --display 0 --render_pose 0 --scale_number 4 --scale_gap 0.25 --net_resolution "1312x736"
$OP_BIN --image_dir $IMAGE_FOLDER --write_coco_json ${JSON_FOLDER}1_4_test_max.json --display 0 --render_pose 0 --scale_number 4 --scale_gap 0.25 --net_resolution "1312x736" --maximize_positives
# $OP_BIN --image_dir $IMAGE_FOLDER --display 0 --render_pose 0 --cli_verbose 0.2 --write_coco_json ${JSON_FOLDER}1_4_test.json \
# --scale_number 4 --scale_gap 0.25 --net_resolution "1312x736"
$OP_BIN --image_dir $IMAGE_FOLDER --display 0 --render_pose 0 --cli_verbose 0.2 --write_coco_json ${JSON_FOLDER}1_4_test_max.json \
--scale_number 4 --scale_gap 0.25 --net_resolution "1312x736" --maximize_positives
......@@ -15,15 +15,16 @@ JSON_FOLDER=../evaluation/coco_val_jsons/
OP_BIN=./build/examples/openpose/openpose.bin
# 1 scale
$OP_BIN --image_dir $IMAGE_FOLDER --write_coco_json ${JSON_FOLDER}1.json --display 0 --render_pose 0
# $OP_BIN --image_dir $IMAGE_FOLDER --write_coco_json ${JSON_FOLDER}1_max.json --display 0 --render_pose 0 --maximize_positives --model_pose BODY_25E
# 1 scale - Debugging
# $OP_BIN --image_dir $IMAGE_FOLDER --write_coco_json ${JSON_FOLDER}1.json --display 0 --write_images ~/Desktop/CppValidation/
$OP_BIN --image_dir $IMAGE_FOLDER --display 0 --render_pose 0 --cli_verbose 0.2 --write_coco_json ${JSON_FOLDER}1.json
# $OP_BIN --image_dir $IMAGE_FOLDER --display 0 --render_pose 0 --cli_verbose 0.2 --write_coco_json ${JSON_FOLDER}1_max.json \
# --maximize_positives
# # 3 scales
# $OP_BIN --image_dir $IMAGE_FOLDER --write_coco_json ${JSON_FOLDER}1_3.json --display 0 --render_pose 0 --scale_number 3 --scale_gap 0.25
# $OP_BIN --image_dir $IMAGE_FOLDER --display 0 --render_pose 0 --cli_verbose 0.2 --write_coco_json ${JSON_FOLDER}1_3.json \
# --scale_number 3 --scale_gap 0.25
# # 4 scales
# $OP_BIN --image_dir $IMAGE_FOLDER --write_coco_json ${JSON_FOLDER}1_4.json --display 0 --render_pose 0 --scale_number 4 --scale_gap 0.25 --net_resolution "1312x736"
# $OP_BIN --image_dir $IMAGE_FOLDER --write_coco_json ${JSON_FOLDER}1_4_max.json --display 0 --render_pose 0 --scale_number 4 --scale_gap 0.25 --net_resolution "1312x736" --maximize_positives
# $OP_BIN --image_dir $IMAGE_FOLDER --display 0 --render_pose 0 --cli_verbose 0.2 --write_coco_json ${JSON_FOLDER}1_4.json \
# --scale_number 4 --scale_gap 0.25 --net_resolution "1312x736"
# $OP_BIN --image_dir $IMAGE_FOLDER --display 0 --render_pose 0 --cli_verbose 0.2 --write_coco_json ${JSON_FOLDER}1_4_max.json \
# --scale_number 4 --scale_gap 0.25 --net_resolution "1312x736" --maximize_positives
......@@ -111,9 +111,9 @@ int tutorialAddModule1()
opWrapperT.configure(wrapperStructInput);
// Output (comment or use default argument to disable any output)
const op::WrapperStructOutput wrapperStructOutput{
FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), FLAGS_write_json,
FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant, FLAGS_write_images,
FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format),
FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant,
FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_write_heatmaps_format, FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
opWrapperT.configure(wrapperStructOutput);
// GUI (comment or use default argument to disable any visual output)
......
......@@ -110,9 +110,9 @@ int tutorialApiCpp3()
opWrapper.configure(wrapperStructExtra);
// Output (comment or use default argument to disable any output)
const op::WrapperStructOutput wrapperStructOutput{
FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), FLAGS_write_json,
FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant, FLAGS_write_images,
FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format),
FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant,
FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_write_heatmaps_format, FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
opWrapper.configure(wrapperStructOutput);
// No GUI. Equivalent to: opWrapper.configure(op::WrapperStructGui{});
......
......@@ -243,9 +243,9 @@ int tutorialApiCpp4()
opWrapperT.configure(wrapperStructExtra);
// Output (comment or use default argument to disable any output)
const op::WrapperStructOutput wrapperStructOutput{
FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), FLAGS_write_json,
FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant, FLAGS_write_images,
FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format),
FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant,
FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_write_heatmaps_format, FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
opWrapperT.configure(wrapperStructOutput);
// No GUI. Equivalent to: opWrapper.configure(op::WrapperStructGui{});
......
......@@ -193,9 +193,9 @@ int tutorialApiCpp5()
opWrapperT.configure(wrapperStructInput);
// Output (comment or use default argument to disable any output)
const op::WrapperStructOutput wrapperStructOutput{
FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), FLAGS_write_json,
FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant, FLAGS_write_images,
FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format),
FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant,
FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_write_heatmaps_format, FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
opWrapperT.configure(wrapperStructOutput);
// No GUI. Equivalent to: opWrapper.configure(op::WrapperStructGui{});
......
......@@ -161,9 +161,9 @@ int tutorialApiCpp6()
opWrapperT.configure(wrapperStructInput);
// Output (comment or use default argument to disable any output)
const op::WrapperStructOutput wrapperStructOutput{
FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), FLAGS_write_json,
FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant, FLAGS_write_images,
FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format),
FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant,
FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_write_heatmaps_format, FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
opWrapperT.configure(wrapperStructOutput);
// GUI (comment or use default argument to disable any visual output)
......
......@@ -194,9 +194,9 @@ int tutorialApiCpp7()
opWrapperT.configure(wrapperStructExtra);
// Output (comment or use default argument to disable any output)
const op::WrapperStructOutput wrapperStructOutput{
FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), FLAGS_write_json,
FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant, FLAGS_write_images,
FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format),
FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant,
FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_write_heatmaps_format, FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
opWrapperT.configure(wrapperStructOutput);
// GUI (comment or use default argument to disable any visual output)
......
......@@ -208,9 +208,9 @@ int tutorialApiCpp8()
opWrapperT.configure(wrapperStructInput);
// Output (comment or use default argument to disable any output)
const op::WrapperStructOutput wrapperStructOutput{
FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), FLAGS_write_json,
FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant, FLAGS_write_images,
FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format),
FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant,
FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_write_heatmaps_format, FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
opWrapperT.configure(wrapperStructOutput);
// No GUI. Equivalent to: opWrapper.configure(op::WrapperStructGui{});
......
......@@ -300,9 +300,9 @@ int tutorialApiCpp9()
opWrapperT.configure(wrapperStructExtra);
// Output (comment or use default argument to disable any output)
const op::WrapperStructOutput wrapperStructOutput{
FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), FLAGS_write_json,
FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant, FLAGS_write_images,
FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format),
FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_foot_json, FLAGS_write_coco_json_variant,
FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_write_heatmaps_format, FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
opWrapperT.configure(wrapperStructOutput);
// No GUI. Equivalent to: opWrapper.configure(op::WrapperStructGui{});
......
......@@ -17,11 +17,13 @@
#include <openpose/core/rectangle.hpp>
#include <openpose/core/renderer.hpp>
#include <openpose/core/scaleAndSizeExtractor.hpp>
#include <openpose/core/verbosePrinter.hpp>
#include <openpose/core/wCvMatToOpInput.hpp>
#include <openpose/core/wCvMatToOpOutput.hpp>
#include <openpose/core/wKeepTopNPeople.hpp>
#include <openpose/core/wKeypointScaler.hpp>
#include <openpose/core/wOpOutputToCvMat.hpp>
#include <openpose/core/wScaleAndSizeExtractor.hpp>
#include <openpose/core/wVerbosePrinter.hpp>
#endif // OPENPOSE_CORE_HEADERS_HPP
......@@ -108,14 +108,9 @@ namespace boost
#define CV_FOURCC cv::VideoWriter::fourcc
#define CV_GRAY2BGR cv::COLOR_GRAY2BGR
#define CV_HAAR_SCALE_IMAGE cv::CASCADE_SCALE_IMAGE
#define CV_IMWRITE_JPEG_QUALITY cv::IMWRITE_JPEG_QUALITY
#define CV_IMWRITE_PNG_COMPRESSION cv::IMWRITE_PNG_COMPRESSION
#define CV_INTER_CUBIC cv::INTER_CUBIC
#define CV_INTER_LINEAR cv::INTER_LINEAR
#define CV_L2 cv::NORM_L2
#define CV_LOAD_IMAGE_ANYDEPTH cv::IMREAD_ANYDEPTH
#define CV_LOAD_IMAGE_COLOR cv::IMREAD_COLOR
#define CV_LOAD_IMAGE_GRAYSCALE cv::IMREAD_GRAYSCALE
#define CV_TERMCRIT_EPS cv::TermCriteria::Type::EPS
#define CV_TERMCRIT_ITER cv::TermCriteria::Type::MAX_ITER
#define CV_WARP_INVERSE_MAP cv::WARP_INVERSE_MAP
......@@ -124,6 +119,23 @@ namespace boost
#define CV_WINDOW_NORMAL cv::WINDOW_NORMAL
#define CV_WINDOW_OPENGL cv::WINDOW_OPENGL
#define CV_WND_PROP_FULLSCREEN cv::WND_PROP_FULLSCREEN
// Required for alpha and beta versions, but not for rc version
#include <opencv2/imgcodecs/imgcodecs.hpp>
#ifndef CV_IMWRITE_JPEG_QUALITY
#define CV_IMWRITE_JPEG_QUALITY cv::IMWRITE_JPEG_QUALITY
#endif
#ifndef CV_IMWRITE_PNG_COMPRESSION
#define CV_IMWRITE_PNG_COMPRESSION cv::IMWRITE_PNG_COMPRESSION
#endif
#ifndef CV_LOAD_IMAGE_ANYDEPTH
#define CV_LOAD_IMAGE_ANYDEPTH cv::IMREAD_ANYDEPTH
#endif
#ifndef CV_LOAD_IMAGE_COLOR
#define CV_LOAD_IMAGE_COLOR cv::IMREAD_COLOR
#endif
#ifndef CV_LOAD_IMAGE_GRAYSCALE
#define CV_LOAD_IMAGE_GRAYSCALE cv::IMREAD_GRAYSCALE
#endif
#endif
#endif // OPENPOSE_CORE_MACROS_HPP
#ifndef OPENPOSE_CORE_VERBOSE_PRINTER_HPP
#define OPENPOSE_CORE_VERBOSE_PRINTER_HPP
#include <openpose/core/common.hpp>
namespace op
{
class OP_API VerbosePrinter
{
public:
VerbosePrinter(const double verbose, const unsigned long long numberFrames);
virtual ~VerbosePrinter();
void printVerbose(const unsigned long long frameNumber) const;
private:
const unsigned long long mNumberFrames;
const std::string mNumberFramesString;
const double mVerbose;
};
}
#endif // OPENPOSE_CORE_VERBOSE_PRINTER_HPP
......@@ -36,7 +36,7 @@ namespace op
{
template<typename TDatums>
WScaleAndSizeExtractor<TDatums>::WScaleAndSizeExtractor(
const std::shared_ptr<ScaleAndSizeExtractor>& scaleAndSizeExtractor) :
const std::shared_ptr<ScaleAndSizeExtractor>& scaleAndSizeExtractor) :
spScaleAndSizeExtractor{scaleAndSizeExtractor}
{
}
......
#ifndef OPENPOSE_CORE_W_VERBOSE_PRINTER_HPP
#define OPENPOSE_CORE_W_VERBOSE_PRINTER_HPP
#include <openpose/core/common.hpp>
#include <openpose/core/verbosePrinter.hpp>
#include <openpose/thread/worker.hpp>
namespace op
{
template<typename TDatums>
class WVerbosePrinter : public Worker<TDatums>
{
public:
explicit WVerbosePrinter(const std::shared_ptr<VerbosePrinter>& verbosePrinter);
virtual ~WVerbosePrinter();
void initializationOnThread();
void work(TDatums& tDatums);
private:
const std::shared_ptr<VerbosePrinter> spVerbosePrinter;
DELETE_COPY(WVerbosePrinter);
};
}
// Implementation
#include <openpose/utilities/pointerContainer.hpp>
namespace op
{
template<typename TDatums>
WVerbosePrinter<TDatums>::WVerbosePrinter(
const std::shared_ptr<VerbosePrinter>& verbosePrinter) :
spVerbosePrinter{verbosePrinter}
{
}
template<typename TDatums>
WVerbosePrinter<TDatums>::~WVerbosePrinter()
{
}
template<typename TDatums>
void WVerbosePrinter<TDatums>::initializationOnThread()
{
}
template<typename TDatums>
void WVerbosePrinter<TDatums>::work(TDatums& tDatums)
{
try
{
if (checkNoNullNorEmpty(tDatums))
{
// Debugging log
dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
// Profiling speed
const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__);
// Print verbose
if (checkNoNullNorEmpty(tDatums))
{
const auto tDatum = (*tDatums)[0];
spVerbosePrinter->printVerbose(tDatum.frameNumber);
}
// Profiling speed
Profiler::timerEnd(profilerKey);
Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__);
// Debugging log
dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
}
}
catch (const std::exception& e)
{
this->stop();
tDatums = nullptr;
error(e.what(), __LINE__, __FUNCTION__, __FILE__);
}
}
COMPILE_TEMPLATE_DATUM(WVerbosePrinter);
}
#endif // OPENPOSE_CORE_W_VERBOSE_PRINTER_HPP
......@@ -204,6 +204,10 @@ DEFINE_int32(display, -1, "Display mode: -1 for au
" and/or to slightly speed up the processing if visual output is not required); 2 for 2-D"
" display; 3 for 3-D display (if `--3d` enabled); and 1 for both 2-D and 3-D display.");
#endif // OPENPOSE_FLAGS_DISABLE_DISPLAY
// Command Line Interface Verbose
DEFINE_double(cli_verbose, -1.f, "If -1, it will be disabled (default). If it is a positive integer number, it will print on"
" the command line every `verbose` frames. If number in the range (0,1), it will print the"
" progress every `verbose` times the total of frames.");
// Result Saving
DEFINE_string(write_images, "", "Directory to write rendered frames in `write_images_format` image format.");
DEFINE_string(write_images_format, "png", "File extension and format for `write_images`, e.g., png, jpg or bmp. Check the OpenCV"
......@@ -230,7 +234,7 @@ DEFINE_string(write_keypoint_format, "yml", "(Deprecated, use `write
DEFINE_string(write_video_adam, "", "Experimental, not available yet. E.g., `~/Desktop/adamResult.avi`. Flag `camera_fps`"
" controls FPS.");
DEFINE_string(write_bvh, "", "Experimental, not available yet. E.g., `~/Desktop/mocapResult.bvh`.");
// UDP communication
// UDP Communication
DEFINE_string(udp_host, "", "Experimental, not available yet. IP for UDP communication. E.g., `192.168.0.1`.");
DEFINE_string(udp_port, "8051", "Experimental, not available yet. Port number for UDP communication.");
#endif // OPENPOSE_FLAGS_DISABLE_POSE
......
......@@ -87,11 +87,11 @@ namespace op
// Keep desired top N people
spPoseExtractor->keepTopPeople(tDatum.poseKeypoints, tDatum.poseScores);
// ID extractor (experimental)
tDatum.poseIds = spPoseExtractor->extractIdsLockThread(tDatum.poseKeypoints, tDatum.cvInputData,
i, tDatum.id);
tDatum.poseIds = spPoseExtractor->extractIdsLockThread(
tDatum.poseKeypoints, tDatum.cvInputData, i, tDatum.id);
// Tracking (experimental)
spPoseExtractor->trackLockThread(tDatum.poseKeypoints, tDatum.poseIds, tDatum.cvInputData, i,
tDatum.id);
spPoseExtractor->trackLockThread(
tDatum.poseKeypoints, tDatum.poseIds, tDatum.cvInputData, i, tDatum.id);
}
// Profiling speed
Profiler::timerEnd(profilerKey);
......
......@@ -71,9 +71,9 @@ namespace op
const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__);
// Render people pose
for (auto& tDatum : *tDatums)
tDatum.elementRendered = spPoseRenderer->renderPose(tDatum.outputData, tDatum.poseKeypoints,
(float)tDatum.scaleInputToOutput,
(float)tDatum.scaleNetToOutput);
tDatum.elementRendered = spPoseRenderer->renderPose(
tDatum.outputData, tDatum.poseKeypoints, (float)tDatum.scaleInputToOutput,
(float)tDatum.scaleNetToOutput);
// Profiling speed
Profiler::timerEnd(profilerKey);
Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__);
......
......@@ -584,7 +584,15 @@ namespace op
// Output workers
outputWs.clear();
// Print verbose
if (wrapperStructOutput.verbose > 0.)
{
const auto verbosePrinter = std::make_shared<VerbosePrinter>(
wrapperStructOutput.verbose, producerSharedPtr->get(CV_CAP_PROP_FRAME_COUNT));
outputWs.emplace_back(std::make_shared<WVerbosePrinter<TDatumsSP>>(verbosePrinter));
}
// Send information (e.g., to Unity) though UDP client-server communication
#ifdef USE_3D_ADAM_MODEL
if (!wrapperStructOutput.udpHost.empty() && !wrapperStructOutput.udpPort.empty())
{
......
......@@ -12,6 +12,14 @@ namespace op
*/
struct OP_API WrapperStructOutput
{
/**
* Output verbose in the command line.
* If -1, it will be disabled (default). If it is a positive integer number, it will print on"
* the command line every `verbose` frames. If number in the range (0,1), it will print the"
* progress every `verbose` times the total of frames.
*/
double verbose;
/**
* Pose (x, y, score) locations saving folder location.
* If it is empty (default), it is disabled.
......@@ -122,14 +130,14 @@ namespace op
* Since all the elements of the struct are public, they can also be manually filled.
*/
WrapperStructOutput(
const std::string& writeKeypoint = "", const DataFormat writeKeypointFormat = DataFormat::Xml,
const std::string& writeJson = "", const std::string& writeCocoJson = "",
const std::string& writeCocoFootJson = "", const int writeCocoJsonVariant = 1,
const std::string& writeImages = "", const std::string& writeImagesFormat = "",
const std::string& writeVideo = "", const double writeVideoFps = 30.,
const std::string& writeHeatMaps = "", const std::string& writeHeatMapsFormat = "",
const std::string& writeVideoAdam = "", const std::string& writeBvh = "",
const std::string& udpHost = "", const std::string& udpPort = "");
const double verbose = -1, const std::string& writeKeypoint = "",
const DataFormat writeKeypointFormat = DataFormat::Xml, const std::string& writeJson = "",
const std::string& writeCocoJson = "", const std::string& writeCocoFootJson = "",
const int writeCocoJsonVariant = 1, const std::string& writeImages = "",
const std::string& writeImagesFormat = "", const std::string& writeVideo = "",
const double writeVideoFps = 30., const std::string& writeHeatMaps = "",
const std::string& writeHeatMapsFormat = "", const std::string& writeVideoAdam = "",
const std::string& writeBvh = "", const std::string& udpHost = "", const std::string& udpPort = "");
};
}
......
......@@ -12,7 +12,8 @@ set(SOURCES_OP_CORE
point.cpp
rectangle.cpp
renderer.cpp
scaleAndSizeExtractor.cpp)
scaleAndSizeExtractor.cpp
verbosePrinter.cpp)
include(${CMAKE_SOURCE_DIR}/cmake/Utils.cmake)
prepend(SOURCES_OP_CORE_WITH_CP ${CMAKE_CURRENT_SOURCE_DIR} ${SOURCES_OP_CORE})
......
......@@ -8,4 +8,5 @@ namespace op
DEFINE_TEMPLATE_DATUM(WKeypointScaler);
DEFINE_TEMPLATE_DATUM(WOpOutputToCvMat);
DEFINE_TEMPLATE_DATUM(WScaleAndSizeExtractor);
DEFINE_TEMPLATE_DATUM(WVerbosePrinter);
}
#include <openpose/utilities/fastMath.hpp>
#include <openpose/core/verbosePrinter.hpp>
namespace op
{
VerbosePrinter::VerbosePrinter(const double verbose, const unsigned long long numberFrames) :
mNumberFrames{numberFrames},
mNumberFramesString{"/" + std::to_string(numberFrames) + "..."},
mVerbose{verbose}
{
try
{
if (mVerbose > 0. && mVerbose < 1. && mNumberFrames <= 0.)
error("Number of total frames could not be retrieved from the frames producer. Disable"
" `--verbose` or use a frames producer with known number of frames.",
__LINE__, __FUNCTION__, __FILE__);
}
catch (const std::exception& e)
{
error(e.what(), __LINE__, __FUNCTION__, __FILE__);
}
}
VerbosePrinter::~VerbosePrinter()
{
}
void VerbosePrinter::printVerbose(const unsigned long long frameNumber) const
{
try
{
// If verbose enabled
if (mVerbose > 0.)
{
bool plotResults = false;
// If first or last frame
if (frameNumber == 0 || frameNumber >= mNumberFrames-1)
plotResults = true;
// mVerbose = (0,1) --> Percentage --> Every mVerbose*numberFrames frames
else if (mVerbose < 1.)
plotResults = ((frameNumber+1) % uLongLongRound(mVerbose*mNumberFrames) == 0);
// mVerbose = integer >= 1 --> Every mVerbose frames
else
plotResults = ((frameNumber+1) % uLongLongRound(mVerbose) == 0);
// Plot results
if (plotResults)
log("Processing frame " + std::to_string(frameNumber+1) + mNumberFramesString);
}
}
catch (const std::exception& e)
{
error(e.what(), __LINE__, __FUNCTION__, __FILE__);
}
}
}
......@@ -3,12 +3,13 @@
namespace op
{
WrapperStructOutput::WrapperStructOutput(
const std::string& writeKeypoint_, const DataFormat writeKeypointFormat_, const std::string& writeJson_,
const std::string& writeCocoJson_, const std::string& writeCocoFootJson_, const int writeCocoJsonVariant_,
const std::string& writeImages_, const std::string& writeImagesFormat_, const std::string& writeVideo_,
const double writeVideoFps_, const std::string& writeHeatMaps_, const std::string& writeHeatMapsFormat_,
const std::string& writeVideoAdam_, const std::string& writeBvh_, const std::string& udpHost_,
const std::string& udpPort_) :
const double verbose_, const std::string& writeKeypoint_, const DataFormat writeKeypointFormat_,
const std::string& writeJson_, const std::string& writeCocoJson_, const std::string& writeCocoFootJson_,
const int writeCocoJsonVariant_, const std::string& writeImages_, const std::string& writeImagesFormat_,
const std::string& writeVideo_, const double writeVideoFps_, const std::string& writeHeatMaps_,
const std::string& writeHeatMapsFormat_, const std::string& writeVideoAdam_, const std::string& writeBvh_,
const std::string& udpHost_, const std::string& udpPort_) :
verbose{verbose_},
writeKeypoint{writeKeypoint_},
writeKeypointFormat{writeKeypointFormat_},
writeJson{writeJson_},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册