Skip to content

ShapeNetPart

ShapeNetPart object part segmentation dataset.

First page of A Scalable Active Framework for Region Annotation in 3D Shape Collections

ACM ACM TOG · November 2016

Classes:

  • ShapeNetPartData –

    Per-point arrays of one ShapeNetPart shape, as returned by load_shapenet_part_data.

  • ShapeNetPart –

    ShapeNetPart dataset packed into per-split .npy files.

Functions:

ShapeNetPartData

Bases: TypedDict

Per-point arrays of one ShapeNetPart shape, as returned by load_shapenet_part_data.

ShapeNetPart

ShapeNetPart(
    root: PathLike,
    *,
    split: Literal["train", "val", "test"],
    categories: Optional[
        Union[List[ShapeNetCategory], ShapeNetCategory]
    ] = None,
    transform: Optional[TransformLike] = None,
    force_process: bool = False,
    show_progress: bool = True,
    num_workers: Optional[int] = None,
)

Bases: PointCloudDataset

ShapeNetPart dataset packed into per-split .npy files.

Each split is packed once into:

<processed_dir>/<split>/
    pos.npy           # float32, (total_points, 3)
    normal.npy        # float32, (total_points, 3)
    segment.npy       # int16,   (total_points,)
    offset.npy        # int64,   (n_samples + 1,)
    category.npy      # int16,   (n_samples,)

The packed files contain every category; categories filters the sample index at load time, so changing the subset is free.

Parameters:

  • root (PathLike) –

    Dataset root directory.

  • split (Literal['train', 'val', 'test']) –

    One of "train", "val", "test".

  • categories (Optional[Union[List[ShapeNetCategory], ShapeNetCategory]], default: None ) –

    Which categories to expose. Defaults to all 16.

  • transform (Optional[TransformLike], default: None ) –

    Callable applied to each sample in __getitem__.

  • force_process (bool, default: False ) –

    Re-pack raw data even if processed files exist.

  • show_progress (bool, default: True ) –

    Show a progress bar during processing.

  • num_workers (Optional[int], default: None ) –

    Parallelism for raw-file reading during processing.

Methods:

  • download –

    ShapeNetPart must be downloaded manually (registration is required).

Attributes:

  • data_dir (str) –

    Path to the dataset directory <root>/<name>.

  • raw_dir (str) –

    Path to the raw download directory.

  • processed_dir (str) –

    Path to the processed cache directory.

  • category_to_id (Dict[str, int]) –

    Mapping from category name to its index among the exposed categories.

  • seg_to_id (Dict[int, int]) –

    Mapping from part label to its index among the exposed categories' parts.

  • name (str) –

    Name of the dataset directory.

data_dir property

data_dir: str

Path to the dataset directory <root>/<name>.

raw_dir property

raw_dir: str

Path to the raw download directory.

processed_dir property

processed_dir: str

Path to the processed cache directory.

category_to_id property

category_to_id: Dict[str, int]

Mapping from category name to its index among the exposed categories.

seg_to_id property

seg_to_id: Dict[int, int]

Mapping from part label to its index among the exposed categories' parts.

name property

name: str

Name of the dataset directory.

download

download(force: bool = False) -> None

ShapeNetPart must be downloaded manually (registration is required).

Parameters:

  • force (bool, default: False ) –

    Unused; present to mirror the other datasets' download signature.

Raises: RuntimeError: Always; automatic download is not supported.

load_shapenet_part_data

load_shapenet_part_data(
    file_path: PathLike,
) -> Optional[ShapeNetPartData]

Load one ShapeNetPart shape from a raw .txt file.

Parameters:

  • file_path (PathLike) –

    Path to a raw <category_id>/<model_id>.txt shape.

Returns:

  • Optional[ShapeNetPartData] –

    The shape's pos \((N, 3)\), normal \((N, 3)\) and part segment \((N,)\) arrays, or None when

  • Optional[ShapeNetPartData] –

    the file holds no point.