-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain_scene_generation.py
54 lines (48 loc) · 2.25 KB
/
main_scene_generation.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
50
51
52
53
54
# SGAM: Building a Virtual 3D World through Simultaneous Generation and Mapping
# Authored by Yuan Shen, Wei-Chiu Ma and Shenlong Wang
# University of Illinois at Urbana-Champaign and Massachusetts Institute of Technology
import random
from data.utils.utils import *
from sgam.inference_pipeline import InfiniteSceneGeneration
import argparse
from sgam.generative_sensing_module.model import VQModel
torch.backends.cudnn.benchmark = False
torch.backends.cudnn.enabled = False
import numpy as np
def prepare_vqgan(data):
if data == 'clevr-infinite':
config_path = 'trained_models/clevr-infinite/config.yaml'
elif data == 'google_earth':
config_path = 'trained_models/google_earth/config.yaml'
else:
raise NotImplementedError
# init and save configs
config = OmegaConf.load(config_path)
config.model.params.data_config = config.data.params
model = VQModel(**config.model['params'])
return model
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('--dataset', type=str,
default="clevr-infinite", # choose from 'google_earth, clevr-infinite'
help='an integer for the accumulator')
parser.add_argument('--use_rgbd_integration', type=bool,
default=True,
help='an integer for the accumulator')
parser.add_argument('--seed_index', type=str,
default="0",
help='seed index for initial rgbd pose')
parser.add_argument('--offscreen_rendering', type=bool,
default=True,
help='offscreen_rendering is necessary when used in colab or docker environment. ')
args = parser.parse_args()
data = args.dataset
model = prepare_vqgan(data).to('cuda:0').eval()
random.seed(10)
np.random.seed(29)
torch.random.manual_seed(3)
framework = InfiniteSceneGeneration(model, data,
seed_index=args.seed_index,
use_rgbd_integration=args.use_rgbd_integration,
offscreen_rendering=args.offscreen_rendering)
framework.scene_expansion()