-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathshow_acc.py
48 lines (32 loc) · 1.18 KB
/
show_acc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import sys
sys.path.append('../../')
import numpy as np
import matplotlib.pyplot as plt
from lib.accuracy import *
from vis.plot import *
gt_file = './experiments/itop_experiment/test_side_gt.txt'
pred_file = './experiments/itop_experiment/test_side_res.txt'
# gt_file = './experiments/msra-subject3/test_s3_gt.txt'
# pred_file = './experiments/msra-subject3/test_res.txt'
gt = np.loadtxt(gt_file)
gt = gt.reshape(gt.shape[0], -1, 3)
pred = np.loadtxt(pred_file)
pred = pred.reshape(pred.shape[0], -1, 3)
print('gt: ', gt.shape)
print('pred: ', pred.shape)
keypoints_num = 15
# keypoints_num = 21
names = ['joint'+str(i+1) for i in range(keypoints_num)]
dist, acc = compute_dist_acc_wrapper(pred, gt, max_dist=0.8, num=100)
fig, ax = plt.subplots()
plot_acc(ax, dist, acc, names)
fig.savefig('./experiments/itop_experiment/itop_side_joint_acc.png')
plt.show()
mean_err = compute_mean_err(pred, gt)
fig, ax = plt.subplots()
plot_mean_err(ax, mean_err, names)
fig.savefig('./experiments/itop_experiment/itop_side_joint_err.png')
plt.show()
print('mean_err: {}'.format(mean_err))
mean_err_all = compute_mean_err(pred.reshape((-1, 1, 3)), gt.reshape((-1, 1,3)))
print('mean_err_all: ', mean_err_all)