PCK(Percentage of Correct Keypoints)指标及python代码实现
姿态估计任务中,常用的评价指标有AP值、PCK等。
PCK指标定义
PCK指标指正确检测的关键点所占百分比,其定义如下:

其中,Tk为阈值,dpi为第p个人第i个关键点预测值与ground-truth之间的欧氏距离,下面除的dp为第p个人的归一化因子。
PCK指标python实现代码如下
# 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
讯享网

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/59025.html