Example #1
0
    def __init__(self, config):
        LoaderInterface.__init__(self, config)

        self._data_path = Utility.resolve_path(self.config.get_string("data_path", "resources/pix3d"))
        self._used_category = self.config.get_string("used_category")

        self._files_with_fitting_category = Pix3DLoader.get_files_with_category(self._used_category, self._data_path)
Example #2
0
    def __init__(self, config):
        LoaderInterface.__init__(self, config)

        self._file_path = Utility.resolve_path(
            self.config.get_string("file_path"))

        self._texture_folder = Utility.resolve_path(
            self.config.get_string("texture_folder"))

        # the default unknown texture folder is not included inside of the scenenet texture folder
        default_unknown_texture_folder = os.path.join(self._texture_folder,
                                                      "unknown")
        # the textures in this folder are used, if the object has no available texture
        self._unknown_texture_folder = Utility.resolve_path(
            self.config.get_string("unknown_texture_folder",
                                   default_unknown_texture_folder))

        LabelIdMapping.assign_mapping(
            Utility.resolve_path(
                os.path.join('resources', 'id_mappings', 'nyu_idset.csv')))

        if LabelIdMapping.label_id_map:
            bpy.context.scene.world[
                "category_id"] = LabelIdMapping.label_id_map["void"]
        else:
            print(
                "Warning: The category labeling file could not be found -> no semantic segmentation available!"
            )
 def __init__(self, config):
     LoaderInterface.__init__(self, config)
     self.house_path = Utility.resolve_path(self.config.get_string("path"))
     suncg_folder_path = os.path.join(os.path.dirname(self.house_path),
                                      "../..")
     self.suncg_dir = self.config.get_string("suncg_path",
                                             suncg_folder_path)
    def __init__(self, config):
        LoaderInterface.__init__(self, config)

        self._shapenet_path = Utility.resolve_path(
            self.config.get_string("shapenet_path", SHAPNET_PATH))
        self._num_objects = self.config.get_int("num_objects", 3)
        self._output_dir = Utility.resolve_path(
            self.config.get_string("output_dir"))

        self._objects_used = json.load(
            open(Utility.resolve_path(SHAPENET_OBJECTS_JSON_PATH), 'r'))
        self._tables_used = json.load(
            open(Utility.resolve_path(SHAPENET_TABLES_JSON_PATH), 'r'))
        self._taxonomy = json.load(
            open(Utility.resolve_path(TAXNOMY_FILE_PATH), 'r'))

        self._files_used = []
        for synset_name, obj_ids in self._objects_used.items():
            synset_id = next(tax['synsetId'] for tax in self._taxonomy
                             if tax['name'] == synset_name)
            for obj_id in obj_ids:
                self._files_used.append({
                    "shapenet_synset_id": synset_id,
                    "shapenet_obj_id": obj_id,
                    "shapenet_synset_name": synset_name
                })

        self._cctexture_path = Utility.resolve_path(
            self.config.get_string("cctexture_path", CCTEXTURE_PATH))
        self._cc_assets = [
            f.split("/")[-1]
            for f in glob.glob(os.path.join(self._cctexture_path, "*"))
        ]
Example #5
0
    def __init__(self, config):
        LoaderInterface.__init__(self, config)
        sys_paths = self.config.get_list("sys_paths")
        for sys_path in sys_paths:
            if 'bop_toolkit' in sys_path:
                sys.path.append(sys_path)

        self.sample_objects = self.config.get_bool("sample_objects", False)
        if self.sample_objects:
            self.num_of_objs_to_sample = self.config.get_int(
                "num_of_objs_to_sample")
            self.obj_instances_limit = self.config.get_int(
                "obj_instances_limit", -1)

        self.cam_type = self.config.get_string("cam_type", "")
        self.source_frame = self.config.get_list("source_frame",
                                                 ["X", "-Y", "-Z"])
        self.bop_dataset_path = self.config.get_string("bop_dataset_path")
        self.scene_id = self.config.get_int("scene_id", -1)
        self.obj_ids = self.config.get_list("obj_ids", [])
        if self.obj_ids or self.sample_objects:
            self.allow_duplication = True
        else:
            self.allow_duplication = False
        self.split = self.config.get_string("split", "test")
        self.model_type = self.config.get_string("model_type", "")
        self.scale = 0.001 if self.config.get_bool("mm2m", False) else 1
        self.bop_dataset_name = os.path.basename(self.bop_dataset_path)
        self._has_external_texture = self.bop_dataset_name in ["ycbv", "ruapc"]
Example #6
0
    def __init__(self, config):
        LoaderInterface.__init__(self, config)

        self._data_path = Utility.resolve_path(self.config.get_string("data_path"))
        self._used_synset_id = self.config.get_string("used_synset_id")
        self._used_source_id = self.config.get_string("used_source_id", "")        
        taxonomy_file_path = os.path.join(self._data_path, "taxonomy.json")
        self._files_with_fitting_synset = ShapeNetLoader.get_files_with_synset(self._used_synset_id, self._used_source_id, 
                                                                               taxonomy_file_path, self._data_path)
Example #7
0
 def __init__(self, config):
     LoaderInterface.__init__(self, config)
     self.house_path = Utility.resolve_path(self.config.get_string("path"))
     suncg_folder_path = os.path.join(os.path.dirname(self.house_path), "../..")
     self.suncg_dir = self.config.get_string("suncg_path", suncg_folder_path)
     self._collection_of_loaded_objs = {}
     # there are only two types of materials, textures and diffuse
     self._collection_of_loaded_mats = {"texture": {}, "diffuse": {}}
     LabelIdMapping.assign_mapping(Utility.resolve_path(os.path.join('resources', 'id_mappings', 
         'nyu_idset.csv')))
Example #8
0
    def __init__(self, config: Config):
        LoaderInterface.__init__(self, config)

        self.mapping_file = Utility.resolve_path(
            self.config.get_string(
                "mapping_file",
                os.path.join("resources", "front_3D", "3D_front_mapping.csv")))
        if not os.path.exists(self.mapping_file):
            raise Exception("The mapping file could not be found: {}".format(
                self.mapping_file))
Example #9
0
    def __init__(self, config):
        LoaderInterface.__init__(self, config)
        self.house_path = Utility.resolve_path(self.config.get_string("path"))
        suncg_folder_path = os.path.join(os.path.dirname(self.house_path),
                                         "../..")
        self.suncg_dir = self.config.get_string("suncg_path",
                                                suncg_folder_path)

        LabelIdMapping.assign_mapping(
            Utility.resolve_path(
                os.path.join('resources', 'id_mappings', 'nyu_idset.csv')))
    def __init__(self, config):
        LoaderInterface.__init__(self, config)
        self.data_path = self.config.get_string("data_path", os.path.join("resources", "haven"))

        if os.path.exists(self.data_path):
            self.data_path = os.path.join(self.data_path, "hdris")
            if not os.path.exists(self.data_path):
                raise Exception("The folder: {} does not contain a folder name hdfris. Please use the "
                                "download script.".format(self.data_path))
        else:
            raise Exception("The data path does not exists: {}".format(self.data_path))
Example #11
0
    def __init__(self, config):
        LoaderInterface.__init__(self, config)

        self._data_dir = Utility.resolve_path(
            self.config.get_string("data_dir",
                                   os.path.join("resources", "IKEA")))

        self._obj_dict = dict()
        self._generate_object_dict()

        self._obj_type = self.config.get_raw_value("obj_type", None)
        self._obj_style = self.config.get_raw_value("obj_style", None)
Example #12
0
 def __init__(self, config):
     LoaderInterface.__init__(self, config)
     # supported pairs of {ID type/section names: datablock parameter names}
     self.known_datablock_names = {
         "/Camera": "cameras",
         "/Collection": "collections",
         "/Image": "images",
         "/Light": "lights",
         "/Material": "materials",
         "/Mesh": "meshes",
         "/Object": "objects",
         "/Texture": "textures"
     }
