按照json读取。
num_people = len(anno)
area = np.zeros((num_people, 1))
joints = np.zeros((num_people, self.num_joints_with_center, 3))
for i, obj in enumerate(anno):
joints[i, :self.num_joints, :3] = \
np.array(obj['keypoints']).reshape([-1, 3])
area[i, 0] = self.cal_area_2_torch(
torch.tensor(joints[i:i+1,:,:]))
if obj['area'] < 32**2:
joints[i, -1, 2] = 0
continue
joints_sum = np.sum(joints[i, :-1, :2], axis=0)
num_vis_joints = len(np.nonzero(joints[i, :-1, 2])[0])
if num_vis_joints <= 0:
joints[i, -1, :2] = 0
else:
joints[i, -1, :2] = joints_sum / num_vis_joints
joints[i, -1, 2] = 1