MCPcopy Create free account
hub / github.com/Walter0807/MotionBERT / json2pose

Function json2pose

tools/convert_insta.py:25–51  ·  view source on GitHub ↗
(json_dict)

Source from the content-addressed store, hash-verified

23 return args
24
25def json2pose(json_dict):
26 pose_h36m = np.zeros([17,3])
27 idx2key = ['Hip',
28 'R Hip',
29 'R Knee',
30 'R Ankle',
31 'L Hip',
32 'L Knee',
33 'L Ankle',
34 'Belly',
35 'Neck',
36 'Nose',
37 'Head',
38 'L Shoulder',
39 'L Elbow',
40 'L Wrist',
41 'R Shoulder',
42 'R Elbow',
43 'R Wrist',
44 ]
45 for i in range(17):
46 if idx2key[i]=='Belly' or idx2key[i]=='Head':
47 pose_h36m[i] = 0, 0, 0
48 else:
49 item = json_dict[idx2key[i]]
50 pose_h36m[i] = item['x'], item['y'], item['logits']
51 return pose_h36m
52
53def load_motion(json_path):
54 json_dict = json.load(open(json_path, 'r'))

Callers 1

load_motionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected