使用OpenPose进行姿态估计

文章内容逐步补充中…

一 通过Demo快速开始

1.1 Video

# Ubuntu
./build/examples/openpose/openpose.bin --video examples/media/video.avi
# 多 GPUs,如采用两块 GPUs,GPUs 1 和 2,跳过 GPUs 0.
./build/examples/openpose/openpose.bin --video examples/media/video.avi --num_gpu 2 --num_gpu_start 1

1.2 Images

# Ubuntu
./build/examples/openpose/openpose.bin --image_dir examples/media/

二 输出格式

Output 保存格式
OpenPose 有两种可选的输出保存方式:

  1. 采用 write_json flag 将人体姿态数据结果保存为 JSON writer 格式.
    如:
# Only body
./build/examples/openpose/openpose.bin 
			--video examples/media/video.avi 
			--write_json output/ 
			--display 0 
			--render_pose 0
# Body + face + hands
./build/examples/openpose/openpose.bin 
			--video examples/media/video.avi 
			--write_video output/result.avi
			--write_json output/ 
			--display 0
            --render_pose 0 
            --face 
            --hand

每个 JSON 文件包含 objects 的people 数组(array),其中,每个 object:

  • 数组pose_keypoints_2d 包含了人体 Body part 位置和检测的置信度(confidence),其格式为:x1,y1,c1,x2,y2,c2,.... 坐标 xy 被归一化到 [0, 1], [-1, 1], [0, source size], [0, output size] 等范围,其取决于 keypoint_scale flag. c 是范围在 [0, 1] 的置信度分数(confidence score).
  • 数组 face_keypoints_2d, hand_left_keypoints_2dhand_right_keypoints_2d, 类似于pose_keypoints_2d.
  • 如果--3d 开启(enabled),数组body_keypoints_3d, face_keypoints_3d, hand_left_keypoints_2d, 和 hand_right_keypoints_2d 是类似形式;否则是空. 其格式为 x1,y1,z1,c1,x2,y2,z2,c2,.... 其中,c 值为 0 或 1,取决于 3D reconstruction 是否成功.
  • 如果 --part_candidates 开启(enabled),则 The body part candidates before being assembled into people.
{
    "version":1.1,
    "people":[
        {
            "pose_keypoints_2d":[582.349,507.866,0.845918,746.975,631.307,0.587007,...],
            "face_keypoints_2d":[468.725,715.636,0.189116,554.963,652.863,0.665039,...],
            "hand_left_keypoints_2d":[746.975,631.307,0.587007,615.659,617.567,0.377899,...],
            "hand_right_keypoints_2d":[617.581,472.65,0.797508,0,0,0,723.431,462.783,0.88765,...]
            "pose_keypoints_3d":[582.349,507.866,507.866,0.845918,507.866,746.975,631.307,0.587007,...],
            "face_keypoints_3d":[468.725,715.636,715.636,0.189116,715.636,554.963,652.863,0.665039,...],
            "hand_left_keypoints_3d":[746.975,631.307,631.307,0.587007,631.307,615.659,617.567,0.377899,...],
            "hand_right_keypoints_3d":[617.581,472.65,472.65,0.797508,472.65,0,0,0,723.431,462.783,0.88765,...]
        }
    ],
    // If `--part_candidates` enabled
    "part_candidates":[
        {
            "0":[296.994,258.976,0.845918,238.996,365.027,0.189116],
            "1":[381.024,321.984,0.587007],
            "2":[313.996,314.97,0.377899],
            "3":[238.996,365.027,0.189116],
            "4":[283.015,332.986,0.665039],
            "5":[457.987,324.003,0.430488,283.015,332.986,0.665039],
            "6":[],
            "7":[],
            "8":[],
            "9":[],
            "10":[],
            "11":[],
            "12":[],
            "13":[],
            "14":[293.001,242.991,0.674305],
            "15":[314.978,241,0.797508],
            "16":[],
            "17":[369.007,235.964,0.88765]
        }
    ]
}

采用poseParameters.hpp 中的 getPoseBodyPartMapping(const PoseModel poseModel)函数,基于 C++ API 可以提取任何 Body 模型(如 COCO, MPI) 的 Body Part 映射次序。

// C++ API call
#include <openpose/pose/poseParameters.hpp>
const auto& poseBodyPartMappingBody25 = getPoseBodyPartMapping(PoseModel::BODY_25);
const auto& poseBodyPartMappingCoco = getPoseBodyPartMapping(PoseModel::COCO_18);
const auto& poseBodyPartMappingMpi = getPoseBodyPartMapping(PoseModel::MPI_15);

// Result for BODY_25 (25 body parts consisting of COCO + foot)
// const std::map<unsigned int, std::string> POSE_BODY_25_BODY_PARTS {
//     {0,  "Nose"},
//     {1,  "Neck"},
//     {2,  "RShoulder"},
//     {3,  "RElbow"},
//     {4,  "RWrist"},
//     {5,  "LShoulder"},
//     {6,  "LElbow"},
//     {7,  "LWrist"},
//     {8,  "MidHip"},
//     {9,  "RHip"},
//     {10, "RKnee"},
//     {11, "RAnkle"},
//     {12, "LHip"},
//     {13, "LKnee"},
//     {14, "LAnkle"},
//     {15, "REye"},
//     {16, "LEye"},
//     {17, "REar"},
//     {18, "LEar"},
//     {19, "LBigToe"},
//     {20, "LSmallToe"},
//     {21, "LHeel"},
//     {22, "RBigToe"},
//     {23, "RSmallToe"},
//     {24, "RHeel"},
//     {25, "Background"}
// };
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值