Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
826d89d
🐞 fix(utils): revert `OptionalImport` class to handle missing optiona…
samet-akcay Sep 16, 2025
b1b5406
Added 3D-ADAM Dataset
PaulMcHard Oct 1, 2025
8a318f9
Added tests and example config
PaulMcHard Oct 1, 2025
e576472
πŸ”¨ fix(semgrep): ignore uv.lock in semgrep (#2972)
ashwinvaidya17 Sep 26, 2025
20afda6
🐞 fix(utils): Run CS Flow model in eval() so the weights of the model…
monzelr Sep 29, 2025
6f99ebc
πŸ› fix(ovinferencer): Fix openvino cache directory (#2979)
rajeshgangireddy Sep 29, 2025
f1db4b7
changes per PR and pre-commit checks
PaulMcHard Oct 1, 2025
15cffd3
Merge branch 'main' into main
PaulMcHard Oct 1, 2025
cf3b244
resolve circular import issue
PaulMcHard Oct 2, 2025
cdd87d7
Merge branch 'main' of https://github.com/PaulMcHard/3D-ADAM_anomalib
PaulMcHard Oct 2, 2025
84bec1a
Merge branch 'open-edge-platform:main' into main
PaulMcHard Oct 3, 2025
530cef9
Resolve DownloadInfo URL issue.
PaulMcHard Oct 3, 2025
01574d2
Resolve DownloadInfo URL
PaulMcHard Oct 6, 2025
302159d
Merge branch 'open-edge-platform:main' into main
PaulMcHard Oct 6, 2025
73df743
restore doc images ignored in error
PaulMcHard Oct 6, 2025
bc97595
t:Merge branch 'main' of https://github.com/PaulMcHard/3D-ADAM_anomalib
PaulMcHard Oct 6, 2025
0175ec1
Removed prettier cache included in error, re-run pre-commit hooks
PaulMcHard Oct 6, 2025
fdac4af
explictly resolve EOF error on docs/source/examples
PaulMcHard Oct 6, 2025
fe04f7d
Merge branch 'main' into main
rajeshgangireddy Oct 6, 2025
de13783
resolve filename issue in adam3d test.
PaulMcHard Oct 6, 2025
67a87d1
Merge branch 'main' of https://github.com/PaulMcHard/3D-ADAM_anomalib
PaulMcHard Oct 6, 2025
2ca11c1
Restore uv.lock
PaulMcHard Oct 6, 2025
cbc3e93
Merge branch 'open-edge-platform:main' into main
PaulMcHard Oct 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/source/examples

This file was deleted.

1 change: 1 addition & 0 deletions docs/source/examples
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../../examples
Binary file removed docs/source/images/cfa/results/0.png
Binary file not shown.
Binary file removed docs/source/images/cfa/results/1.png
Binary file not shown.
Binary file removed docs/source/images/cfa/results/2.png
Binary file not shown.
Binary file removed docs/source/images/cflow/results/0.png
Binary file not shown.
Binary file removed docs/source/images/cflow/results/1.png
Binary file not shown.
Binary file removed docs/source/images/cflow/results/2.png
Binary file not shown.
Binary file removed docs/source/images/fastflow/results/0.png
Binary file not shown.
Binary file removed docs/source/images/fastflow/results/1.png
Binary file not shown.
Binary file removed docs/source/images/fastflow/results/2.png
Binary file not shown.
Binary file removed docs/source/images/padim/results/0.png
Binary file not shown.
Binary file removed docs/source/images/padim/results/1.png
Binary file not shown.
Binary file removed docs/source/images/padim/results/2.png
Binary file not shown.
Binary file removed docs/source/images/patchcore/results/0.png
Binary file not shown.
Binary file removed docs/source/images/patchcore/results/1.png
Binary file not shown.
Binary file removed docs/source/images/patchcore/results/2.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed docs/source/images/stfpm/results/0.png
Binary file not shown.
Binary file removed docs/source/images/stfpm/results/1.png
Binary file not shown.
Binary file removed docs/source/images/stfpm/results/2.png
Binary file not shown.
10 changes: 10 additions & 0 deletions examples/configs/data/adam_3d.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class_path: anomalib.data.ADA3D
init_args:
root: ./datasets/ADAM3D
category: "1m1"
train_batch_size: 32
eval_batch_size: 32
num_workers: 8
test_split_mode: from_dir
val_split_mode: from_dir
seed: null
Empty file modified examples/configs/model/fre.yaml
100755 β†’ 100644
Empty file.
6 changes: 4 additions & 2 deletions src/anomalib/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

# Datamodules
from .datamodules.base import AnomalibDataModule
from .datamodules.depth import DepthDataFormat, Folder3D, MVTec3D
from .datamodules.depth import ADAM3D, DepthDataFormat, Folder3D, MVTec3D
from .datamodules.image import (
MPDD,
VAD,
Expand All @@ -69,7 +69,7 @@

# Datasets
from .datasets import AnomalibDataset
from .datasets.depth import Folder3DDataset, MVTec3DDataset
from .datasets.depth import ADAM3DDataset, Folder3DDataset, MVTec3DDataset
from .datasets.image import (
BTechDataset,
DatumaroDataset,
Expand Down Expand Up @@ -175,6 +175,7 @@ def get_datamodule(config: DictConfig | ListConfig | dict) -> AnomalibDataModule
# Depth Data Modules
"Folder3D",
"MVTec3D",
"ADAM3D",
# Image Data Modules
"BTech",
"Datumaro",
Expand All @@ -201,6 +202,7 @@ def get_datamodule(config: DictConfig | ListConfig | dict) -> AnomalibDataModule
"FolderDataset",
"KolektorDataset",
"MPDDDataset",
"ADAM3DDataset",
"MVTecADDataset",
"MVTecLOCODataset",
"TabularDataset",
Expand Down
4 changes: 3 additions & 1 deletion src/anomalib/data/datamodules/depth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from enum import Enum

from .adam_3d import ADAM3D
from .folder_3d import Folder3D
from .mvtec_3d import MVTec3D

Expand All @@ -14,6 +15,7 @@ class DepthDataFormat(str, Enum):

MVTEC_3D = "mvtec_3d"
FOLDER_3D = "folder_3d"
ADAM_3D = "adam_3d"


__all__ = ["Folder3D", "MVTec3D"]
__all__ = ["Folder3D", "MVTec3D", "ADAM3D"]
139 changes: 139 additions & 0 deletions src/anomalib/data/datamodules/depth/adam_3d.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Copyright (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

"""3D-ADAM Datamodule.

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

Example:
Create a ADAM3D datamodule::

>>> from anomalib.data import ADAM3D
>>> datamodule = ADAM3D(
... root="./datasets/ADAM3D",
... category="1m1"
... )

License:
3D-ADAM 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: https://arxiv.org/abs/2507.07838

"""

import logging
from pathlib import Path

from torchvision.transforms.v2 import Transform

from anomalib.data.datamodules.base.image import AnomalibDataModule
from anomalib.data.datasets.depth.adam_3d import ADAM3DDataset
from anomalib.data.utils import DownloadInfo, Split, TestSplitMode, ValSplitMode, download_and_extract

logger = logging.getLogger(__name__)


DOWNLOAD_INFO = DownloadInfo(
name="adam_3d",
url="https://huggingface.co/datasets/pmchard/3D-ADAM_anomalib/blob/main/adam3d_cropped.zip",
hashsum="ffc4c52afa1566a4165c42300c21758ec8292ff04305c65e81e830abb8200c36",
)


class ADAM3D(AnomalibDataModule):
"""3D-ADAM Datamodule.

Args:
root (Path | str): Path to the root of the dataset.
Defaults to ``"./datasets/ADAM3D"``.
category (str): Category of the 3D-ADAM dataset (e.g. ``"1m1"`` or
``"spiral_gear"``). Defaults to ``"1m1"``.
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``.
"""

def __init__(
self,
root: Path | str = "./datasets/ADAM3D",
category: str = "1m1",
train_batch_size: int = 32,
eval_batch_size: int = 32,
num_workers: int = 8,
train_augmentations: Transform | None = None,
val_augmentations: Transform | None = None,
test_augmentations: Transform | None = None,
augmentations: Transform | None = None,
test_split_mode: TestSplitMode | str = TestSplitMode.FROM_DIR,
test_split_ratio: float = 0.2,
val_split_mode: ValSplitMode | str = ValSplitMode.SAME_AS_TEST,
val_split_ratio: float = 0.5,
seed: int | None = None,
) -> None:
super().__init__(
train_batch_size=train_batch_size,
eval_batch_size=eval_batch_size,
num_workers=num_workers,
train_augmentations=train_augmentations,
val_augmentations=val_augmentations,
test_augmentations=test_augmentations,
augmentations=augmentations,
test_split_mode=test_split_mode,
test_split_ratio=test_split_ratio,
val_split_mode=val_split_mode,
val_split_ratio=val_split_ratio,
seed=seed,
)

self.root = Path(root)
self.category = category

def _setup(self, _stage: str | None = None) -> None:
"""Set up the datasets.

Args:
_stage (str | None, optional): Stage of setup. Not used.
Defaults to ``None``.
"""
self.train_data = ADAM3DDataset(
split=Split.TRAIN,
root=self.root,
category=self.category,
)
self.test_data = ADAM3DDataset(
split=Split.TEST,
root=self.root,
category=self.category,
)

def prepare_data(self) -> None:
"""Download the dataset if not available."""
if (self.root / self.category).is_dir():
logger.info("Found the dataset.")
else:
download_and_extract(self.root, DOWNLOAD_INFO)
4 changes: 3 additions & 1 deletion src/anomalib/data/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Depth Datasets:
- ``Folder3DDataset``: Custom RGB-D dataset from folder structure
- ``MVTec3DDataset``: MVTec 3D AD dataset with industrial objects
- ``ADAM3DDataset``: 3D ADAM dataset with additive manufactured objects

Image Datasets:
- ``BTechDataset``: BTech dataset containing industrial objects
Expand Down Expand Up @@ -40,7 +41,7 @@
"""

from .base import AnomalibDataset, AnomalibDepthDataset, AnomalibVideoDataset
from .depth import Folder3DDataset, MVTec3DDataset
from .depth import ADAM3DDataset, Folder3DDataset, MVTec3DDataset
from .image import (
BTechDataset,
DatumaroDataset,
Expand All @@ -62,6 +63,7 @@
# Depth
"Folder3DDataset",
"MVTec3DDataset",
"ADAM3DDataset",
# Image
"BTechDataset",
"DatumaroDataset",
Expand Down
4 changes: 3 additions & 1 deletion src/anomalib/data/datasets/depth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

- ``Folder3DDataset``: Custom dataset for loading RGB-D data from a folder structure
- ``MVTec3DDataset``: Implementation of the MVTec 3D-AD dataset
- ``ADAM3DDataset``: Implementation of the 3D-ADAM dataset

Example:
>>> from anomalib.data.datasets import Folder3DDataset
Expand All @@ -25,7 +26,8 @@
... )
"""

from .adam_3d import ADAM3DDataset
from .folder_3d import Folder3DDataset
from .mvtec_3d import MVTec3DDataset

__all__ = ["Folder3DDataset", "MVTec3DDataset"]
__all__ = ["Folder3DDataset", "MVTec3DDataset", "ADAM3DDataset"]
Loading
Loading