原文:Github 項目 - OpenPose 參數說明 - AIUAI
OpenPose 作為強大的關鍵點估計項目,其提供了很多可配置參數選項.
完整參數清單可運作:
# buntu
cd OPENPOSE_ROOT/
./build/examples/openpose/openpose.bin --help
複制
OpenPose 運作,如:
# Ubuntu: Body + Hand + Face
./build/examples/openpose/openpose.bin
-image_dir /path/to/images/
--num_gpu_start 1
--display 2
--fullscreen
--write_images /path/to/res_images/
--net_resolution "1312x736"
--scale_number 4
--scale_gap 0.25
--hand
--hand_scale_number 6
--hand_scale_range 0.4
--face
複制
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLiAjM2EzLcd3LcJzLcJzdllmVldWYtl2PnVGcq5yayonMiZXO5VXavwFN3kjM4YTMtUGall3LcVmdhNXLwRHdo9CXt92YucWbpRWdvx2Yx5yazF2Lc9CX6MHc0RHaiojIsJye.jpeg)
# Ubuntu: Body
./build/examples/openpose/openpose.bin
--image_dir /path/to/images/
--num_gpu_start 1
--display 2
--fullscreen
--write_images /path/to/res_images/
複制
1. 部分關鍵參數
Main Flags
-
: 開啟 Face 關鍵點檢測.--face
-
: 開啟 Hand 關鍵點檢測--hand
-
: 讀取 Video.--video input.mp4
-
: 讀取 webcam number 3.--camera 3
-
: 運作圖像路徑内的圖檔.--image_dir path_to_images/
-
: 在 streamed IP camera 上運作. 參考public IP cameras 例子.--ip_camera http://iris.not.iac.es/axis-cgi/mjpg/video.cgi?resolution=320x240?x.mjpeg
-
: 将處理後的圖檔儲存為 Video.--write_video path.avi
-
: 将處理後的圖檔儲存到指定路徑.--write_images folder_path
-
: 在指定路徑輸出包含人體姿态資料的 JSON, XML 或 YML 檔案.--write_keypoint path/
-
: 對于視訊,可能在實時運作時,跳過某些視訊幀.--process_real_time
-
: 如果--disable_blending
,則在很色背景上渲染估計結果(如 keypoints skeletons 和 heatmaps),而不顯示原始圖像. Related:--disable_blending=True
,part_to_show
, andalpha_pose
.alpha_pose
-
: 可視化的預測通道(Prediction channel).--part_to_show
-
: 不打開可視化顯示視窗. 對于伺服器部署和 OpenPose 加速很幫助.--display 0
-
: 多 GPUs 時,設定開始的 GPU id. 預設使用所有可用的 GPUs.--num_gpu 2 --num_gpu_start 1
-
: 采用的模型Model,影響 Keypoints 的數量、運作速度和精度.--model_pose MPI
-
: Logging messages threshold, range [0,255]: 0 - 輸出所有資訊e & 255 - 不輸出任何資訊. Current messages in the range [1-4], 1 for low priority messages and 4 for important ones.--logging_level 3
2. 參數說明
Flags Description
每個 Flag 包括
flag_name
,
default value
和
description
.
2.1 Debugging/Other
- 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_bool(disable_multi_thread, false, “It would slightly reduce the frame rate in order to highly reduce the lag. Mainly useful for 1) Cases where it is needed a low latency (e.g., webcam in real-time scenarios with low-range GPU devices); and 2) Debugging OpenPose when it is crashing to locate the error.”); 多線程
- DEFINE_int32(profile_speed, 1000, “If PROFILER_ENABLED was set in CMake or Makefile.config files, OpenPose will show some runtime statistics at this frame number.”);
2.2 Producer
- DEFINE_int32(camera, -1, “The camera index for cv::VideoCapture. Integer in the range [0, 9]. Select a negative number (by default), to auto-detect and open the first available camera.”); 相機作為輸入
- DEFINE_string(camera_resolution, “-1x-1”, "Set the camera resolution (either
or--camera
).--flir_camera
will use the default 1280x720 for-1x-1
, or the maximum flir camera resolution available for--camera
"); 相機分辨率--flir_camera
- DEFINE_string(video, “”, “Use a video file instead of the camera. Use
for our default example video.”); Video 作為輸入,而不采用相機examples/media/video.avi
- DEFINE_string(image_dir, “”, “Process a directory of images. Use
for our default example folder with 20 images. Read all standard formats (jpg, png, bmp, etc.).”); 待處理圖像的路徑examples/media/
- DEFINE_bool(flir_camera, false, “Whether to use FLIR (Point-Grey) stereo camera.”); 是否使用 FLIR 相機
- DEFINE_int32(flir_camera_index, -1, “Select -1 (default) to run on all detected flir cameras at once. Otherwise, select the flir camera index to run, where 0 corresponds to the detected flir camera with the lowest serial number, and
to then
-th lowest serial number camera.”); 可用作為輸入的 FLIR 相機n
- DEFINE_string(ip_camera, “”, “String with the IP camera URL. It supports protocols like RTSP and HTTP.”); IP 相機 URL
- DEFINE_uint64(frame_first, 0, “Start on desired frame number. Indexes are 0-based, i.e., the first frame has index 0.”); 指定開始運作的幀索引
- DEFINE_uint64(frame_step, 1, “Step or gap between processed frames. E.g.,
would read and process frames 0, 5, 10, etc…”); 跳過處理的幀數--frame_step 5
- DEFINE_uint64(frame_last, -1, “Finish on desired frame number. Select -1 to disable. Indexes are 0-based, e.g., if set to 10, it will process 11 frames (0-10).”); 指定結束運作的幀索引
- DEFINE_bool(frame_flip, false, “Flip/mirror each frame (e.g., for real time webcam demonstrations).”); 每一幀進行 Flip/Mirror 處理
- DEFINE_int32(frame_rotate, 0, “Rotate each frame, 4 possible values: 0, 90, 180, 270.”); 每一幀進行旋轉 rotate 處理
- DEFINE_bool(frames_repeat, false, “Repeat frames when finished.”); 結束時重複幀
- DEFINE_bool(process_real_time, false, “Enable to keep the original source frame rate (e.g., for video). If the processing time is too long, it will skip frames. If it is too fast, it will slow it down.”); 實時處理
- DEFINE_string(camera_parameter_folder, “models/cameraParameters/flir/”, “String with the folder where the camera parameters are located.”); 相機參數所在路徑
- DEFINE_bool(frame_keep_distortion, false, “If false (default), it will undistortionate the image based on the
camera parameters; if true, it will not undistortionate, i.e., it will leave it as it is.”); 每一幀是否扭曲 distortion 處理camera_parameter_folder
2.3 OpenPose
- DEFINE_string(model_folder, “models/”, “Folder path (absolute or relative) where the models (pose, face, …) are located.”); 模型放置路徑
- DEFINE_string(output_resolution, “-1x-1”, “The image resolution (display and output). Use “-1x-1” to force the program to use the input image resolution.”); 輸出圖像分辨率
- DEFINE_int32(num_gpu, -1, “The number of GPU devices to use. If negative, it will use all the available GPUs in your machine.”); 使用的 GPU 設定
- DEFINE_int32(num_gpu_start, 0, “GPU device start number.”); GPU ID 設定
- DEFINE_int32(keypoint_scale, 0, “Scaling of the (x,y) coordinates of the final pose data array, i.e., the scale of the (x,y) coordinates that will be saved with the
&write_json
flags. Select to scale it to the original source resolution;write_keypoint
to scale it to the net output size (set with1
);net_resolution
to scale it to the final output size (set with2
);resolution
to scale it in the range [0,1], where (0,0) would be the top-left corner of the image, and (1,1) the bottom-right one; and 4 for range [-1,1], where (-1,-1) would be the top-left corner of the image, and (1,1) the bottom-right one. Non related with3
andscale_number
.”); Keypoints 縮放尺度scalescale_gap
- DEFINE_int32(number_people_max, -1, “This parameter will limit the maximum number of people detected, by keeping the people with top scores. The score is based in person area over the image, body part score, as well as joint score (between each pair of connected body parts). Useful if you know the exact number of people in the scene, so it can remove false positives (if all the people have been detected. However, it might also include false negatives by removing very small or highly occluded people. -1 will keep them all.”); 檢測到的人體數量
- DEFINE_bool(maximize_positives, false,“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.”); 最大正樣本設定,降低作為人體候選的門檻值,能夠最大化平均 Recall,但會降低平均 Precision
- DEFINE_double(fps_max, -1., “Maximum processing frame rate. By default (-1), OpenPose will process frames as fast as possible. Example usage: If OpenPose is displaying images too quickly, this can reduce the speed so the user can analyze better each frame from the GUI.”); 最大處理的幀速率
2.4 OpenPose Body Pose
- DEFINE_bool(body_disable, false, “Disable body keypoint detection. Option only possible for faster (but less accurate) face keypoint detection.”); 是否檢測 Body 關鍵點
- DEFINE_string(model_pose, “BODY_25”, “Model to be used. E.g.,
(18 keypoints),COCO
(15 keypoints, ~10% faster),MPI
(15 keypoints, even faster but less accurate).”); 采用的 Body 模型,如MPI_4_layers
Body_25
- 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
in any of the dimensions, OP will choose the optimal aspect ratio depending on the user’s input value. E.g., the default-1
is equivalent to-1x368
in 16:9 resolutions, e.g., full HD (1980x1080) and HD (1280x720) resolutions.”); 模型網絡的輸入分辨率,16的倍數656x368
- DEFINE_int32(scale_number, 1, “Number of scales to average.”); 多尺度Scales 數
- 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
by your desired initial scale.”); 尺度Scales 間的 scale gapnet_resolution
2.5 OpenPose Body Pose Heatmaps and Part Candidates
- DEFINE_bool(heatmaps_add_parts, false, “If true, it will fill op::Datum::poseHeatMaps array with the body part heatmaps, and analogously face & hand heatmaps to op::Datum::faceHeatMaps & op::Datum::handHeatMaps. If more than one
flag is enabled, it will place then in sequential memory order: body parts + bkg + PAFs. It will follow the order on POSE_BODY_PART_MAPPING inadd_heatmaps_X
. Program speed will considerably decrease. Not required for OpenPose, enable it only if you intend to explicitly use this information later.”); 是否添加 Body Parts 的 heatmapssrc/openpose/pose/poseParameters.cpp
- DEFINE_bool(heatmaps_add_bkg, false, “Same functionality as
, but adding the heatmap corresponding to background.”); 是否添加 BKG 的 heatmapsadd_heatmaps_parts
- DEFINE_bool(heatmaps_add_PAFs, false, “Same functionality as
, but adding the PAFs.”); 是否添加 PAFs 的 heatmapsadd_heatmaps_parts
- DEFINE_int32(heatmaps_scale, 2, “Set 0 to scale op::Datum::poseHeatMaps in the range [-1,1], 1 for [0,1]; 2 for integer rounded [0,255]; and 3 for no scaling.”); heatmaps scale
- DEFINE_bool(part_candidates, false, “Also enable
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.”); 是否儲存 Body Part Candidateswrite_json
2.6 OpenPose Face
- DEFINE_bool(face, false, “Enables face keypoint detection. It will share some parameters from the body pose, e.g.
. 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.”); 是否進行 Face 關鍵點檢測model_folder
- DEFINE_string(face_net_resolution, “368x368”, “Multiples of 16 and squared. Analogous to
but applied to the face keypoint detector. 320x320 usually works fine while giving a substantial speed up when multiple faces on the image.”); Face 模型網絡的輸入分辨率net_resolution
2.7 OpenPose Hand
- DEFINE_bool(hand, false, “Enables hand keypoint detection. It will share some parameters from the body pose, e.g.
. Analogously tomodel_folder
, it will also slow down the performance, increase the required GPU memory and its speed depends on the number of people.”); 是否進行 Hand 關鍵點檢測--face
- DEFINE_string(hand_net_resolution, “368x368”, “Multiples of 16 and squared. Analogous to
but applied to the hand keypoint detector.”); Hand 模型的網絡輸入分辨率net_resolution
- DEFINE_int32(hand_scale_number, 1, “Analogous to
but applied to the hand keypoint detector. Our best results were found withscale_number
= 6 andhand_scale_number
= 0.4.”); 類似于hand_scale_range
參數,但隻用于 Hand 關鍵點檢測scale_number
- DEFINE_double(hand_scale_range, 0.4, “Analogous purpose than
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.”); 類似于scale_gap
參數,但隻用于 Hand 關鍵點檢測scale_gap
- DEFINE_bool(hand_tracking, false, “Adding hand tracking might improve hand keypoints detection for webcam (if the frame rate is high enough, i.e., >7 FPS per GPU) and video. This is not person ID tracking, it simply looks for hands in positions at which hands were located in previous frames, but it does not guarantee the same person ID among frames.”); Hand 追蹤Tracking
2.8 OpenPose 3-D Reconstruction
- DEFINE_bool(3d, false, “Running OpenPose 3-D reconstruction demo: 1) Reading from a stereo camera system. 2) Performing 3-D reconstruction from the multiple views. 3) Displaying 3-D reconstruction results. Note that it will only display 1 person. If multiple people is present, it will fail.”); 是否進行 3D 重建Reconstruction
- 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.”); 重構每個關鍵點所需的最小視角Views 數
- DEFINE_int32(3d_views, 1, “Complementary option to
or--image_dir
. OpenPose will read as many images per iteration, allowing tasks such as stereo camera processing (--video
). Note that--3d
must be set. OpenPose must find as many--camera_parameters_folder
files in the parameter folder as this number indicates.”); **3D 視角Videos **xml
2.9 Extra algorithms
- DEFINE_bool(identification, false, “Experimental, not available yet. Whether to enable people identification across frames.”); 是否跨幀 Person Identification(暫不可用)
- 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.”); 是否跨幀 Person Tracking(暫不可用)
- 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.”); 是否可以 inverse kinematics (暫不可用)
2.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.”); 可視化顯示的 Body Parts
- 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
, andalpha_pose
.”); 是否渲染可視化輸出結果alpha_pose
2.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.,
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 bothalpha_X
andoutputData
with the original image and desired body part to be shown (i.e., keypoints, heat maps or PAFs).”); 渲染姿态,0 - no rendering, 1 - CPU rendering,2 - GPU renderingcvOutputData
- 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.”); Body Part rendering 的渲染因子, 隻可用于 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.”); heatmaps 和原始幀圖像的渲染因子, GPU rendering
2.12 OpenPose Rendering Face
- DEFINE_double(face_render_threshold, 0.4, “Analogous to
, but applied to the face keypoints.”); 類似于render_threshold
,但用于 Face 關鍵點render_threshold
- DEFINE_int32(face_render, -1, “Analogous to
but applied to the face. Extra option: -1 to use the same configuration thatrender_pose
is using.”); 類似于render_pose
,但用于 Face 關鍵點render_pose
- DEFINE_double(face_alpha_pose, 0.6, “Analogous to
but applied to face.”); 類似于alpha_pose
,但用于 Face 關鍵點alpha_pose
- DEFINE_double(face_alpha_heatmap, 0.7, “Analogous to
but applied to face.”); 類似于alpha_heatmap
,但用于 Face 關鍵點alpha_heatmap
2.13 OpenPose Rendering Hand
- DEFINE_double(hand_render_threshold, 0.2, “Analogous to
, but applied to the hand keypoints.”); 類似于render_threshold
,但用于 Hand 關鍵點render_threshold
- DEFINE_int32(hand_render, -1, “Analogous to
but applied to the hand. Extra option: -1 to use the same configuration thatrender_pose
is using.”); 類似于render_pose
,但用于 Hand 關鍵點render_pose
- DEFINE_double(hand_alpha_pose, 0.6, “Analogous to
but applied to hand.”); 類似于alpha_pose
,但用于 Hand 關鍵點****alpha_pose
- DEFINE_double(hand_alpha_heatmap, 0.7, “Analogous to
but applied to hand.”); 類似于alpha_heatmap
,但用于 Hand 關鍵點alpha_heatmap
2.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.”); 是否在 GUI 輸出圖像上寫入文本
- 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
enabled); and 1 for both 2-D and 3-D display.”); 顯示模式,-1 - 自動選擇,0 - 不顯示,2 - 2D 顯示,3 - 3D 顯示, 1 - 2D 和 3D 顯示--3d
2.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
frames. If number in the range (0,1), it will print the progress everyverbose
times the total of frames.”);verbose
2.16 Result Saving
- DEFINE_string(write_images, “”, “Directory to write rendered frames in
image format.”); 渲染圖像幀的儲存路徑write_images_format
- DEFINE_string(write_images_format, “png”, “File extension and format for
, e.g., png, jpg or bmp. Check the OpenCV function cv::imwrite for all compatible extensions.”); 渲染圖像幀的儲存格式write_images
- 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
. It internally uses cv::VideoWriter. Flag.avi
controls FPS.”); 渲染幀的寫入 JPEG video 格式的完整檔案路徑write_video_fps
- DEFINE_double(write_video_fps, -1., “Frame rate for the recorded video. By default, it will try to get the input frames producer frame rate (e.g., input video or webcam frame rate). If the input frames producer does not have a set FPS (e.g., image_dir or webcam if OpenCV not compiled with its support), set this value accordingly (e.g., to the frame rate displayed by the OpenPose GUI).”); Video 幀記錄的幀速率
- DEFINE_string(write_json, “”, “Directory to write OpenPose output in JSON format. It includes body, hand, and face pose keypoints (2-D and 3-D), as well as pose candidates (if
enabled).”); 輸出結果儲存為 JSON 格式檔案的路徑--part_candidates
- DEFINE_string(write_coco_json, “”, “Full file path to write people pose data with JSON COCO validation format.”); 以 COCO Validation 的 JSON 格式儲存 people pose 資料的完整檔案路徑
- DEFINE_string(write_coco_foot_json, “”, “Full file path to write people foot pose data with JSON COCO validation format.”); 以 COCO Validation 的 JSON 格式儲存 people foot pose 資料的完整檔案路徑
- DEFINE_int32(write_coco_json_variant, 0, “Currently, this option is experimental and only makes effect on car JSON generation. It selects the COCO variant for cocoJsonSaver.”); cocoJsonSaver 的 COCO 變形
- DEFINE_string(write_heatmaps, “”, “Directory to write body pose heatmaps in PNG format. At least 1
flag must be enabled.”); Body Pose Heatmaps 寫入為 PNG 格式的儲存路徑add_heatmaps_X
- DEFINE_string(write_heatmaps_format, “png”, “File extension and format for
, analogous towrite_heatmaps
. For lossless compression, recommendedwrite_images_format
for integerpng
andheatmaps_scale
for floating values.”); 儲存 heatmaps 結果的檔案格式float
- DEFINE_string(write_keypoint, “”, “(Deprecated, use
) Directory to write the people pose keypoint data. Set format withwrite_json
.”); **[已廢棄] **write_keypoint_format
- DEFINE_string(write_keypoint_format, “yml”, “(Deprecated, use
) File extension and format forwrite_json
: json, xml, yaml & yml. Json not available for OpenCV < 3.0, usewrite_keypoint
instead.”); [已廢棄]write_json
2.17 Result Saving - Extra Algorithms
- DEFINE_string(write_video_adam, “”, “Experimental, not available yet. E.g.,
. Flag~/Desktop/adamResult.avi
controls FPS.”);write_video_fps
- DEFINE_string(write_bvh, “”, “Experimental, not available yet. E.g.,
.”);~/Desktop/mocapResult.bvh
2.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.”);