-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
49 lines (39 loc) · 1.32 KB
/
run.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
39
40
41
42
43
44
45
46
47
48
49
import numpy as np
from blenderset.utils.log import configure_logging
import datetime
import os
import random
from pathlib import Path
from random import randint
from socket import gethostname
import bpy
from blenderset.render import PreviewRenderer, Renderer
from blenderset.scenarios import (
Nyhamnen,
RealHighway,
ProjectiveSyntheticPedestrians,
)
def main():
# root = Path('renders/nyhamnen')
# root = Path("renders/real_highway")
root = Path("renders/ProjectiveSyntheticPedestrians")
# renderer = PreviewRenderer(bpy.context, root)
renderer = Renderer(bpy.context, root)
run_start = datetime.datetime.now()
run_name = os.environ.get(
"BLENDERSET_RUN_NAME", run_start.strftime("%Y%m%d_%H%M%S") + "_" + gethostname()
)
random.seed(run_name)
np.random.seed(random.randrange(0, 2 ** 32))
for scene_num in range(1000):
bpy.ops.wm.open_mainfile(filepath="blank.blend")
gen = Nyhamnen(bpy.context, randint(20, 200), test_set=True)
# gen = RealHighway(bpy.context, randint(20, 30))
gen = ProjectiveSyntheticPedestrians(bpy.context)
gen.create()
for perm_num in range(10):
renderer.render(gen, f"{run_name}_{scene_num:03}_{perm_num:03}")
gen.update()
if __name__ == "__main__":
configure_logging()
main()