示例#1
0
    def __init__(self, config):

        Module.__init__(self, config)
        self.randomization_level = self.config.get_float("randomization_level", 0.2)
        self.randomize_textures_only = self.config.get_float("randomize_textures_only", False)
        self.output_textures_only = self.config.get_float("output_textures_only", True)
        self.scene_materials = []
 def __init__(self, config):
     Module.__init__(self, config)
     self.source_frame = self.config.get_list("source_frame",
                                              ["X", "Y", "Z"])
     self.cam_pose_collection = ItemCollection(
         self._add_cam_pose,
         self.config.get_raw_dict("default_cam_param", {}))
示例#3
0
 def __init__(self, config):
     Module.__init__(self, config)
     self._folder_path = ""
     self._used_assets = []
     self._add_cp = {}
     self._preload = False
     self._fill_used_empty_materials = False
示例#4
0
 def __init__(self, config: Config):
     Module.__init__(self, config)
     self.emission_strength = self.config.get_float("emission_strength",
                                                    10.0)
     self.keep_using_base_color = self.config.get_bool(
         "keep_using_base_color", False)
     self.emission_color = self.config.get_vector3d("emission_color", None)
示例#5
0
    def __init__(self, config: Config):
        """
        This function is called by the Pipeline object, it initialized the object and reads all important config values

        :param config: The config object used for this module, specified by the .yaml file
        """
        Module.__init__(self, config)

        self.used_floor_area = self.config.get_float("floor_area")
        self.amount_of_extrusions = self.config.get_int(
            "amount_of_extrusions", 0)
        self.fac_from_square_room = self.config.get_float(
            "fac_base_from_square_room", 0.3)
        self.corridor_width = self.config.get_float("minimum_corridor_width",
                                                    0.9)
        self.wall_height = self.config.get_float("wall_height", 2.5)
        self.amount_of_floor_cuts = self.config.get_int(
            "amount_of_floor_cuts", 2)
        self.only_use_big_edges = self.config.get_bool("only_use_big_edges",
                                                       True)
        self.create_ceiling = self.config.get_bool("create_ceiling", True)
        self.assign_material_to_ceiling = self.config.get_bool(
            "assign_material_to_ceiling", False)
        self.tries_per_face = self.config.get_int("placement_tries_per_face",
                                                  3)
        self.amount_of_objects_per_sq_meter = self.config.get_float(
            "amount_of_objects_per_sq_meter", 3.0)
示例#6
0
 def __init__(self, config):
     Module.__init__(self, config)
     self._replace_ratio = self.config.get_float("replace_ratio", 1)
     self._copy_properties = self.config.get_float("copy_properties", 1)
     self._max_tries = self.config.get_int("max_tries", 100000)
     self._objects_to_be_replaced = []
     self._objects_to_replace_with = []
     self._ignore_collision_with = []
示例#7
0
 def __init__(self, config):
     Module.__init__(self, config)
     self.postprocessing_modules_per_output = {}
     module_configs = config.get_raw_dict("postprocessing_modules", {})
     for output_key in module_configs:
         self.postprocessing_modules_per_output[output_key] = Utility.initialize_modules(module_configs[output_key])
     self.name_to_id = {}
     self.destination_frame = self.config.get_list("destination_frame", ["X", "Y", "Z"])
示例#8
0
    def __init__(self, config):
        Module.__init__(self, config)
        self._data_path = Utility.resolve_path(
            self.config.get_string("data_path"))

        self._img_files = glob.glob(os.path.join(self._data_path, "*.jpg"))
        self._num_used = self.config.get_int("num_used", 10)
        self._add_cp = self.config.get_raw_dict("add_custom_properties", {})
 def __init__(self, config):
     Module.__init__(self, config)
     self.object_stopped_location_threshold = self.config.get_float(
         "object_stopped_location_threshold", 0.01)
     self.object_stopped_rotation_threshold = self.config.get_float(
         "object_stopped_rotation_threshold", 0.1)
     self.collision_margin = self.config.get_float("collision_margin",
                                                   0.001)
    def __init__(self, config):
        Module.__init__(self, config)

        object_pose_sampler_config = config.get_raw_dict("object_pose_sampler", {})
        camera_pose_sampler_config = config.get_raw_dict("camera_pose_sampler", {})

        self._object_pose_sampler = Utility.initialize_modules([object_pose_sampler_config], {})[0]
        self._camera_pose_sampler = Utility.initialize_modules([camera_pose_sampler_config], {})[0]
示例#11
0
    def __init__(self, config):
        Module.__init__(self, config)

        self.postprocessing_modules_per_output = {}
        module_configs = config.get_raw_dict("postprocessing_modules", {})
        for output_key in module_configs:
            self.postprocessing_modules_per_output[
                output_key] = Utility.initialize_modules(
                    module_configs[output_key], {})
示例#12
0
 def __init__(self, config):
     Module.__init__(self, config)
     self._folder_path = ""
     self._used_assets = []
     self._add_cp = {}
     self._preload = False
     self._fill_used_empty_materials = False
     # makes the integration of complex materials easier
     addon_utils.enable("node_wrangler")
示例#13
0
 def __init__(self, config):
     Module.__init__(self, config)
     self._avoid_rendering = config.get_bool("avoid_rendering", False)
     self.postprocessing_modules_per_output = {}
     module_configs = config.get_raw_dict("postprocessing_modules", {})
     for output_key in module_configs:
         self.postprocessing_modules_per_output[
             output_key] = Utility.initialize_modules(
                 module_configs[output_key])
示例#14
0
    def __init__(self, config):
        Module.__init__(self, config)

        # setting up the GlobalStorage
        global_config = Config(self.config.get_raw_dict("global", {}))
        GlobalStorage.init_global(global_config)

        # call the init again to make sure all values from the global config where read correctly, too
        self._default_init()
 def __init__(self, config):
     Module.__init__(self, config)
     self.object_stopped_location_threshold = self.config.get_float("object_stopped_location_threshold", 0.01)
     self.object_stopped_rotation_threshold = self.config.get_float("object_stopped_rotation_threshold", 0.1)
     self.collision_margin = self.config.get_float("collision_margin", 0.001)
     self.collision_mesh_source = self.config.get_string('collision_mesh_source', 'FINAL')
     self.steps_per_sec = self.config.get_int("steps_per_sec", 60)
     self.solver_iters = self.config.get_int("solver_iters", 10)
     self.mass_scaling = self.config.get_bool("mass_scaling", False)
     self.mass_factor = self.config.get_float("mass_factor", 1)
示例#16
0
    def __init__(self, config):
        Module.__init__(self, config, False)

        camera_runner_config = config.get_raw_dict("camera_runner", {})

        object_runners_config = config.get_list("object_runners", [])
        light_runners_config = config.get_list("light_runners", [])

        self._camera_runner = Utility.initialize_modules([camera_runner_config], {})[0]
        self._object_runners = Utility.initialize_modules(object_runners_config, {})
        self._light_runners = Utility.initialize_modules(light_runners_config, {})
示例#17
0
    def __init__(self, config):
        Module.__init__(self, config)

        self.up_direction = config.get_vector3d(
            "up_direction", mathutils.Vector([0., 0., 1.])).normalized()

        self.min_distance = config.get_float("min_distance", 0.25)
        self.max_distance = config.get_float("max_distance", 0.6)

        self.placed_objects = []
        self.surface = None
        self.surface_height = None
示例#18
0
    def __init__(self, config):
        Module.__init__(self, config)

        # Clean up example scene or scene created by last run when debugging pipeline inside blender
        Initializer.cleanup()

        # setting up the GlobalStorage
        global_config = Config(self.config.get_raw_dict("global", {}))
        GlobalStorage.init_global(global_config)

        # call the init again to make sure all values from the global config where read correctly, too
        self._default_init()
示例#19
0
 def __init__(self, config):
     Module.__init__(self, config)
     self.collision_margin = self.config.get_float("collision_margin", 0.001)
     self.collision_mesh_source = self.config.get_string('collision_mesh_source', 'FINAL')
     if config.has_param("steps_per_sec"):
         raise Exception("You are using the outdated parameter steps_per_sec. Please update your config by switching to substeps_per_frame (was changed in blender 2.91).")
     self.mass_scaling = self.config.get_bool("mass_scaling", False)
     self.mass_factor = self.config.get_float("mass_factor", 1)
     self.collision_shape = self.config.get_string("collision_shape", "CONVEX_HULL")
     self.friction = self.config.get_float("friction", 0.5)
     self.angular_damping = self.config.get_float("angular_damping", 0.1)
     self.linear_damping = self.config.get_float("linear_damping", 0.04)
     self.convex_decomposition_cache_path = self.config.get_string("convex_decomposition_cache_path", "resources/decomposition_cache")
示例#20
0
    def __init__(self, config):
        Module.__init__(self, config)

        self._avoid_rendering = config.get_bool("avoid_rendering", False)
        self.rgb_output_key = self.config.get_string("rgb_output_key",
                                                     "colors")
        self.segmap_output_key = self.config.get_string(
            "segmap_output_key", "segmap")
        self.segcolormap_output_key = self.config.get_string(
            "segcolormap_output_key", "segcolormap")
        self._coco_data_dir = os.path.join(self._determine_output_dir(False),
                                           'coco_data')
        if not os.path.exists(self._coco_data_dir):
            os.makedirs(self._coco_data_dir)
示例#21
0
 def __init__(self, config):
     Module.__init__(self, config)
     self.object_stopped_location_threshold = self.config.get_float("object_stopped_location_threshold", 0.01)
     self.object_stopped_rotation_threshold = self.config.get_float("object_stopped_rotation_threshold", 0.1)
     self.collision_margin = self.config.get_float("collision_margin", 0.001)
     self.collision_mesh_source = self.config.get_string('collision_mesh_source', 'FINAL')
     if config.has_param("steps_per_sec"):
         raise Exception("You are using the outdated parameter steps_per_sec. Please update your config by switching to substeps_per_frame (was changed in blender 2.91).")
     self.substeps_per_frame = self.config.get_int("substeps_per_frame", 10)
     self.solver_iters = self.config.get_int("solver_iters", 10)
     self.mass_scaling = self.config.get_bool("mass_scaling", False)
     self.mass_factor = self.config.get_float("mass_factor", 1)
     self.collision_shape = self.config.get_string("collision_shape", "CONVEX_HULL")
     self.friction = self.config.get_float("friction", 0.5)
     self.angular_damping = self.config.get_float("angular_damping",0.1)
     self.linear_damping = self.config.get_float("linear_damping",0.04)
    def __init__(self, config):

        Module.__init__(self, config)
        self.randomization_level = self.config.get_float(
            "randomization_level", 0.2)
        self.randomize_textures_only = self.config.get_bool(
            "randomize_textures_only", False)
        self.output_textures_only = self.config.get_bool(
            "output_textures_only", True)
        self._objects_to_manipulate = None
        if self.config.has_param('manipulated_objects'):
            self._objects_to_manipulate = self.config.get_list(
                'manipulated_objects')
        self._objects_to_extract_materials_from = None
        if self.config.has_param('objects_to_extract_mat'):
            self._objects_to_extract_materials_from = self.config.get_list(
                'objects_to_extract_mat')
        self.scene_materials = []
示例#23
0
 def __init__(self, config):
     Module.__init__(self, config)
     self.object_stopped_location_threshold = self.config.get_float(
         "object_stopped_location_threshold", 0.01)
     self.object_stopped_rotation_threshold = self.config.get_float(
         "object_stopped_rotation_threshold", 0.1)
     self.collision_margin = self.config.get_float("collision_margin",
                                                   0.001)
     self.collision_mesh_source = self.config.get_string(
         'collision_mesh_source', 'FINAL')
     self.steps_per_sec = self.config.get_int("steps_per_sec", 60)
     self.solver_iters = self.config.get_int("solver_iters", 10)
     self.mass_scaling = self.config.get_bool("mass_scaling", False)
     self.mass_factor = self.config.get_float("mass_factor", 1)
     self.collision_shape = self.config.get_string("collision_shape",
                                                   "CONVEX_HULL")
     self.friction = self.config.get_float("friction", 0.5)
     self.angular_damping = self.config.get_float("angular_damping", 0.1)
     self.linear_damping = self.config.get_float("linear_damping", 0.04)
示例#24
0
    def __init__(self, config):
        Module.__init__(self, config)

        # Read in lights
        self.lights = {}
        # File format: <obj id> <number of lightbulb materials> <lightbulb material names> <number of lampshade materials> <lampshade material names>
        with open(
                Utility.resolve_path(
                    os.path.join('resources', "suncg",
                                 "light_geometry_compact.txt"))) as f:
            lines = f.readlines()
            for row in lines:
                row = row.strip().split()
                self.lights[row[0]] = [[], []]

                index = 1

                # Read in lightbulb materials
                number = int(row[index])
                index += 1
                for i in range(number):
                    self.lights[row[0]][0].append(row[index])
                    index += 1

                # Read in lampshade materials
                number = int(row[index])
                index += 1
                for i in range(number):
                    self.lights[row[0]][1].append(row[index])
                    index += 1

        # Read in windows
        self.windows = []
        with open(
                Utility.resolve_path(
                    os.path.join('resources', 'suncg',
                                 'ModelCategoryMapping.csv')), 'r') as csvfile:
            reader = csv.DictReader(csvfile)
            for row in reader:
                if row["coarse_grained_class"] == "window":
                    self.windows.append(row["model_id"])
        self._collection_of_mats = {"lamp": {}, "window": {}, "ceiling": {}}
示例#25
0
 def __init__(self, config):
     Module.__init__(self, config)
示例#26
0
 def __init__(self, config):
     Module.__init__(self, config)
     self._avoid_rendering = config.get_bool("avoid_rendering", False)
     addon_utils.enable("render_auto_tile_size")
示例#27
0
 def __init__(self, config):
     Module.__init__(self, config)
     self.cross_source_settings = self.config.get_raw_dict(
         "cross_source_settings", {})
     self.light_source_collection = ItemCollection(
         self._add_light_source, self.cross_source_settings)
示例#28
0
 def __init__(self, config):
     Module.__init__(self, config)
     addon_utils.enable("render_auto_tile_size")
示例#29
0
 def __init__(self, config):
     Module.__init__(self, config)
     self.source_frame = self.config.get_list("source_frame",
                                              ["X", "Y", "Z"])
示例#30
0
 def __init__(self, config):
     Module.__init__(self, config)
     for sys_path in self.config.get_list("sys_paths"):
         if 'bop_toolkit' in sys_path:
             sys.path.append(sys_path)