Dataset loaders for datasets including ShapeNetCore.

class pytorch3d.datasets.ShapeNetCore(data_dir, synsets=None, version: int = 1)[source]


This class loads ShapeNetCore from a given directory into a Dataset object. ShapeNetCore is a subset of the ShapeNet dataset and can be downloaded from

__init__(data_dir, synsets=None, version: int = 1)[source]

Store each object’s synset id and models id from data_dir. :param data_dir: Path to ShapeNetCore data. :param synsets: List of synset categories to load from ShapeNetCore in the form of

synset offsets or labels. A combination of both is also accepted. When no category is specified, all categories in data_dir are loaded.
Parameters:version – (int) version of ShapeNetCore data in data_dir, 1 or 2. Default is set to be 1. Version 1 has 57 categories and verions 2 has 55 categories. Note: version 1 has two categories 02858304(boat) and 02992529(cellphone) that are hyponyms of categories 04530566(watercraft) and 04401088(telephone) respectively. You can combine the categories manually if needed. Version 2 doesn’t have 02858304(boat) or 02834778(bicycle) compared to version 1.

Return number of total models in shapenet core.


Read a model by the given index. :returns: dictionary with following keys

  • verts: FloatTensor of shape (V, 3).
  • faces: LongTensor of shape (F, 3) which indexes into the verts tensor.
  • synset_id (str): synset id
  • model_id (str): model id
  • label (str): synset label.