MCPcopy Create free account
hub / github.com/InternRobotics/G2VLM / main

Function main

data/preprocessing/process_tartanair.py:12–42  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

10import decimal
11
12def main(args):
13 data_root = "path to :s3://TartanAir/"
14 conf_path = '~/petreloss.conf'
15 client = Client(conf_path)
16
17 sequences = []
18 for seq in list(client.list(data_root)):
19 names = client.list(os.path.join(data_root, seq, seq, 'Easy'))
20 seq_ = [(seq, 'Easy', name) for name in names]
21 sequences.extend(seq_)
22 names = client.list(os.path.join(data_root, seq, seq, 'Hard'))
23 seq_ = [(seq, 'Hard', name) for name in names]
24 sequences.extend(seq_)
25
26 out_data = []
27 for seq in tqdm(list(sequences)):
28 rgb_dir = os.path.join(data_root, seq[0], seq[0], seq[1], seq[2], 'image_left')
29 num_imgs = len(list(client.list(rgb_dir)))
30
31 cur_dict = {
32 'seq_name': seq,
33 'scene_name': 'tartanair',
34 'num_images': num_imgs }
35 out_data.append(cur_dict)
36
37 print(f"{len(out_data)} valid sequences processed...")
38 os.makedirs(args.output_dir, exist_ok=True)
39
40 with open(os.path.join(args.output_dir, f"tartanair_recon_ann.jsonl"), 'w') as f:
41 for item in out_data:
42 f.write(json.dumps(item) + '\n')
43
44
45if __name__ == "__main__":

Callers 1

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected