blenderproc.python.loader.ShapeNetLoader module
Provides functionality to load objects from the ShapeNetCore.v2 dataset.
- class blenderproc.python.loader.ShapeNetLoader._ShapeNetLoader[source]
Bases:
object
- static correct_materials(obj)[source]
If the used material contains an alpha texture, the alpha texture has to be flipped to be correct
- Parameters:
obj (
MeshObject
) – object where the material maybe wrong
- static find_parent_synset_id(data_path, synset_id, json_data)[source]
Returns the parent synset_id if it exists. If the synset_id is already parent synset_id, it is just returned :type data_path: :param data_path: path to the ShapeNetCore.v2 folder :type synset_id: :param synset_id: the id of the category something like: ‘02691156’, see the data_path folder for more ids :type json_data: :param json_data: loaded data from the ShapeNet taxonomy.json file :return: parent synset_id
- static get_files_with_synset(used_synset_id, used_source_id, path_to_taxonomy_file, data_path)[source]
Returns a list of a .obj file for the given synset_id
- Parameters:
used_synset_id (
str
) – the id of the category something like: ‘02691156’, see the data_path folder for more idsused_source_id (
str
) – object identifier of a particular ShapeNet category, see inside any ShapeNet category for identifierspath_to_taxonomy_file (
str
) – path to the taxonomy.json file, should be in the data_path, toodata_path (
str
) – path to the ShapeNetCore.v2 folder
- Return type:
list
- Returns:
list of .obj files, which are in the synset_id folder, based on the given taxonomy
- blenderproc.python.loader.ShapeNetLoader.load_shapenet(data_path, used_synset_id, used_source_id='', move_object_origin=True)[source]
This loads an object from ShapeNet based on the given synset_id, which specifies the category of objects to use.
From these objects one is randomly sampled and loaded.
Todo: not good: Note: if this module is used with another loader that loads objects with semantic mapping, make sure the other module is loaded first in the config file.
- Parameters:
data_path (
str
) – The path to the ShapeNetCore.v2 folder.used_synset_id (
str
) – The synset id for example: ‘02691156’, check the data_path folder for more ids.used_source_id (
str
) – Object identifier of the a particular ShapeNet category, see inside any ShapeNet category for identifiersmove_object_origin (
bool
) – Moves the object center to the bottom of the bounding box in Z direction and also in the middle of the X and Y plane, this does not change the .location of the object. Default: True
- Return type:
- Returns:
The loaded mesh object.