Example #13
0
    def __init__(self, config):
        LoaderInterface.__init__(self, config)

        self._bigbird_path = Utility.resolve_path(
            self.config.get_string("bigbird_path"))
        self._num_objects = self.config.get_int("num_objects", 3)

        self._obj_name2id = {}
        self._obj_id2name = {}
        for i, n in enumerate(OBJECT_NAMES):
            self._obj_name2id[n] = i
            self._obj_id2name[i] = n

        self._obj_ids = list(self._obj_id2name.keys())
    def __init__(self, config):
        LoaderInterface.__init__(self, config)

        self._shapenet_path = Utility.resolve_path(
            self.config.get_string("shapenet_path", SHAPNET_PATH))
        self._mscoco_path = Utility.resolve_path(
            self.config.get_string("mscoco_path", MSCOCO_PATH))
        self._obj_list_path = Utility.resolve_path(
            self.config.get_string("obj_list_path", OBJ_LIST_PATH))

        self._num_objects = self.config.get_int("num_objects", 3)

        with open(self._obj_list_path) as f:
            self._obj_list = json.load(f)
Example #15
0
    def __init__(self, config):
        LoaderInterface.__init__(self, config)

        self._data_dir = Utility.resolve_path(
            self.config.get_string("data_dir",
                                   os.path.join("resources", "IKEA")))

        if self.config.has_param("category"):
            self._obj_categories = self.config.get_raw_value("category", None)
            if not isinstance(self._obj_categories, list):
                self._obj_categories = [self._obj_categories]
        else:
            self._obj_categories = None

        self._obj_style = self.config.get_raw_value("style", None)
Example #16
0
    def __init__(self, config):
        LoaderInterface.__init__(self, config)

        self._file_path = Utility.resolve_path(
            self.config.get_string("file_path"))

        self._texture_folder = Utility.resolve_path(
            self.config.get_string("texture_folder"))

        # the default unknown texture folder is not included inside of the scenenet texture folder
        default_unknown_texture_folder = os.path.join(self._texture_folder,
                                                      "unknown")
        # the textures in this folder are used, if the object has no available texture
        self._unknown_texture_folder = Utility.resolve_path(
            self.config.get_string("unknown_texture_folder",
                                   default_unknown_texture_folder))
 def __init__(self, config):
     LoaderInterface.__init__(self, config)
     self._data_path = Utility.resolve_path(
         self.config.get_string("data_path",
                                os.path.join("resources", "AMASS")))
     # Body Model Specs
     self._used_body_model_gender = self.config.get_string(
         "body_model_gender", random.choice(["male", "female", "neutral"]))
     # These numbers are based on a recommendation from the authors. refer to visualization tutorial from the
     # authors: https://github.com/nghorbani/amass/blob/master/notebooks/01-AMASS_Visualization.ipynb
     self._num_betas = 10  # number of body parameters
     self._num_dmpls = 8  # number of DMPL parameters
     # Pose Specs
     self._used_sub_dataset_id = self.config.get_string("sub_dataset_id")
     self._used_subject_id = self.config.get_string("subject_id", "")
     self._used_sequence_id = self.config.get_int("sequence_id", -1)
     self._used_frame_id = self.config.get_int("frame_id", -1)
Example #18
0
    def __init__(self, config: Config):
        LoaderInterface.__init__(self, config)
        self.json_path = Utility.resolve_path(
            self.config.get_string("json_path"))
        self.future_model_path = Utility.resolve_path(
            self.config.get_string("3D_future_model_path"))

        self.mapping_file = Utility.resolve_path(
            self.config.get_string(
                "mapping_file",
                os.path.join("resources", "front_3D", "3D_front_mapping.csv")))
        if not os.path.exists(self.mapping_file):
            raise Exception("The mapping file could not be found: {}".format(
                self.mapping_file))
        _, self.mapping = LabelIdMapping.read_csv_mapping(self.mapping_file)
        # a list of all newly created objects
        self.created_objects = []
