kaolin.io.dataset

API

class kaolin.io.dataset.Cache(func: Callable, cache_dir: [<class 'str'>, <class 'pathlib.Path'>], cache_key: str)

Bases: object

Caches the results of a function to disk. If already cached, data is returned from disk. Otherwise, the function is executed. Output tensors are always on CPU device.

Parameters:
  • func (Callable) – The function to cache.
  • cache_dir (str or Path) – Directory where objects will be cached.
  • cache_key (str) – The corresponding cache key for this function.
try_get(unique_id: str)

Read cache from disk. If not found, raise error.

Parameters:unique_id (str) – The unique id with which to name the cached file.
Returns:Results from self.func if exists on disk.
class kaolin.io.dataset.CombinationDataset(datasets)

Bases: torch.utils.data.dataset.Dataset

Dataset combining a list of datasets into a unified dataset object.

Useful when multiple output representations are needed from a common base representation (Eg. when a mesh is to be served as both a pointcloud and a voxelgrid, etc.)

The output of get_attributes will be a tuple of all the get_attributes of the dataset list.

The output of get_data will be a tuple of all the get_data of the dataset list.

If a dataset does not have get_data, __getitem__ will be used instead.

The output of get_cache_key will be the cache key of the first dataset. If that dataset does not provide get_cache_key, the index will be used instead.

Parameters:datasets – list or tuple of datasets
get_attributes(index)
get_cache_key(index)
get_data(index)
class kaolin.io.dataset.KaolinDatasetItem(data, attributes)

Bases: tuple

attributes

Alias for field number 1

data

Alias for field number 0

class kaolin.io.dataset.ProcessedDataset(dataset, preprocessing_transform=None, cache_dir=None, num_workers=None, transform=None, no_progress: bool = False)

Bases: torch.utils.data.dataset.Dataset

get_attributes(index)
get_cache_key(index)
get_data(index)

Returns the data at the given index.