MVTec 3D Datamodule

MVTec 3D Datamodule#

MVTec 3D-AD Datamodule.

This module provides a PyTorch Lightning DataModule for the MVTec 3D-AD dataset. The dataset contains RGB and depth image pairs for anomaly detection tasks.

Example

Create a MVTec3D datamodule:

>>> from anomalib.data import MVTec3D
>>> datamodule = MVTec3D(
...     root="./datasets/MVTec3D",
...     category="bagel"
... )
License:

MVTec 3D-AD dataset is released under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0). https://creativecommons.org/licenses/by-nc-sa/4.0/

Reference:

Paul Bergmann, Xin Jin, David Sattlegger, Carsten Steger: The MVTec 3D-AD Dataset for Unsupervised 3D Anomaly Detection and Localization. In: Proceedings of the 17th International Joint Conference on Computer Vision, Imaging and Computer Graphics Theory and Applications - Volume 5: VISAPP, 202-213, 2022. DOI: 10.5220/0010865000003124

class anomalib.data.datamodules.depth.mvtec_3d.MVTec3D(root='./datasets/MVTec3D', category='bagel', train_batch_size=32, eval_batch_size=32, num_workers=8, train_augmentations=None, val_augmentations=None, test_augmentations=None, augmentations=None, test_split_mode=TestSplitMode.FROM_DIR, test_split_ratio=0.2, val_split_mode=ValSplitMode.SAME_AS_TEST, val_split_ratio=0.5, seed=None)#

Bases: AnomalibDataModule

MVTec 3D-AD Datamodule.

Parameters:
  • root (Path | str) – Path to the root of the dataset. Defaults to "./datasets/MVTec3D".

  • category (str) – Category of the MVTec3D dataset (e.g. "bottle" or "cable"). Defaults to "bagel".

  • train_batch_size (int, optional) – Training batch size. Defaults to 32.

  • eval_batch_size (int, optional) – Test batch size. Defaults to 32.

  • num_workers (int, optional) – Number of workers for data loading. Defaults to 8.

  • train_augmentations (Transform | None) – Augmentations to apply dto the training images Defaults to None.

  • val_augmentations (Transform | None) – Augmentations to apply to the validation images. Defaults to None.

  • test_augmentations (Transform | None) – Augmentations to apply to the test images. Defaults to None.

  • augmentations (Transform | None) – General augmentations to apply if stage-specific augmentations are not provided.

  • test_split_mode (TestSplitMode | str) – Method to create test set. Defaults to TestSplitMode.FROM_DIR.

  • test_split_ratio (float) – Fraction of data to use for testing. Defaults to 0.2.

  • val_split_mode (ValSplitMode | str) – Method to create validation set. Defaults to ValSplitMode.SAME_AS_TEST.

  • val_split_ratio (float) – Fraction of data to use for validation. Defaults to 0.5.

  • seed (int | None, optional) – Random seed for reproducibility. Defaults to None.

prepare_data()#

Download the dataset if not available.

Return type:

None