Skip to content

Evaluating pck #66

@amin-asdzdh

Description

@amin-asdzdh

When evaluating the PCK using the following function:

simple-HRNet/misc/utils.py

Lines 213 to 244 in f4a8174

def evaluate_pck_accuracy(output, target, hm_type='gaussian', thr=0.5):
"""
Calculate accuracy according to PCK,
but uses ground truth heatmap rather than y,x locations
First value to be returned is average accuracy across 'idxs',
followed by individual accuracies
"""
idx = list(range(output.shape[1]))
if hm_type == 'gaussian':
pred, _ = get_max_preds(output)
target, _ = get_max_preds(target)
h = output.shape[2]
w = output.shape[3]
norm = torch.ones((pred.shape[0], 2)) * torch.tensor([h, w],
dtype=torch.float32) / 10 # Why they divide this by 10?
norm = norm.to(output.device)
else:
raise NotImplementedError
dists = calc_dists(pred, target, norm)
acc = torch.zeros(len(idx)).to(dists.device)
avg_acc = 0
cnt = 0
for i in range(len(idx)):
acc[i] = dist_acc(dists[idx[i]], thr=thr)
if acc[i] >= 0:
avg_acc = avg_acc + acc[i]
cnt += 1
avg_acc = avg_acc / cnt if cnt != 0 else torch.tensor(0)
return acc, avg_acc, cnt, pred, target

Why does the x_coordinate gets divided by the height and the y_coordinate by the width? Shouldn't it be the other way around?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions