in data/dataset.py [0:0]
def load_joint_coord(self, joint_path, hand_type, skeleton):
# create link between (joint_index in file, joint_name)
# all the codes use joint index and name of 'skeleton.txt'
db_joint_name = ['b_r_thumb_null', 'b_r_thumb3', 'b_r_thumb2', 'b_r_thumb1', 'b_r_index_null', 'b_r_index3', 'b_r_index2', 'b_r_index1', 'b_r_middle_null', 'b_r_middle3', 'b_r_middle2', 'b_r_middle1', 'b_r_ring_null', 'b_r_ring3', 'b_r_ring2', 'b_r_ring1', 'b_r_pinky_null', 'b_r_pinky3', 'b_r_pinky2', 'b_r_pinky1', 'b_r_wrist'] # joint names of 'keypointst****.pts'
# load 3D world coordinates of joints
joint_world = np.ones((len(skeleton),3),dtype=np.float32)
joint_valid = np.zeros((len(skeleton),1),dtype=np.float32)
with open(joint_path) as f:
for line in f:
parsed_line = line.split()
parsed_line = [float(x) for x in parsed_line]
joint_idx, x_world, y_world, z_world, score_sum, num_view = parsed_line
joint_idx = int(joint_idx) # joint_idx of the file
if hand_type == 'right' and joint_idx > 20: # 00: right hand, 21~41: left hand
continue
if hand_type == 'left' and joint_idx < 21: # 01: left hand, 0~20: right hand
continue
joint_name = db_joint_name[joint_idx]
joint_idx = [i for i,_ in enumerate(skeleton) if _['name'] == joint_name][0] # joint_idx which follows 'skeleton.txt'
joint_world[joint_idx] = np.array([x_world, y_world, z_world], dtype=np.float32)
joint_valid[joint_idx] = 1
return joint_world, joint_valid