手部姿态估计常用评价指标(python实现)

总结了论文中常用的手部姿态估计评价指标:MPJPE/MPVPE、 AUC
并给出python 代码实现

MPJPE

计算预测关节点坐标与groundtruth关节点坐标的平均欧几里得距离
在这里插入图片描述

def mpjpe(results_pose_cam_xyz, gt_xyz ):
        avg_est_error = 0.0
        for image_id, est_pose_cam_xyz in results_pose_cam_xyz.items():
            dist = est_pose_cam_xyz - gt_xyz[image_id]  # K x 3
            avg_est_error += dist.pow(2).sum(-1).sqrt().mean()

        avg_est_error /= len(results_pose_cam_xyz)

AUC

(success-rate)
如果预测值与ground truth 之间的距离小于阈值t,认为该预测值预测成功。
AUC最大联合错误小于阈值的测试集帧的分数。
(有论文将其解释为PCK曲线下的面积,即为AUC)
在这里插入图片描述

def get_pck(data, threshold):
        """ Returns pck for one keypoint for the given threshold.
        data:joint keypoint """
        if len(self.data) == 0:
            return None

        data = np.array(data)
        pck = np.mean((data <= threshold).astype("float"))
        return pck
pck_curve = list()
            for t in thresholds:
                pck = get_pck(part_id, t)
                pck_curve.append(pck)
pck_curve = np.array(pck_curve)
auc = np.trapz(pck_curve, thresholds)

你可能感兴趣的:(python,姿态估计,python,机器学习)