Example #19
0
 def __init__(self, config):
     LoaderInterface.__init__(self, config)
     self._data_path = Utility.resolve_path(
         self.config.get_string("data_path",
                                os.path.join("resources", "AMASS")))
     # Body Model Specs
     self._used_body_model_gender = self.config.get_string(
         "body_model_gender")
     # These numbers are based on a recommendation from the authors. refer to visualization tutorial from the authors: https://github.com/nghorbani/amass/blob/master/notebooks/01-AMASS_Visualization.ipynb
     self._num_betas = 10  # number of body parameters
     self._num_dmpls = 8  # number of DMPL parameters
     # Pose Specs
     self._used_sub_dataset_id = self.config.get_string("sub_dataset_id")
     self._used_subject_id = self.config.get_string("subject_id")
     self._used_sequence_id = self.config.get_string("sequence_id")
     self._used_frame_id = self.config.get_string("frame_id", "")
     # Get the currently supported mocap datasets by this loader
     taxonomy_file_path = os.path.join(self._data_path, "taxonomy.json")
     AMASSLoader._get_supported_mocap_datasets(taxonomy_file_path,
                                               self._data_path)
Example #20
0
    def __init__(self, config):
        LoaderInterface.__init__(self, config)

        self.bop_dataset_name = "OCRTOC"

        with open(self.config.get_string('camera_config_path')) as f:
            self.camera_info = json.load(
                f)  # keys: cx, cy, fx, fy, depth_scale, height, width

        self.sample_objects = self.config.get_bool("sample_objects", False)
        if self.sample_objects:
            self.num_of_objs_to_sample = self.config.get_int(
                "num_of_objs_to_sample")
            self.obj_instances_limit = self.config.get_int(
                "obj_instances_limit", -1)

        self.dataset = self.config.get_string("dataset",
                                              "/home/lsy/dataset/ocrtoc")
        self.allow_duplication = self.config.get_bool("allow_duplication",
                                                      False)

        self.scale = 1
        self.obj_df = pd.read_csv(os.path.join(self.dataset, 'objects.csv'))
Example #21
0
    def __init__(self, config):
        LoaderInterface.__init__(self, config)
        sys_paths = self.config.get_list("sys_paths")
        for sys_path in sys_paths:
            if 'bop_toolkit' in sys_path:
                sys.path.append(sys_path)

        self.sample_objects = self.config.get_bool("sample_objects", False)
        if self.sample_objects:
            self.num_of_objs_to_sample = self.config.get_int(
                "num_of_objs_to_sample")
            self.obj_instances_limit = self.config.get_int(
                "obj_instances_limit", -1)

        self.cam_type = self.config.get_string("cam_type", "")
        self.source_frame = self.config.get_list("source_frame",
                                                 ["X", "-Y", "-Z"])
        self.bop_dataset_path = self.config.get_string("bop_dataset_path")
        self.scene_id = self.config.get_int("scene_id", -1)
        self.obj_ids = self.config.get_list("obj_ids", [])
        if self.obj_ids or self.sample_objects:
            self.allow_duplication = True
        else:
            self.allow_duplication = False
        self.split = self.config.get_string("split", "test")
        self.model_type = self.config.get_string("model_type", "")
        self.scale = 0.001 if self.config.get_bool("mm2m", False) else 1
        self.bop_dataset_name = os.path.basename(self.bop_dataset_path)
        self._has_external_texture = self.bop_dataset_name in ["ycbv", "ruapc"]

        ## ugly, but it works.
        from os.path import expanduser
        home = expanduser("~")
        path_to_category_id_path = home + "/BOP/synthetic/path_to_category_id.yaml"
        with open(path_to_category_id_path, 'r') as f:
            self.path_to_category_id = yaml.safe_load(f)
Example #22
0
 def __init__(self, config):
     LoaderInterface.__init__(self, config)
     # Supported Datablocks types by Blender Python API
     self.known_datablock_names = [
         cls.__name__ for cls in bpy.types.ID.__subclasses__()
     ]
Example #23
0
 def __init__(self, config):
     LoaderInterface.__init__(self, config)
 def __init__(self, config):
     LoaderInterface.__init__(self, config)
     # set a RE-specific material name pattern to look for in the selected objects
     self.target_material = "re_ground_mat.*"