shapenetpart
ShapeNetPart object part segmentation dataset.

Classes:
-
ShapeNetPartDataβPer-point arrays of one ShapeNetPart shape, as returned by
load_shapenet_part_data. -
ShapeNetPartβShapeNetPart dataset packed into per-split
.npyfiles.
Functions:
-
load_shapenet_part_dataβLoad one ShapeNetPart shape from a raw
.txtfile.
ShapeNetPartData [source] ΒΆ
Bases: TypedDict
Per-point arrays of one ShapeNetPart shape, as returned by load_shapenet_part_data.
ShapeNetPart [source] ΒΆ
ShapeNetPart(
root: PathLike,
*,
split: Literal["train", "val", "test"] = "train",
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'], default:'train') βOne of
"train"(the default),"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.
category_to_id property ΒΆ
Mapping from category name to its index among the exposed categories.
seg_to_id property ΒΆ
Mapping from part label to its index among the exposed categories' parts.
load_shapenet_part_data [source] ΒΆ
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>.txtshape.
Returns:
-
Optional[ShapeNetPartData]βThe shape's
pos\((N, 3)\),normal\((N, 3)\) and partsegment\((N,)\) arrays, orNonewhen -
Optional[ShapeNetPartData]βthe file holds no point.