PoseLLM / EgoBody_json /process.py
ZiyuG's picture
Upload folder using huggingface_hub
bb68435 verified
import json, copy, ipdb
cnt = 1052836 #1230k
for i in range(1, 19):
f = open('./egobody' + str(i) + '.json', 'r')
data = json.load(f)
all = []
for item in data:
cur = copy.deepcopy(item)
cur['id'] = str(cnt)
cur['image'] = "/data7tb/gzy/PoseLLM/Data/" + cur['image']
cur['conversations'][0]['value'] = "Please provide the SMPL parameters of the single person in the image."
root_pose = cur['conversations'][1]['root_pose'][0]
body_pose = cur['conversations'][1]['body_pose'][0]
shape = cur['conversations'][1]['shape'][0]
answer = "Sure. Here are the SMPL parameters of this person:\n"
answer += "root_pose:" + str(root_pose) + '\n'
answer += "body_pose:" + str(body_pose) + '\n'
answer += "shape:" + str(shape)
cur['conversations'][1]['value'] = answer
all.append(cur)
cnt += 1
g = open('./text/EgoBody-' + str(i) + '.json', 'w+')
json.dump(all, g, indent=4)
print("finish", i)
print(cnt)