栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

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

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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

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

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

PCK指标定义

PCK指标指正确检测的关键点所占百分比,其定义如下:

其中,Tk为阈值,dpi为第p个人第i个关键点预测值与ground-truth之间的欧氏距离,下面除的dp为第p个人的归一化因子。

PCK指标python实现代码如下
#hanlestudy@163.com
def PCK_metric(pred, gt, thr):

    num_imgs, num_points, _ = pred.shape
    results = np.full((num_imgs, num_points), 0, dtype=np.float32)
    thrs = []

    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

    thrs = np.array(thrs)
    print('mean:', np.mean(thrs))

    mean_points = np.mean(results, axis=0) 
    mean_all = np.mean(mean_points)

    return mean_points, mean_all```

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/987138.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号