原文 - https://www.aiuai.cn/aifarm449.html - AIUAI
关键点估计 - 人体关键点(姿态估计) 和服饰关键点(FashionAI/DeepFashion).
单人关键点估计,评测.
1. PCK - Percentage of Correct Keypoints
关键点正确估计的比例
计算检测的关键点与其对应的groundtruth间的归一化距离小于设定阈值的比例(the percentage of detections that fall within a normalized distance of the ground truth).
FLIC 中是以躯干直径(torso size) 作为归一化参考.
MPII 中是以头部长度(head length) 作为归一化参考,即 PCKh.
function eval_pck(pred, joints, symmetry_joint_id, joint_name, name)
% PCK 的实现
% torso height: || left_shoulder - right hip ||
% symmetry_joint_id: 具有对称关系的关键点 ID
% joint_name: 具有对称关系的关键点名字
range = 0:0.01:0.1;
show_joint_ids = (symmetry_joint_id >= 1:numel(symmetry_joint_id));
% compute distance to ground truth joints
dist = get_dist_pck(pred, joints(1:2,:,:));
% 计算 PCK
pck_all = compute_pck(dist,range);
pck = pck_all(end, :);
pck(1:end-1) = (pck(1:end-1) + pck(symmetry_joint_id))/2;
% 可视化结果
pck = [pck(show_joint_ids) pck(end)];
fprintf('------------ PCK Evaluation: %s -------------\n', name);
fprintf('Parts '); fprintf('& %s ', joint_name{:}); fprintf('& Mean\n');
fprintf('PCK '); fprintf('& %.1f ', pck); fprintf('\n');
% -------------------------------------------------------------------------
function dist = get_dist_pck(pred, gt)
assert(size(pred,1) == size(gt,1) && size(pred,2) == size(gt,2) && size(pred,3) == size(gt,3));
dist = nan(1,size(pred, 2), size(pred,3));
for imgidx = 1:size(pred,3)
% torso diameter 躯干直径
if size(gt, 2) == 14
refDist = norm(gt(:,10,imgidx) - gt(:,3,imgidx));
elseif size(gt, 2) == 10 % 10 joints FLIC
refDist = norm(gt(:,7,imgidx) - gt(:,6,imgidx));
elseif size(gt, 2) == 11 % 11 joints FLIC
refDist = norm(gt(:,4,imgidx) - gt(:,11<