import json, copy, ipdb, os def process(): cnt = 1228428 #1230k for i in range(64, 65): f = open('./ubody' + 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'].replace('Ubody/images', 'UBody_images').replace("ConferenceVideoSegmentation/", "").replace("YT/VideoConference", "VideoConference").replace('LifestyleVLOG/', '').replace('YT/LiveVlog_', 'LiveVlog_').replace('SoundOfPixels/', '').replace('YT/ConductMusic_', 'ConductMusic_').replace('Speech_S1/', '').replace('Speech_S2/', '').replace('Speech_S3/', '').replace('Speech_S4/', '').replace('TVShow_S1/TVShow_S1/', 'TVShow_S1/').replace('TVShow_S2/TVShow_S2/', 'TVShow_S2/').replace('TVShow_S3/TVShow_S3/', 'TVShow_S3/').replace('TVShow_S4/TVShow_S4/', 'TVShow_S4/').replace('TVShow_S5/TVShow_S5/', 'TVShow_S5/').replace('TVShow_S6/TVShow_S6/', 'TVShow_S6/').replace('TVShow_S7/TVShow_S7/', 'TVShow_S7/').replace('TVShow_S8/TVShow_S8/', 'TVShow_S8/').replace('TVShow_S9/TVShow_S9/', 'TVShow_S9/').replace('TVShow_S10/TVShow_S10/', 'TVShow_S10/').replace('TVShow_S11/TVShow_S11/', 'TVShow_S11/').replace('TVShow_S12/TVShow_S12/', 'TVShow_S12/') if not os.path.exists(cur['image']): print("不存在:", cur['image']) print(i, cnt) exit(1) cur['conversations'][0]['value'] = "Please provide the SMPL parameters of the single person in the image." root_pose = cur['conversations'][1]['root_pose'] body_pose = cur['conversations'][1]['body_pose'] shape = cur['conversations'][1]['shape'] 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/UBody-' + str(i) + '.json', 'w+') json.dump(all, g, indent=4) print("finish", i) i += 1 print(cnt) def spl(): f = open('/data7tb/gzy/PoseLLM/Data/Ubody.json', 'r') data = json.load(f) i = 4 while(i * 20000 < len(data)): cur = data[i * 20000: (i + 1) * 20000] g = open("/data7tb/gzy/PoseLLM/Data/UBody_json/ubody" + str(i + 1) + ".json", 'w') json.dump(cur, g, indent=4) print("Finish File", i + 1) i += 1 process()