ModelNet
¶
ModelNet(
name: MODELNET_NAMES = "10",
train: bool = True,
base_dir: Optional[str] = None,
pre_transform: Optional[Callable] = None,
transform: Optional[Callable] = None,
)
Bases: Dataset
The ModelNet10/40 datasets from the "3D ShapeNets: A Deep Representation for Volumetric Shapes" paper, containing CAD models of 10 and 40 categories, respectively.
Each graph is a mesh with vertex positions pos of shape [N, 3],
triangles face of shape [3, num_faces], no edges, and its
category in graph_labels. Point clouds are usually sampled from the
meshes with SamplePoints.
Note
The raw archives are large (ModelNet10: 0.5 GB, ModelNet40: 2 GB), and processing them takes a few minutes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
MODELNET_NAMES
|
|
'10'
|
train
|
bool
|
Whether to load the training or the test split. Default:
|
True
|
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 ModelNet
from mlx_graphs.transforms import NormalizeScale, SamplePoints
dataset = ModelNet(
"10",
train=True,
pre_transform=NormalizeScale(),
transform=SamplePoints(1024),
)
>>> dataset
ModelNet10(num_graphs=3991)
>>> dataset[0]
GraphData(
edge_index(shape=[2, 0], int32)
graph_labels(shape=[1], int32)
pos(shape=[1024, 3], float32))
Attributes:
| Name | Type | Description |
|---|---|---|
categories |
List[str]
|
The category names, sorted (the label of a shape is the index of |
Source code in mlx_graphs/datasets/modelnet.py
from mlx_graphs.datasets import ModelNet · mlx_graphs/datasets/modelnet.py