OUTPUT_FOLDER = 'comparisonVideo1' CAMERA_ORIGIN = [0, 0.8, -1.4] #will be normalized FPS = 25 FRAMES_PER_ROTATION = 100 ROTATIONS_PER_EXAMPLE = 2 FRAME_DUPLICATION = 6 BACKGROUND = [1, 1, 1] RESOLUTION = (1920, 1080) # Load models device = torch.device("cuda") models = [None] * len(MODELS) for i, m in enumerate(MODELS): p = m['path'] if p is not MODEL_INPUT and p is not MODEL_GROUND_TRUTH: models[i] = inference.LoadedModel(os.path.join(MODEL_DIR, p), device, UPSCALING) # create output folder os.makedirs(OUTPUT_FOLDER, exist_ok=True) # Render each dataset for i in range(len(DATASETS)): # create renderer camera = inference.Camera(RESOLUTION[0], RESOLUTION[0], CAMERA_ORIGIN) camera.currentDistance = DATASETS[i]['distance'] camera.currentPitch = DATASETS[i]['pitch'] camera.orientation = DATASETS[i]['orientation'] material = inference.Material(DATASETS[i]['iso']) renderer_path = RENDERER_CPU if DATASETS[i]['file'].endswith( 'vdb') else RENDERER_GPU data_dir = DATA_DIR_CPU if DATASETS[i]['file'].endswith(
renderer = inference.DirectRenderer(RENDERER) CHANNEL_DEPTH = 0 CHANNEL_NORMAL = 1 CHANNEL_AO = 2 CHANNEL_COLOR_NOAO = 3 CHANNEL_COLOR_WITHAO = 4 CHANNEL_NAMES = ["depth", "normal", "ao", "colorNoAO", "colorWithAO"] # load models models = [None] * len(MODELS) for i, m in enumerate(MODELS): p = m['path'] if p.endswith('.pth'): models[i] = inference.LoadedModel( os.path.join(MODEL_DIR, p), cpuDevice if CPU_SUPERRES else cudaDevice, UPSCALING) # LOOP OVER ALL SCENES for sceneFun in Scenes: sceneName = sceneFun.__name__ print("====================================") print(" Render", sceneName) print("====================================") # create output folder outputFolder = os.path.join(OUTPUT_FOLDER, sceneName) print("Write output to", outputFolder) os.makedirs(outputFolder, exist_ok=True) # open output files