【姿态估计】PCK(Percentage of Correct Keypoints)指标及代码实现

PCK(Percentage of Correct Keypoints)指标及python代码实现

姿态估计任务中,常用的评价指标有AP值、PCK等。

PCK指标定义

PCK指标指正确检测的关键点所占百分比,其定义如下:
PCK
其中,Tk为阈值,dpi为第p个人第i个关键点预测值与ground-truth之间的欧氏距离,下面除的dp为第p个人的归一化因子。

PCK指标python实现代码如下

#hanlestudy@163.com
def PCK_metric(pred, gt, thr):
    # ## params:
    # ## pred:[n, k, 2], n is the num of people, k is the number of keypoints
    # ## gt:[n, k, 2]
    # ## thr = 0.2*length_body (or thr = 0.5*length_head)
    num_imgs, num_points, _ = pred.shape
    results = np.full((num_imgs, num_points), 0, dtype=np.float32)

    for i in range(num_imgs):

        for j in range(num_points):
            distance = cal_distance(pred[i, j, :], gt[i, j, :])
            if distance <= thr:
                results[i, j] = 1

    mean_points = np.mean(results, axis=0) 
    mean_all = np.mean(mean_points) 
    return mean_points, mean_all
  • 2
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

乐乐lelele

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值