kaolin.io.shapenet

API

class kaolin.io.shapenet.ShapeNetV1(root, categories=None, train=True, split=0.7, with_materials=True, transform=None, output_dict=False)

Bases: Dataset

ShapeNetV1 Dataset class for meshes.

The __getitem__ method will return:

  • if output_dict=True: a dictionary with the following key-value pairs:

    • ‘mesh’: containing a kaolin.rep.SurfaceMesh returned by kaolin.io.obj.import_mesh().

    • ‘name’: the model name (i.e the subfolder name)

    • ‘path’: the full path to the .off

    • ‘synset’: the synset associated to the category

    • ‘labels’: the labels associated to the category (see synset_to_labels)

  • if output_dict=False (deprecated): a KaolinDatasetItem with the fields:

    • data: containing a kaolin.rep.SurfaceMesh returned by kaolin.io.obj.import_mesh().

    • attributes: containing a dictionary with the following key-value pairs:

      • ‘name’: the model name (i.e the subfolder name)

      • ‘path’: the full path to the .off

      • ‘synset’: the synset associated to the category

      • ‘labels’: the labels associated to the category (see synset_to_labels)

Deprecated since version 0.13.0: output_dict=False is deprecated. Datasets should always output a dictionary to be compatible with ProcessedDataset.

Parameters
  • root (str) – path to ShapeNet root directory

  • categories (list) – List of categories to load from ShapeNet. This list may contain synset ids, class label names (for ShapeNetCore classes), or a combination of both. Default: all supported categories.

  • train (bool) – If True, return the training set, otherwise the test set. Default: True.

  • split (float) – Fraction of the dataset to be used for training (>=0 and <=1). Default: 0.7

  • with_materials (bool) – If True, load and return materials. Default: True.

  • transform (Callable) – A function/transform that takes in a dictionary or KaolinDatasetItem and returns a transformed version.

  • output_dict (bool) – If True, __getitem__ output a dictionary, else KaolinDatasetItem (deprecated) Default: False.

SUPPORTED_SYNSETS = {'02691156', '02747177', '02773838', '02801938', '02808440', '02818832', '02828884', '02834778', '02843684', '02858304', '02871439', '02876657', '02880940', '02924116', '02933112', '02942699', '02946921', '02954340', '02958343', '02992529', '03001627', '03046257', '03085013', '03207941', '03211117', '03261776', '03325088', '03337140', '03467517', '03513137', '03593526', '03624134', '03636649', '03642806', '03691459', '03710193', '03759954', '03761084', '03790512', '03797390', '03928116', '03938244', '03948459', '03991062', '04004475', '04074963', '04090263', '04099429', '04225987', '04256520', '04330267', '04379243', '04401088', '04460130', '04468005', '04530566', '04554684'}
get_attributes(index)
get_cache_key(index)
get_data(index)
class kaolin.io.shapenet.ShapeNetV2(root, categories=None, train=True, split=0.7, with_materials=True, transform=None, output_dict=False)

Bases: Dataset

ShapeNetV2 Dataset class for meshes.

The __getitem__ method will return:

  • if output_dict=True: a dictionary with the following key-value pairs:

    • ‘mesh’: containing a kaolin.rep.SurfaceMesh returned by kaolin.io.obj.import_mesh().

    • ‘name’: the model name (i.e the subfolder name)

    • ‘path’: the full path to the .off

    • ‘synset’: the synset associated to the category

    • ‘labels’: the labels associated to the category (see synset_to_labels)

  • if output_dict=False (deprecated): a KaolinDatasetItem with the fields:

    • data: containing a kaolin.rep.SurfaceMesh returned by kaolin.io.obj.import_mesh().

    • attributes: containing a dictionary with the following key-value pairs:

      • ‘name’: the model name (i.e the subfolder name)

      • ‘path’: the full path to the .off

      • ‘synset’: the synset associated to the category

      • ‘labels’: the labels associated to the category (see synset_to_labels)

Deprecated since version 0.13.0: output_dict=False is deprecated. Datasets should always output a dictionary to be compatible with ProcessedDataset.

Parameters
  • root (str) – path to ShapeNet root directory

  • categories (list) – List of categories to load from ShapeNet. This list may contain synset ids, class label names (for ShapeNetCore classes), or a combination of both. Default: all supported categories.

  • train (bool) – If True, return the training set, otherwise the test set. Default: True.

  • split (float) – fraction of the dataset to be used for training (>=0 and <=1). Default: 0.7

  • with_materials (bool) – If True, load and return materials. Default: True.

  • transform (Callable) – A function/transform that takes in a dictionary or KaolinDatasetItem and returns a transformed version.

  • output_dict (bool) – If True, __getitem__ output a dictionary, else KaolinDatasetItem (deprecated) Default: False.

SUPPORTED_SYNSETS = {'02691156', '02747177', '02773838', '02801938', '02808440', '02818832', '02828884', '02843684', '02871439', '02876657', '02880940', '02924116', '02933112', '02942699', '02946921', '02954340', '02958343', '02992529', '03001627', '03046257', '03085013', '03207941', '03211117', '03261776', '03325088', '03337140', '03467517', '03513137', '03593526', '03624134', '03636649', '03642806', '03691459', '03710193', '03759954', '03761084', '03790512', '03797390', '03928116', '03938244', '03948459', '03991062', '04004475', '04074963', '04090263', '04099429', '04225987', '04256520', '04330267', '04379243', '04401088', '04460130', '04468005', '04530566', '04554684'}
get_attributes(index)
get_cache_key(index)
get_data(index)