ModelNet
ModelNet10/40 shape classification datasets, including normal-resampled and HDF5 variants.

Classes:
-
ModelNet10–The ModelNet10 dataset as described in the paper
-
ModelNet40–The ModelNet40 dataset as described in the paper
-
ModelNetNormalResampled–The ModelNet shapes resampled to 10,000 surface points with normals, as described in the paper
-
ModelNet40Hdf5–The pre-sampled HDF5 version of ModelNet40 (
modelnet40_ply_hdf5_2048), introduced with
Functions:
-
load_modelnet_data–Load one ModelNet mesh from a raw OFF file.
-
load_modelnet_normal_resampled_data–Load one ModelNet shape from a raw normal-resampled
.txtfile.
ModelNet10
¶
ModelNet10(
root: PathLike,
train: bool = True,
classes: Union[str, Sequence[str]] = "all",
transform: Optional[
Callable[[Dict[str, Any]], Dict[str, Any]]
] = None,
download: bool = False,
force_download: bool = False,
force_process: bool = False,
show_progress: bool = True,
num_workers: Optional[int] = None,
)
Bases: _ModelNet
The ModelNet10 dataset as described in the paper 3D ShapeNets: A Deep Representation for Volumetric Shapes.
You can download the official dataset from the Princeton dedicated website.
The ModelNet10 dataset consists of 10 classes, containing 3,991 training and 908 test examples.
Parameters:
-
root(PathLike) –Root directory where the dataset should be stored.
-
train(bool, default:True) –If
True, loads the training set, otherwise the test set. -
classes(Union[str, Sequence[str]], default:'all') –The class names to include in the dataset. If
"all", all classes are included. -
transform(Optional[Callable[[Dict[str, Any]], Dict[str, Any]]], default:None) –A function/transform that takes in a dictionary containing the data and returns a transformed version.
-
download(bool, default:False) –If
True, downloads the dataset from the internet and puts it inroot. -
force_download(bool, default:False) –If
True, forces to download the dataset from the internet, even if it is already downloaded. -
force_process(bool, default:False) –If
True, forces to process the dataset, even if it is already processed. -
show_progress(bool, default:True) –If
True, displays a progress bar of the download and processing. -
num_workers(Optional[int], default:None) –The number of workers to use for parallel processing.
Example
Attributes:
-
name(str) –Name of the dataset directory.
-
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.
ModelNet40
¶
ModelNet40(
root: PathLike,
train: bool = True,
classes: Union[str, Sequence[str]] = "all",
transform: Optional[
Callable[[Dict[str, Any]], Dict[str, Any]]
] = None,
download: bool = False,
force_download: bool = False,
force_process: bool = False,
show_progress: bool = True,
num_workers: Optional[int] = None,
)
Bases: _ModelNet
The ModelNet40 dataset as described in the paper 3D ShapeNets: A Deep Representation for Volumetric Shapes.
You can download the official dataset from the Princeton dedicated website.
The ModelNet40 dataset consists of 40 classes, containing 9,843 training and 2,468 test examples.
Parameters:
-
root(PathLike) –Root directory where the dataset should be stored.
-
train(bool, default:True) –If
True, loads the training set, otherwise the test set. -
classes(Union[str, Sequence[str]], default:'all') –The class names to include in the dataset. If
"all", all classes are included. -
transform(Optional[Callable[[Dict[str, Any]], Dict[str, Any]]], default:None) –A function/transform that takes in a dictionary containing the data and returns a transformed version.
-
download(bool, default:False) –If
True, downloads the dataset from the internet and puts it inroot. -
force_download(bool, default:False) –If
True, forces to download the dataset from the internet, even if it is already downloaded. -
force_process(bool, default:False) –If
True, forces to process the dataset, even if it is already processed. -
show_progress(bool, default:True) –If
True, displays a progress bar of the download and processing. -
num_workers(Optional[int], default:None) –The number of workers to use for parallel processing.
Example
Attributes:
-
name(str) –Name of the dataset directory.
-
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.
ModelNetNormalResampled
¶
ModelNetNormalResampled(
root: PathLike,
variant: Literal["10", "40"],
train: bool = True,
classes: Union[str, Sequence[str]] = "all",
transform: Optional[
Callable[[Dict[str, Any]], Dict[str, Any]]
] = None,
download: bool = False,
force_download: bool = False,
force_process: bool = False,
show_progress: bool = True,
num_workers: Optional[int] = None,
)
Bases: PointCloudDataset
The ModelNet shapes resampled to 10,000 surface points with normals, as described in the paper PointNet++: Deep Hierarchical Feature Learning on Point Sets in a Metric Space.
Each shape from ModelNet10 / ModelNet40 (see ModelNet10 and ModelNet40 for the mesh datasets) is
stored as a .txt file of 10,000 rows with six comma-separated columns: the \(xyz\) coordinates
(normalized to the unit sphere) followed by the surface normal. This is the standard input for the
point-based classification benchmarks (PointNet++, PointMLP, Point-MAE, ...), which typically sample
the first \(1024\) points. The variant selects the 10-class or 40-class label set from the same
resampled release.
Parameters:
-
root(PathLike) –Root directory where the dataset should be stored.
-
variant(Literal['10', '40']) –The label set to load,
"10"(ModelNet10 classes) or"40"(ModelNet40 classes). -
train(bool, default:True) –If
True, loads the training set, otherwise the test set. -
classes(Union[str, Sequence[str]], default:'all') –The class names to include in the dataset. If
"all", all classes are included. -
transform(Optional[Callable[[Dict[str, Any]], Dict[str, Any]]], default:None) –A function/transform that takes in a dictionary containing the data and returns a transformed version.
-
download(bool, default:False) –If
True, downloads the dataset from the internet and puts it inroot. -
force_download(bool, default:False) –If
True, forces to download the dataset from the internet, even if it is already downloaded. -
force_process(bool, default:False) –If
True, forces to process the dataset, even if it is already processed. -
show_progress(bool, default:True) –If
True, displays a progress bar of the download and processing. -
num_workers(Optional[int], default:None) –The number of workers to use for parallel processing.
Shape
pos: \((10000, 3)\) unit-sphere coordinates.normal: \((10000, 3)\) surface normals.label: scalar class index.
Example
Attributes:
-
original_classes(Tuple[str, ...]) –Class names of the variant, in the original release order.
-
class_to_idx(dict[str, int]) –Mapping from class name to label index.
-
name(str) –Name of the dataset directory.
-
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.
original_classes
property
¶
Class names of the variant, in the original release order.
ModelNet40Hdf5
¶
ModelNet40Hdf5(
root: PathLike,
train: bool = True,
transform: Optional[
Callable[[Dict[str, Any]], Dict[str, Any]]
] = None,
download: bool = False,
force_download: bool = False,
force_process: bool = False,
show_progress: bool = True,
)
Bases: PointCloudDataset
The pre-sampled HDF5 version of ModelNet40 (modelnet40_ply_hdf5_2048), introduced with
PointNet: Deep Learning on Point Sets for 3D Classification and Segmentation.
Each ModelNet40 mesh is sampled to 2,048 surface points with normals, normalized to the unit
sphere, and the pre-shuffled clouds are sharded into HDF5 files listed by train_files.txt /
test_files.txt (9,840 train and 2,468 test clouds). This is the standard evaluation input for
point-based classification benchmarks (DGCNN, PointMLP, PointNeXt, ...), which take the first
\(N\) points of each cloud rather than resampling.
Each sample is a dict with the following keys:
| Key | Shape | Dtype | Description |
|---|---|---|---|
pos |
\((2048, 3)\) | float32 | Unit-sphere XYZ coordinates |
normal |
\((2048, 3)\) | float32 | Surface normals |
label |
scalar | int64 | Class index (40 classes) |
The HDF5 shards are used directly (no separate processed cache): force_process is accepted for
contract parity and is a no-op.
Parameters:
-
root(PathLike) –Root directory where the dataset should be stored.
-
train(bool, default:True) –If
True, loads the training set, otherwise the test set. -
transform(Optional[Callable[[Dict[str, Any]], Dict[str, Any]]], default:None) –A function/transform that takes in a dictionary containing the data and returns a transformed version.
-
download(bool, default:False) –If
True, downloads the dataset from the internet and puts it inroot. -
force_download(bool, default:False) –If
True, forces to download the dataset from the internet, even if it is already downloaded. -
force_process(bool, default:False) –Accepted for contract parity; the HDF5 shards are used directly, so this is a no-op.
-
show_progress(bool, default:True) –If
True, displays a progress bar of the download and loading.
Example
Attributes:
-
split_file(str) –Path to the raw file list of the split.
-
name(str) –Name of the dataset directory.
-
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.
load_modelnet_data
¶
Load one ModelNet mesh from a raw OFF file.
Parameters:
-
file_path(PathLike) –Path to a raw
<class>/<split>/<model_id>.offmesh. -
target(int) –Label index of the shape.
Returns:
-
Dict[str, Tensor]–The mesh's
pos\((N, 3)\) vertices,face\((F, 3)\) triangles and scalarlabel.
load_modelnet_normal_resampled_data
¶
Load one ModelNet shape from a raw normal-resampled .txt file.
Parameters:
-
file_path(PathLike) –Path to a raw
<class>/<model_id>.txtshape. -
target(int) –Label index of the shape.
Returns:
-
Dict[str, Tensor]–The shape's
pos\((N, 3)\),normal\((N, 3)\) and scalarlabel.