Skip to content

Commit

Permalink
[Enhance] Normalization option in 3d human pose demo and inferencer (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
LareinaM authored Jul 27, 2023
1 parent b5f79ad commit 93c5723
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
14 changes: 8 additions & 6 deletions demo/body3d_pose_lifter_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ def parse_args():
'is useful for visualization when the model do not predict the '
'global position of the 3D pose.')
parser.add_argument(
'--norm-pose-2d',
'--disable-norm-pose-2d',
action='store_true',
help='Scale the bbox (along with the 2D pose) to the average bbox '
'scale of the dataset, and move the bbox (along with the 2D pose) to '
'the average bbox center of the dataset. This is useful when bbox '
'is small, especially in multi-person scenarios.')
default=False,
help='Whether to scale the bbox (along with the 2D pose) to the '
'average bbox scale of the dataset, and move the bbox (along with the '
'2D pose) to the average bbox center of the dataset. This is useful '
'when bbox is small, especially in multi-person scenarios.')
parser.add_argument(
'--num-instances',
type=int,
Expand Down Expand Up @@ -256,11 +257,12 @@ def process_one_image(args, detector, frame, frame_idx, pose_estimator,
step=pose_lift_dataset.get('seq_step', 1))

# 2D-to-3D pose lifting
norm_pose_2d = not args.disable_norm_pose_2d
pose_lift_results = inference_pose_lifter_model(
pose_lifter,
pose_seq_2d,
image_size=visualize_frame.shape[:2],
norm_pose_2d=args.norm_pose_2d)
norm_pose_2d=norm_pose_2d)

# post-processing
for idx, pose_lift_result in enumerate(pose_lift_results):
Expand Down
2 changes: 1 addition & 1 deletion demo/docs/en/3d_human_pose_demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ${MMPOSE_CHECKPOINT_FILE_3D} \
--input ${VIDEO_PATH or IMAGE_PATH or 'webcam'} \
[--show] \
[--disable-rebase-keypoint] \
[--norm-pose-2d] \
[--disable-norm-pose-2d] \
[--num-instances ${NUM_INSTANCES}] \
[--output-root ${OUT_VIDEO_ROOT}] \
[--save-predictions] \
Expand Down
10 changes: 5 additions & 5 deletions demo/inferencer_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ def parse_args():
action='store_true',
help='Whether to use OKS as similarity in tracking')
parser.add_argument(
'--norm-pose-2d',
'--disable-norm-pose-2d',
action='store_true',
help='Scale the bbox (along with the 2D pose) to the average bbox '
'scale of the dataset, and move the bbox (along with the 2D pose) to '
'the average bbox center of the dataset. This is useful when bbox '
'is small, especially in multi-person scenarios.')
help='Whether to scale the bbox (along with the 2D pose) to the '
'average bbox scale of the dataset, and move the bbox (along with the '
'2D pose) to the average bbox center of the dataset. This is useful '
'when bbox is small, especially in multi-person scenarios.')
parser.add_argument(
'--disable-rebase-keypoint',
action='store_true',
Expand Down
2 changes: 1 addition & 1 deletion docs/en/user_guides/inference.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ The inferencer is designed for both visualization and saving predictions. The ta
| `skeleton_style` | Sets the skeleton style. Options include 'mmpose' (default) and 'openpose'. | ✔️ ||
| `use_oks_tracking` | Decides whether to use OKS as a similarity measure in tracking. || ✔️ |
| `tracking_thr` | Sets the similarity threshold for tracking. || ✔️ |
| `norm_pose_2d` | Decides whether to scale the bounding box to the dataset's average bounding box scale and relocate the bounding box to the dataset's average bounding box center. || ✔️ |
| `disable_norm_pose_2d` | Decides whether to scale the bounding box to the dataset's average bounding box scale and relocate the bounding box to the dataset's average bounding box center. || ✔️ |
| `disable_rebase_keypoint` | Decides whether to set the lowest keypoint with height 0. || ✔️ |
| `num_instances` | Sets the number of instances to visualize in the results. If set to a negative number, all detected instances will be visualized. || ✔️ |
| `return_vis` | Decides whether to include visualization images in the results. | ✔️ | ✔️ |
Expand Down
2 changes: 1 addition & 1 deletion docs/zh_cn/user_guides/inference.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ result = next(result_generator)
| `skeleton_style` | 设置骨架样式。可选项包括 'mmpose'(默认)和 'openpose'。 | ✔️ ||
| `use_oks_tracking` | 决定是否在追踪中使用OKS作为相似度测量。 || ✔️ |
| `tracking_thr` | 设置追踪的相似度阈值。 || ✔️ |
| `norm_pose_2d` | 决定是否将边界框缩放至数据集的平均边界框尺寸,并将边界框移至数据集的平均边界框中心。 || ✔️ |
| `disable_norm_pose_2d` | 决定是否将边界框缩放至数据集的平均边界框尺寸,并将边界框移至数据集的平均边界框中心。 || ✔️ |
| `disable_rebase_keypoint` | 决定是否将最低关键点的高度置为 0。 || ✔️ |
| `num_instances` | 设置可视化结果中显示的实例数量。如果设置为负数,则所有实例的结果都会可视化。 || ✔️ |
| `return_vis` | 决定是否在结果中包含可视化图像。 | ✔️ | ✔️ |
Expand Down
2 changes: 1 addition & 1 deletion mmpose/apis/inferencers/mmpose_inferencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class MMPoseInferencer(BaseMMPoseInferencer):

preprocess_kwargs: set = {
'bbox_thr', 'nms_thr', 'bboxes', 'use_oks_tracking', 'tracking_thr',
'norm_pose_2d'
'disable_norm_pose_2d'
}
forward_kwargs: set = {'disable_rebase_keypoint'}
visualize_kwargs: set = {
Expand Down
2 changes: 1 addition & 1 deletion mmpose/apis/inferencers/pose3d_inferencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Pose3DInferencer(BaseMMPoseInferencer):

preprocess_kwargs: set = {
'bbox_thr', 'nms_thr', 'bboxes', 'use_oks_tracking', 'tracking_thr',
'norm_pose_2d'
'disable_norm_pose_2d'
}
forward_kwargs: set = {'disable_rebase_keypoint'}
visualize_kwargs: set = {
Expand Down

0 comments on commit 93c5723

Please sign in to comment.