-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_synthetic_ishape.py
38 lines (30 loc) · 1.18 KB
/
build_synthetic_ishape.py
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
#!/usr/bin/env python3
import os
import sys
import time
import boxx
all_synthetic_dataset_names = ["branch", "fence", "hanger", "log", "wire"]
def build_one_dataset(name):
boxx.pred(f"Build dataset: {name}")
cmd = f"blender --background --python {name}.py --\
DIR ../synthetic_ishape_dataset/{name}/train/ IMG_NUM {2000}"
print(cmd)
os.system(cmd)
time.sleep(1)
cmd = f"blender --background --python {name}.py --\
DIR ../synthetic_ishape_dataset/{name}/val/ IMG_NUM {500}"
print(cmd)
os.system(cmd)
if __name__ == "__main__":
synthetic_dataset_names = all_synthetic_dataset_names.copy()
if len(sys.argv) > 1:
synthetic_dataset_names = sys.argv[1:]
for name in synthetic_dataset_names:
if name.isdigit():
name = all_synthetic_dataset_names[int(name)]
assert (
name in all_synthetic_dataset_names
), f'"{name}" not in {all_synthetic_dataset_names}'
build_one_dataset(name)
# If build on brainpp
# python -m boxx.script 'p/mapmt(lambda i:os.system(f"rlaunch -P 102 --preemptible=best-effort --cpu=2 --memory=20000 -- python build_synthetic_ishape.py {i} ") ,range(5), pool=6)'