File size: 2,616 Bytes
87a45a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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()