ShapeNet
¶
ShapeNet(
categories: Optional[Union[str, List[str]]] = None,
include_normals: bool = True,
split: SHAPENET_SPLITS = "trainval",
base_dir: Optional[str] = None,
pre_transform: Optional[Callable] = None,
transform: Optional[Callable] = None,
)
Bases: Dataset
The ShapeNet part level segmentation dataset from the "A Scalable Active Framework for Region Annotation in 3D Shape Collections" paper, containing about 17,000 3D shape point clouds from 16 shape categories. Each category is annotated with 2 to 6 parts (50 part labels in total).
Each graph is a point cloud with positions pos of shape [N, 3], the
normals in node_features (if include_normals), the part label of
each point in node_labels, its category index in category and no
edges.
The original download (shapenet.cs.stanford.edu) is offline: the
archive is downloaded from a mirror on the Hugging Face Hub and checked
against its SHA-256 hash.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
categories
|
Optional[Union[str, List[str]]]
|
The category names (see |
None
|
include_normals
|
bool
|
Whether to store the normals as node features.
Default: |
True
|
split
|
SHAPENET_SPLITS
|
|
'trainval'
|
base_dir
|
Optional[str]
|
Directory where to store the dataset. Default: |
None
|
pre_transform
|
Optional[Callable]
|
A transform applied to each graph once, before saving
the processed dataset. Default: |
None
|
transform
|
Optional[Callable]
|
A transform applied to each graph when accessed. Default:
|
None
|
Example:
from mlx_graphs.datasets import ShapeNet
dataset = ShapeNet(categories=["Airplane"], split="train")
>>> dataset[0]
GraphData(
edge_index(shape=[2, 0], int32)
node_features(shape=[2518, 3], float32)
node_labels(shape=[2518], int32)
pos(shape=[2518, 3], float32)
category(shape=[1], int32))
Attributes:
| Name | Type | Description |
|---|---|---|
num_classes |
int
|
The number of part labels (50). |
Source code in mlx_graphs/datasets/shapenet.py
from mlx_graphs.datasets import ShapeNet · mlx_graphs/datasets/shapenet.py