DefaultDataset#

class DefaultDataset(split='train', data_root='data/dataset', transform=None, test_mode=False, test_cfg=None, cache=False, ignore_index=-1, loop=1)[source]#

Bases: Dataset

Generic point-cloud dataset over preprocessed per-event .npy assets.

Reads one directory per event, loading every <asset>.npy whose stem is in VALID_ASSETS (coord, color, normal, strength, segment, instance, pose). Each item is a flat dict keyed by asset name and always carries coord, segment, instance, name, and split; missing segment/instance labels are filled with -1 arrays (the ignore_index convention). After collation a batch adds the offset key delimiting per-sample point spans. Registered as DefaultDataset – use as type under data.train/data.val/ data.test.

Parameters:
  • split (str | Sequence[str]) – Split name(s). A name is treated as a JSON split file under data_root if such a file exists, otherwise as a subdirectory whose children are event directories. Defaults to "train".

  • data_root (str) – Root directory holding the split files/subdirectories. Defaults to "data/dataset".

  • transform (list[dict]) – List of transform configs (NOT a prebuilt Compose); assembled internally. Defaults to None.

  • test_mode (bool) – When True, emit voxelized/augmented test fragments instead of a single transformed sample, and force loop = 1. Defaults to False.

  • test_cfg (object) – Test-time config providing voxelize, crop, post_transform, and aug_transform. Required when test_mode is True. Defaults to None.

  • cache (bool) – When True, read each event from a shared-memory cache keyed by sample name instead of from disk. Defaults to False.

  • ignore_index (int) – Label value for ignored/unlabelled points. Defaults to -1.

  • loop (int) – Train-time epoch multiplier applied to the sample count (forced to 1 in test mode). Defaults to 1.

Note

Loader settings (batch_size, num_worker) live at the top level of the config, not on the dataset constructor.

Example

>>> from pimm.datasets.builder import build_dataset
>>> ds = build_dataset(dict(type="DefaultDataset", split="train",
...                         data_root="data/dataset", transform=[]))
>>> sample = ds[0]
>>> # get_data always returns these keys (coord/segment/instance,
>>> # with segment/instance filled to -1 when absent on disk):
>>> #   coord (N, 3), segment (N,), instance (N,), name, split
>>> # plus any present optional assets: color, normal, strength, pose
>>> sorted(sample)            
['coord', 'instance', 'name', 'segment', 'split']
get_data(idx)[source]#

Read one event directory into a flat numpy dictionary.

get_data_list()[source]#

Resolve split names or split JSON files into event directories.

get_data_name(idx)[source]#

Return the basename used for logs, predictions, and cache keys.

get_split_name(idx)[source]#

Return the split directory name for the indexed sample.

prepare_test_data(idx)[source]#

Build augmented and voxelized fragments for test-time inference.

prepare_train_data(idx)[source]#

Load one sample and apply the train transform chain.

VALID_ASSETS = ['coord', 'color', 'normal', 'strength', 'segment', 'instance', 'pose']#