def check_http(files, base_dir, session, zip_file_url): files_expanded = [] for f in files: if "*" in f: f_expanded = glob.glob(os.path.join(base_dir, f), recursive=True) for fe in f_expanded: if os.path.isfile(fe): files_expanded.append(os.path.relpath(fe, start=base_dir)) else: files_expanded.append(f) # check that each file in the files-to-upload list exists on disk for fe in files_expanded: if not os.path.exists(os.path.join(base_dir, fe)): print("[HYPERSIM: DATASET_UPLOAD_SCENES_S3] WARNING (MISSING FROM DISK): " + f) # check that each file in the files-to-upload list already exists in public zip file, and # that each file in the public zip file exists in the files-to-upload list import posixpath import zipfile path_utils.add_path_to_sys_path("../../../contrib/99991", mode="relative_to_current_source_dir", frame=inspect.currentframe()) import download # e.g., https://docs-assets.developer.apple.com/ml-research/datasets/hypersim/v1/scenes/ai_001_001.zip f = download.WebFile(zip_file_url, session) z = zipfile.ZipFile(f) zip_files = [] for entry in z.infolist(): if entry.is_dir(): continue zip_files.append(entry.filename) # for each file in the files-to-upload list for f in files_expanded: if f not in zip_files: print("[HYPERSIM: DATASET_UPLOAD_SCENES_S3] WARNING (MISSING FROM PUBLIC ZIP): " + f) # for each file in the public zip file for z in zip_files: if z not in files_expanded: print("[HYPERSIM: DATASET_UPLOAD_SCENES_S3] WARNING (MISSING FROM FILES-TO-UPLOAD LIST): " + z)
parser.add_argument("--out_preview_dir", required=True) parser.add_argument("--tmp_dir", required=True) parser.add_argument("--render_pass", required=True) parser.add_argument("--denoise", action="store_true") args = parser.parse_args() assert args.render_pass == "geometry" or args.render_pass == "final" assert not (args.render_pass == "geometry" and args.denoise) if args.render_pass == "geometry": assert args.in_camera_trajectory_dir is not None assert args.in_metadata_nodes_file is not None assert args.in_metadata_scene_file is not None assert os.path.exists(args.in_camera_trajectory_dir) path_utils.add_path_to_sys_path("..", mode="relative_to_current_source_dir", frame=inspect.currentframe()) import _system_config print("[HYPERSIM: GENERATE_HDF5_FROM_VRIMG] Begin...") input_dir = os.path.dirname(args.in_vrimg_files) if input_dir == "": input_dir = "." assert os.path.exists(input_dir) if not os.path.exists(args.out_hdf5_dir): os.makedirs(args.out_hdf5_dir)
# # For licensing see accompanying LICENSE.txt file. # Copyright (C) 2020 Apple Inc. All Rights Reserved. # from pylab import * import argparse import h5py import inspect import os import pandas as pd import path_utils path_utils.add_path_to_sys_path("../lib", mode="relative_to_current_source_dir", frame=inspect.currentframe()) import octomap_utils parser = argparse.ArgumentParser() parser.add_argument("--scene_dir", required=True) args = parser.parse_args() assert os.path.exists(args.scene_dir) path_utils.add_path_to_sys_path(os.path.join(args.scene_dir, "..", ".."), mode="relative_to_cwd", frame=inspect.currentframe()) import _dataset_config print("[HYPERSIM: SCENE_GENERATE_OCTOMAP] Begin...")
def log_msg(renderer, message, level, instant): print(str(instant) + " " + str(level) + " " + message) renderer.setOnLogMessage(log_msg) renderer.load(args.in_file) time.sleep(0.5) if use_vray_user_params_dir: print( "[HYPERSIM: MODIFY_VRSCENE_ADD_CAMERA] Using user-specied rendering parameters..." ) path_utils.add_path_to_sys_path(args.vray_user_params_dir, mode="relative_to_cwd", frame=inspect.currentframe()) import _vray_user_params camera_params = _vray_user_params._set_vray_user_params(renderer) if use_camera_trajectory_dir: print( "[HYPERSIM: MODIFY_VRSCENE_ADD_CAMERA] Using user-specified camera trajectory..." ) settings_output = renderer.classes.SettingsOutput.getInstanceOrCreate() settings_output.img_file_needFrameNumber = 1 # force VRay to append the frame number to all output files settings_output.anim_start = 0 settings_output.anim_end = camera_keyframe_frame_indices[
import pandas as pd import sklearn.preprocessing import path_utils parser = argparse.ArgumentParser() parser.add_argument("--dataset_dir", required=True) parser.add_argument("--analysis_dir", required=True) parser.add_argument("--batch_name", required=True) parser.add_argument("--scene_names") args = parser.parse_args() assert os.path.exists(args.dataset_dir) path_utils.add_path_to_sys_path(args.dataset_dir, mode="relative_to_cwd", frame=inspect.currentframe()) import _dataset_config print("[HYPERSIM: DATASET_GENERATE_SCENE_LABELING_STATISTICS] Begin...") dataset_scenes_dir = os.path.join(args.dataset_dir, "scenes") if args.scene_names is not None: scenes = [ s for s in _dataset_config.scenes if fnmatch.fnmatch(s["name"], args.scene_names) ] else: scenes = _dataset_config.scenes
import sys import path_utils # # If we're using Python 2, then import the Deadline Python module as usual. If we're using # Python 3, then add the path "../third_party" (relative to this source file) to the # system path before importing Deadline. This design allows for the Hypersim Toolkit to # make use of a customized implementation of the Deadline Python module, e.g., that has # been modified to work correctly with Python 3. # if sys.version_info[0] == 2: import Deadline.DeadlineConnect else: path_utils.add_path_to_sys_path("../third_party", mode="relative_to_current_source_dir", frame=inspect.currentframe()) import Deadline.DeadlineConnect path_utils.add_path_to_sys_path("..", mode="relative_to_current_source_dir", frame=inspect.currentframe()) import _system_config assert sys.platform == "win32" parser = argparse.ArgumentParser() parser.add_argument("--dataset_dir", required=True) parser.add_argument("--scene_names") parser.add_argument("--camera_names") parser.add_argument("--render_pass", required=True) parser.add_argument("--frames", help="e.g., 0 or 0:100 or 0:100:10") parser.add_argument("--skip_post_task_script", action="store_true") parser.add_argument("--start_render_jobs_immediately", action="store_true")